[英]turn off buildnumber-maven-plugin for submodules
Parent: 上级:
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
**<inherited>false</inherited>**
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
<configuration>
<format>${project.version}-b{0,number}</format>
<items>
<item>buildNumber0</item>
</items>
<doCheck>false</doCheck>
<doUpdate>false</doUpdate>
</configuration>
</plugin>
</plugins>
<modules>
<module>module1</module>
<module>module2</module>
</modules>
During 'mvn buildnumber:create' each module generate buildnumber. 在'mvn buildnumber:create'期间,每个模块都会生成buildnumber。 Is it possible to turn it off for submodules?
是否可以为子模块将其关闭? In other word, during 'mvn buildnumber:create' build number should be generated only once in parent module.
换句话说,在“ mvn buildnumber:create”期间,内部代号仅应生成一次。
I tryed set <phase>none</phase>
and <skip>true</skip>
in submodules but without any changes. 我尝试在子模块中设置
<phase>none</phase>
和<skip>true</skip>
,但没有任何更改。
Suggestions? 有什么建议吗?
This: Execute Maven plugin goal on parent module, but not on children 这: 在父模块而不是子模块上执行Maven插件目标
You can add <inherited>false</inherited>
to the plugin configuration to avoid inheritance in children POMs: 您可以将
<inherited>false</inherited>
到插件配置中,以避免在子POM中继承:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.0</version>
<inherited>false</inherited>
...
</plugin>
I would take a look into the: 我来看看:
<pluginManagement>...</pluginManagement>
element: http://maven.apache.org/pom.html#Plugin_Management 元素: http : //maven.apache.org/pom.html#Plugin_Management
I've had success defining my plugins in my master/parent/root pom file through the plugin-management section, and then simply enabling their behaviour in my child pom files by simply specifying the group/artifact combination. 我已经成功通过插件管理部分在主/父/根pom文件中定义了我的插件,然后只需指定组/工件组合就可以在子pom文件中启用其行为。
In your case, I'd try the following... 就您而言,我将尝试以下方法...
In your root pom.xml (notice the <pluginManagement> element): 在您的根pom.xml中(注意<pluginManagement>元素):
...
<build>
...
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
<configuration>
<format>${project.version}-b{0,number}</format>
<items>
<item>buildNumber0</item>
</items>
<doCheck>false</doCheck>
<doUpdate>false</doUpdate>
</configuration>
</plugin>
</plugins>
</pluginManagement>
...
</build>
...
And then simply enable the behaviour in your module1 (or module2) pom.xml by (NO <pluginManagement> element): 然后只需通过(NO <pluginManagement>元素)在module1(或module2)pom.xml中启用该行为:
<build>
...
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<plugin>
<plugins>
...
</build>
...
This was all from memory, give it a shot and if it doesn't work, let me know. 这些全都来自记忆,试一试,如果它不起作用,请告诉我。
更新您的pom以使用插件的1.3版,然后在每个子模块中使用true配置插件
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.