[英]Maven plugin execution at begining of dependency chain
I have three maven projects: A -> B -> C. To better explain situation I show pseudo pom.xml's: 我有三个Maven项目:A-> B->C。为了更好地说明情况,我显示了伪pom.xml:
A pom.xml 一个pom.xml
<groupId>X</groupId>
<artifactId>A</artifactId>
<version>1</version>
B pom.xml B pom.xml
<groupId>X</groupId>
<artifactId>B</artifactId>
<version>1.5</version>
<dependency>
<groupId>X</groupId>
<artifactId>A</artifactId>
<version>1</version>
</dependency>
C pom.xml C pom.xml
<groupId>X</groupId>
<artifactId>C</artifactId>
<version>2.5</version>
<dependency>
<groupId>X</groupId>
<artifactId>B</artifactId>
<version>1.5</version>
</dependency>
I would like to execute maven plugin just in A project and then automatic in other ( B and C) like a chain, when I execute in B then also just in C would be automatic too. 我想只在A项目中执行maven插件,然后在其他(如链)中自动执行(在B和C中),当我在B中执行时,在C中也将自动执行。 The problem is that in A project there is no information about B (I think).
问题是在A项目中没有关于B的信息(我认为)。 Changing pom's structure is extremity.
改变pom的结构就是四肢。
Do you have some idea how do it? 你知道怎么做吗? I will be grateful for any hint.
我将不胜感激。
maven's plugin's execution is tied to particular phase of maven's build lifecycle, for example surefire plugin by default ties to test
phase Maven插件的执行与Maven构建生命周期的特定阶段相关,例如,默认情况下,surefire插件与
test
阶段相关联
now consider you have a plugin that you want to execute in all project as a chain, you would have to create a separate build profile and tie your plugins execution after validate phase 现在考虑您有一个要在所有项目中作为一个链执行的插件,您将必须创建一个单独的构建配置文件,并在验证阶段之后将插件的执行与工作挂钩
and invoke mvn validate
so it life cycle will go to just one phase (ie validate) and it will invoke your plugin like a chain 并调用
mvn validate
这样它的生命周期将进入一个阶段(即validate),并且它将像链一样调用您的插件
One way you can approach this is (if you haven't tried it yet) is: Keep a root pom.xml with the following: ... ... 解决此问题的一种方法是(如果尚未尝试过):使用以下内容保留root pom.xml:... ...
<packaging>pom</packaging>
<modules>
<module>A</module>
<module>B</module>
<module>C</module>
</modules>
....
...
This will "act" like a chain. 这将像链条一样“起作用”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.