原文:http://snv.iteye.com/blog/1990900
需求:
需要在maven执行的时候打印一些调试信息。
实现方式:
方案1:基于maven-echo-plugin使用方式如下:
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugin</groupId>
- <artifactId>echo-plugin</artifactId>
- <configuration>
- <info>BUILT %s %s CONFIGURATION</info>
- <elements>
- <param>with</param>
- <param>ALPHA</param>
- </elements>
- </configuration>
- </plugin>
- </plugins>
方案2:基于maven-antrun-plugin实现如下:
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <version>1.1</version>
- <executions>
- <execution>
- <phase>validate</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <tasks>
- <echo>Displaying value of pom.xml element</echo>
- <echo>[project.artifactId] ${project.artifactId}</echo>
- </tasks>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>