qoomon / maven-git-versioning-extension

This extension will set project version, based on current Git branch or tag.
GNU General Public License v3.0
305 stars 87 forks source link

Allow combined overwrite and default value for properties #232

Closed theit closed 11 months ago

theit commented 1 year ago

Hi,

actually there are options for either overwriting a property if a value exists or specify a default value if a property does not exist. What about combining this?

I.e. something such as ${name:+foo:-bar} to answer foo if ${name} exists and bar if ${name} is undefined?

This way you could use the following configuration:

<configuration
        xmlns="https://github.com/qoomon/maven-git-versioning-extension"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="https://github.com/qoomon/maven-git-versioning-extension https://qoomon.github.io/maven-git-versioning-extension/configuration-9.4.0.xsd">
        <rev>
                <version>${describe.tag}${describe.distance:+-:-}${describe.distance:-}${dirty:+-dirty}</version>
        </rev>
</configuration>

to let the plugin calculate a version number similar to what git describe --tags --always --dirty returns?

qoomon commented 1 year ago

Sounds interesting however I don't get your use case.