英文:
Will maven re-read a pom file for different lifecycle phases?
问题
我正在开发一个Maven插件,该插件将修改当前pom.xml文件中依赖项的版本号。
我似乎找不到任何关于Maven是否会在生命周期阶段之间重新读取pom.xml文件的参考资料,或者我是否可以强制它重新读取?
另一种方法是调用插件,然后在此之后调用构建步骤 - 但如果可能的话,我想在一步中完成。
谢谢。
英文:
I'm working on creating a maven plugin that will modify version numbers of dependencies in the current pom.xml file.
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?
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.
答案1
得分: 1
这是不可能的。
Maven 在调用插件之前会先读取依赖关系,因此您需要在单独的 Maven 运行中更改版本号,例如:
mvn versions:use-releases
mvn clean install
像这样运行一个命令:
mvn versions:use-releases clean install
是不会起作用的。
英文:
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
mvn versions:use-releases
mvn clean install
Running one command like
mvn versions:use-releases clean install
will not work.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论