【问题标题】:How can I run a Class with main() when doing mvn clean install执行 mvn clean install 时如何使用 main() 运行类
【发布时间】:2011-10-06 11:28:39
【问题描述】:


我想执行一个类的main方法(为此我找到了this Exec Plugin),我想做的是在构建项目时自动执行这个插件。
我不需要mvn exec:exec -Dexec.executable="java"

【问题讨论】:

    标签: plugins maven build exec


    【解决方案1】:

    任何插件都可以添加到<build>/<plugins> 部分并绑定到特定阶段以自动执行。事实上 Exec Plugin 页面有一个example

    这里有一个guide to configuring 插件和更多示例。搜索单词phase

    【讨论】:

    • 我现在的问题是我要运行的类没有看到我的项目所具有的依赖项..
    • 请提供不起作用的 pom.xml(添加到您的问题中)
    • classpathScope 帮助了我。谢谢。
    猜你喜欢
    • 2021-04-23
    • 1970-01-01
    • 1970-01-01
    • 2013-11-16
    • 2016-11-11
    • 2019-02-28
    • 1970-01-01
    • 2013-06-29
    • 2019-06-17
    相关资源
    最近更新 更多