自动执行自定义Maven插件
问题描述:
我已经实现了Maven 2插件。自动执行自定义Maven插件
我有definiton我的魔:
/**
* Goal which combines files.
*
* @goal combine
* @phase compile
*/
public class CombineMojo extends AbstractMojo {
我一定要添加这个到我的项目(使用插件)POM:
<?xml version="1.0" encoding="UTF-8"?>
<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>base-project</groupId>
<artifactId>base-project</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>combine-maven-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<configuration>
<input>src/input.html</input>
<output>html/output.html</output>
</configuration>
<executions>
<execution>
<id>combine-maven-plugin</id>
<goals>
<goal>combine</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
不过我应该怎么做自动执行它,而不是在pom.xml中定义。我尝试加入
@execute ...
进入我的Mojo定义,但它没有工作。顺便说一句,我应该定义一个ID,它需要什么?
你能展示你的测试项目的完整pom文件吗?此外,插件不能自动执行,必须绑定到生命周期阶段。 – khmarbaise
@khmarbaise我改进了我的问题。 – kamaci
在执行测试项目期间是否收到任何错误/消息? – khmarbaise