执行“mvn antrun:run”时,我的任务没有运行。我有一个echo任务,但没有输出显示。当运行任务绑定的阶段时,它们确实被执行。如何从命令行特别执行任务?
<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 脚本在需要的任何时候运行。