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