我有一个问题:
我已经为验证阶段在我的pom.xml文件中配置了一个ant插件。任务就是简单地回显一些字符串到控制台。问题是,我看到我的执行被带到了accoutn,但是没有任务被执行。有人遇到过类似的问题吗?下面是我的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验证时获得的输出如下:
[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] ------------------------------------------------------------------------因此,执行任务和执行任务之间最终没有输出,但是插件本身被考虑在内。知道为什么吗?
发布于 2012-02-09 16:54:17
在验证过程中尝试执行其他任务,例如:“将某个文件复制到某个目录”。
<copy file="${project.build.directory}/somefile" todir="some dir"
overwrite="true" />发布于 2012-02-09 21:25:47
正如在一些注释中提到的,使用插件的最新版本(1.7)。另外,将<task>标记替换为<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>
</target>
</configuration>
</execution>
</executions>
</plugin>https://stackoverflow.com/questions/9214835
复制相似问题