maven-2 - maven, Ant 插件,antrun :run

标签 maven-2 ant maven-plugin

执行“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/

相关文章:

java - 无法加载编解码器 'Lucene410'

java - ant:编译尽可能多的类以防出现编译错误

maven - Nexus 3.1.0-04 OSS - 在存储库/组件中没有看到 Artifact/ Assets

maven - 如何排除 Maven 继承的子依赖项中的父 pom 依赖项?

java - 如何更改 Maven2 中的 JUnit 转换

testing - ScalaTest 和 Maven : getting started

maven-2 - 使用 maven-compiler-plugin 进行 Maven 注释处理

在本地机器上使用 Eclipse 和远程调试的 Java 热交换

java - Maven:将生成的 tomcat-maven-plugin 资源放在哪里?

maven-2 - 您知道 mvnrepository.com 的 Maven 配置文件吗?