Skip to content

<replacementProperty> fails to work with an empty <value> tag #389

@toolforger

Description

@toolforger

Describe the bug

Tried to eliminate the -SNAPSHOT suffix from git.build.version, using an empty <value> tag.
The plugin would not apply the rule in that case (which does not make any sense).

Steps to Reproduce; Expected and Observed Behaviour

Given a tag of "10.0-SNAPSHOT", this produces git.build.version.nosnapshot=10.1 as intended:

           <plugin>
                <groupId>pl.project13.maven</groupId>
                <artifactId>git-commit-id-plugin</artifactId>
                <version>2.2.5</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>revision</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <replacementProperties>
                        <replacementProperty>
                            <property>git.build.version</property>
                            <token>(.)-SNAPSHOT$</token> <!-- workaround: detect any character -->
                            <value>$1</value> <!-- workaround: have a nonempty <value> tag -->
                            <propertyOutputSuffix>nosnapshot</propertyOutputSuffix>
                        </replacementProperty>
                    </replacementProperties>
                </configuration>
            </plugin>

If I use

                            <token>-SNAPSHOT$</token>
                            <value></value>

or

                            <token>-SNAPSHOT$</token>
                            <value/>

I get git.build.version.nosnapshot=10.1-SNAPSHOT, i.e. the replacement is not happening.

No error messages or stack traces.

Additional context

For reproducibility please provide the following:

JDK Version: 1.8.0_152
Maven Version: 3.3.9
OS Info: Arch: amd64 Family: windows Name: windows 7 Version: 6.1
Running as a Maven build inside IntelliJ 2018.2; command line is C:\Daten\software\jdk-8u152-windows-x64\bin\java.exe -Dmaven.multiModuleProjectDirectory=C:\develop\id-gui -Dmaven.home=C:\Users\tkd6u\AppData\Local\JetBrains\Toolbox\apps\IDEA-U\ch-0\182.4505.22\plugins\maven\lib\maven3 -Dclassworlds.conf=C:\Users\tkd6u\AppData\Local\JetBrains\Toolbox\apps\IDEA-U\ch-0\182.4505.22\plugins\maven\lib\maven3\bin\m2.conf -javaagent:C:\Users\tkd6u\AppData\Local\JetBrains\Toolbox\apps\IDEA-U\ch-0\182.4505.22\lib\idea_rt.jar=64767:C:\Users\tkd6u\AppData\Local\JetBrains\Toolbox\apps\IDEA-U\ch-0\182.4505.22\bin -Dfile.encoding=UTF-8 -classpath C:\Users\tkd6u\AppData\Local\JetBrains\Toolbox\apps\IDEA-U\ch-0\182.4505.22\plugins\maven\lib\maven3\boot\plexus-classworlds-2.5.2.jar org.codehaus.classworlds.Launcher -Didea.version=2018.2.4 --errors --update-snapshots compile

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions