gpt4 book ai didi

java - Maven java maven-antrun-plugin

转载 作者:行者123 更新时间:2023-11-30 04:53:48 25 4
gpt4 key购买 nike

我遇到以下问题:

我已经在我的 pom.xml 文件中配置了一个 ant 插件用于验证阶段。任务只是将一些字符串回显到控制台。问题是我看到我的执行被考虑在内,但没有任务被执行。有人遇到过类似的问题吗?下面是我的 pom.xml 文件的代码:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mp</groupId>
<artifactId>parentApp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>parentApp</name>
<description>This is just to test pom inheritance</description>


<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<build>
<defaultGoal>package</defaultGoal>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<id>echodir</id>
<goals>
<goal>run</goal>
</goals>
<phase>verify</phase>
<inherited>true</inherited>
<configuration>
<task>
<echo>*************************************************** Build Dir</echo>
<mkdir>./hey</mkdir>
</task>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-core</artifactId>
<version>5.1.0</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>
</dependencies>
</dependencyManagement>

运行mvn verify时得到的输出如下:

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building parentApp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-antrun-plugin:1.1:run (echodir) @ parentApp ---
[INFO] Executing tasks
[INFO] Executed tasks
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.321s
[INFO] Finished at: Thu Feb 09 17:28:01 CET 2012
[INFO] Final Memory: 2M/121M
[INFO] ------------------------------------------------------------------------

因此,正在执行的任务已执行的任务之间最终没有输出,但会考虑插件本身。知道为什么吗?

最佳答案

可能是1.1版本的maven antrun插件有bug。

以下代码片段对我有用。请注意<mkdir>./hey</mkdir ant mkdir task 的语法不正确。另外,taskdeprecated支持target .

   <plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>echodir</id>
<goals>
<goal>run</goal>
</goals>
<phase>verify</phase>
<inherited>true</inherited>
<configuration>
<target>
<echo>*************************************************** Build Dir</echo>
<mkdir dir="hey"/>
</target>
</configuration>
</execution>
</executions>
</plugin>

关于java - Maven java maven-antrun-plugin,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9214835/

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