我编写了一个maven插件,用于分析某些文件并在该文件中找到某些预定义模式时抛出错误。
现在问题是我想用maven发布插件连接这个maven插件,这样如果用户通过发出命令mvn release来释放项目:prepare,那么只有我的插件才会出现。
但是我无法使用mvn release插件连接我的插件。
我试过:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5</version>
<configuration>
<preparationGoals>check-pattern</preparationGoals>
</configuration>
</plugin>
但它抱怨如下:
Unknown lifecycle phase "check-pattern".
You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>.
Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy.
如果我这样说:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5</version>
<configuration>
<plugin-group-id>com.plugin.snapshot</plugin-group-id>
<plugin-artifact-id>snapshot-maven-plugin</plugin-artifact-id>
<plugin-version>0.0.1</plugin-version>
<goal> check-pattern </goal>
<preparationGoals>check-pattern</preparationGoals>
</configuration>
</plugin>
然后它并没有抱怨,但aldo并没有运行我的maven插件。
有没有办法让我可以用maven发布插件连接我的插件?
答案 0 :(得分:1)
使用以下配置:
<configuration>
<preparationGoals>com.plugin.snapshot:snapshot-maven-plugin:check-snapshot</preparationGoals>
</configuration>
现在当我发布我的项目时,maven release prepare插件正在调用我的插件目标。