gitmavendeploymentmaven-release-pluginmaven-scm

How to commit replaced properties by maven with release plugin


We having a problem trying to commit changes, which happens with maven. Because they are in target folder how could we do it?

Replacing via resources filtering. In properties we've got

<BUILD_VERSION>version-1.0.0</BUILD_VERSION>

that's our property and also such marker occurs in some files - after changing them we should commit it to git

<resource>
    <directory>.</directory>
    <filtering>true</filtering>
</resource> 

Also we doing whole release via maven release plugin, so the final command looks like

mvn clean release:prepare release:perform 

This release plugin is using scm:

<plugin>
    <artifactId>maven-scm-plugin</artifactId>
        <version>${maven-scm-plugin.version}</version>
        <configuration>
            <message>SCM commit</message>
        </configuration>
        <executions>
            <execution>
            <phase>deploy</phase>
            <goals>
                <goal>checkin</goal>
            </goals>
        </execution>
    </executions>
</plugin>

Adding includes and excludes properties to scm plugin didn't help us.

How to do back-commit after those changes? Or how can we change our files and then commit those changes, will maven replacer plugin help?


Solution

  • I don't think you can get them committed to git by the maven-release-plugin, it has no hook for this purpose.

    You put all those properties into jar files which get released as part of the release. So the released versions of the jar file(s) contain the property files with the substituted values, and at runtime you get them from the classpath.