本文介绍了为子模块关闭buildnumber-maven-plugin的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

父母:

    <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>

在'mvn buildnumber:create'期间,每个模块都会生成buildnumber.是否可以为子模块将其关闭?换句话说,在'mvn buildnumber:create'期间,内部版本号只能在父模块中生成一次.

During 'mvn buildnumber:create' each module generate 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.

我尝试在子模块中设置<phase>none</phase><skip>true</skip>,但没有任何更改.

I tryed set <phase>none</phase> and <skip>true</skip> in submodules but without any changes.

建议?

推荐答案

此:

您可以将<inherited>false</inherited>添加到插件配置中,以避免在子POM中继承:

You can add <inherited>false</inherited> to the plugin configuration to avoid inheritance in children POMs:

  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>buildnumber-maven-plugin</artifactId>
    <version>1.0</version>
    <inherited>false</inherited>
    ...
  </plugin>

这篇关于为子模块关闭buildnumber-maven-plugin的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 05:09