gpt4 book ai didi

Mavent AntRun 不执行任务

转载 作者:行者123 更新时间:2023-12-04 01:33:50 24 4
gpt4 key购买 nike

按照使用页​​面上的说明 (http://maven.apache.org/plugins/maven-antrun-plugin/usage.html) 和其他 Stackoverflow 问题,我一直在尝试让 Ant 任务从我的 Maven 构建中运行.我已经将我要做的事情简化为“你好,Maven”的简单回声,但我什么也没得到。

我正在执行 Maven:

mvn package

我希望这个特定任务在打包之前运行(“准备打包”),所以我首先尝试了那个阶段,但是当那不起作用时,我尝试让我的阶段只是“打包”。

这是我尝试过的一种插件配置:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>id.package.ant</id>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<echo message="Hello, maven"/>
</target>
</configuration>
</execution>
</executions>
</plugin>

这是我尝试过的另一个:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>id.package.ant</id>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo message="Hello, maven"/>
</tasks>
</configuration>
</execution>
</executions>
</plugin>

我也尝试过没有 的这些。

我没有错误,根本没有输出。即使我执行 Maven -debug,输出中也没有出现“echo”这个词,输出中没有出现“antrun”这个词,输出中也没有出现“hello”这个词。

就像插件配置甚至不存在一样。

最佳答案

安德鲁在他的评论中给出了正确的答案。当我将我的 maven-antrun-plugin AS-IS 移到上面(使用 <target> 而不是 <tasks> )从 <pluginManagement> 移出时并变成一个独立的 <plugins> ,我的 Ant 任务开始执行。

令人惊讶的是,之前有多少 Google 和 Stackoverflow 搜索没有返回另一个问题,但现在我对 pluginManagement 有了更好的理解。谢谢,安德鲁!

关于Mavent AntRun 不执行任务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14526864/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com