执行“mvn antrun:run”时,我的任务没有运行。
我如何从命令行专门执行任务?
最佳答案
假设这样的东西被添加到你的 pom.xml
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>package</phase><!--Change this to control when it runs -->
<configuration>
<tasks>
<echo message="Hello, maven"/>
</tasks>
</configuration>
<goals>
<goal>run</goal><!-- this is to call antrun:run -->
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
正在执行
mvn package
将在您的控制台上产生以下结果[INFO] [antrun:run {execution: default}]
[INFO] Executing tasks
[echo] Hello, maven
[INFO] Executed tasks
您可以更改
phase
让您的 ant 脚本在您需要的任何时间运行。
关于maven-2 - maven, Ant 插件,antrun :run,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/910177/