简体   繁体   English

maven 会为不同的生命周期阶段重新读取 pom 文件吗?

[英]Will maven re-read a pom file for different lifecycle phases?

I'm working on creating a maven plugin that will modify version numbers of dependencies in the current pom.xml file.我正在创建一个 maven 插件,它将修改当前 pom.xml 文件中依赖项的版本号。

I can't seem to find any reference about whether maven will re-read the pom.xml file in between lifecycle phases, or whether I can force it to?我似乎找不到任何关于 maven 是否会在生命周期阶段之间重新读取 pom.xml 文件的参考,或者我是否可以强制它?

The alternative would be to invoke the plugin, and then call the build step after that - but I'd like to do it in one step if it's possible.另一种方法是调用插件,然后在此之后调用构建步骤 - 但如果可能的话,我想在一个步骤中完成。

Thanks.谢谢。

This is not possible.这不可能。

Maven reads the dependencies before invoking plugins, so you need to change the version numbers in a separate Maven run, like Maven 在调用插件之前读取依赖项,因此您需要在单独的 Maven 运行中更改版本号,例如

mvn versions:use-releases
mvn clean install

Running one command like运行一个命令,如

mvn versions:use-releases clean install

will not work.不会工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM