简体   繁体   中英

How to rename buildNumber property name in buildnumber-maven-plugin

How to rename buildNumber property name in buildnumber-maven-plugin

as mentioned in: http://mojo.codehaus.org/buildnumber-maven-plugin/create-mojo.html#buildNumberPropertyName

buildNumberPropertyName:

You can rename the buildNumber property name to another property name if desired. Type: java.lang.String Since: 1.0-beta-1 Required: No User Property: maven.buildNumber.buildNumberPropertyName Default: buildNumber

Just as you quote. You have to use property buildNumberPropertyName . For ex:

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.3</version>
<inherited>true</inherited>
<executions>
    <execution>
        <id>generate-timestamp</id>
        <phase>validate</phase>
        <goals>
            <goal>create</goal>
        </goals>
        <configuration>
            <format>{0,date,yyyy-MM-dd HH:mm:ss Z}</format>
            <items>
                <item>timestamp</item>
            </items>
            <buildNumberPropertyName>buildDateTime</buildNumberPropertyName>
        </configuration>
    </execution>
</executions>

Using above configuration, build time will be visible as ${buildDateTime} maven property. Don't worry if your IDE will complaining about that it doesn't see creation of this property.

You can use default name as well: ${buildNumber}

在Maven内部版本号插件的配置中,使用自定义名称指定可选属性:“ buildNumberPropertyName”。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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