
在网上看 maven 教程时,学习了构建生命周期,然后按教程给 clean 生命周期的 pre-clean、clean、post-clean 三个阶段绑定了 maven-antrun-plugin 插件来输出信息,然而执行 mvn post-clean 只有 clean 阶段才有输出,不明白是哪里出了问题。
附配置文件
<project xmlns="http://maven.apache.org/PM/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.companyname.projectgroup</groupId> <artifactId>project</artifactId> <version>1.0</version> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-antrun-plugin</artifactId> <version>1.1</version> <executions> <execution> <id>pre-clean-echo</id> <phase>pre-clean</phase> <goals> <goal>run</goal> </goals> <configuration> <tasks> <echo>pre-clean phase</echo> </tasks> </configuration> </execution> <execution> <id>clean-echo</id> <phase>clean</phase> <goals> <goal>run</goal> </goals> <configuration> <tasks> <echo>clean phase</echo> </tasks> </configuration> </execution> <execution> <id>post-clean-echo</id> <phase>post-clean</phase> <goals> <goal>run</goal> </goals> <configuration> <tasks> <echo>post-clean phase</echo> </tasks> </configuration> </execution> </executions> </plugin> </plugins> </build> </project> mvn post-clean 输出如下
D:\other>mvn post-clean [INFO] Scanning for projects... [INFO] [INFO] ----------------< com.companyname.projectgroup:project >---------------- [INFO] Building project 1.0 [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ project --- [INFO] [INFO] --- maven-antrun-plugin:1.1:run (id.clean) @ project --- [INFO] Executing tasks [echo] clean phase [INFO] Executed tasks [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.652 s [INFO] Finished at: 2018-05-09T15:39:00+08:00 [INFO] ------------------------------------------------------------------------ 1 kassadin 2018-05-09 16:00:00 +08:00 配置没问题,找找环境上的问题吧。 |