The Git-Flow Maven Plugin supports various Git workflows, including GitFlow and GitHub Flow. This plugin runs Git and Maven commands from the command line.
Great Plugin - I like the possibility to add custom maven goals.
Unfortunately the current possibilities do not exactly match my needs.
The background:
We build Angular Frontends and Node.js Libraries with com.github.eirslett.frontend-maven-plugin, which executes npm commands during a Maven build. For Release builds they need the correct version to be set in the package.json file, and a npm publish can be done. During the process-resources phase the version ist set to the package.json file with the npm version command.
The problem:
The gitflow plugin is updating the version in the pom.xml files of the release branch at the beginning of release-start, prior to the build itself. The maven build (mvn packge) then adopts the version in the package.json file. The gitflow:relese-finish then throws an error:
[ERROR] Failed to execute goal com.amashchenko.maven.plugin:gitflow-maven-plugin:1.14.0:release-finish (default-cli) on project jee-starter: release-finish: You have some uncommitted files. Commit or discard local changes in order to proceed.
Possible soulutions:
Your plugin does change the version in package.json and package-lock.json at the same time its changing the version in the pom.xml files
Your plugin provides an option to commit file which are changed during the release build.
I use the custom maven goal option preReleaseGoals where i can ad add the mvn scm:checkin goal to make a git commit. The problem here is that depending on the other options like "installProject" the "uncommitted files" error occurs at different moments. The preReleaseGoals only work for me if i turn off the installProject option.
This is my plugin configuration in parent pom.xml:
<plugin>
<groupId>com.amashchenko.maven.plugin</groupId>
<artifactId>gitflow-maven-plugin</artifactId>
<version>${gitflow-maven-plugin.version}</version>
<configuration>
<verbose>true</verbose>
<!-- Whether to call Maven install goal during the mojo execution.
Avoid this, otherwise the following error occurs: You have some uncommitted files. -->
<installProject>false</installProject>
<!-- Maven goals to execute in the release branch before merging into the production branch.
Do a git commit for the during release-finish changed version in package.json.
Otherwise the following error occurs: You have some uncommitted files. -->
<preReleaseGoals>-Dmessage="Set release version to package.json" scm:checkin</preReleaseGoals>
<!-- Maven goals to execute in the production branch after the release.
Do a maven deploy for deploying the artifacts to nexus. -->
<postReleaseGoals>deploy</postReleaseGoals>
<commitMessages>
<releaseStartMessage>Update versions for release @{version}</releaseStartMessage>
<releaseVersionUpdateMessage>Update for next development version @{version}</releaseVersionUpdateMessage>
<releaseFinishMessage>Update for next development version @{version}</releaseFinishMessage>
<tagReleaseMessage>Tag release ${project.version}</tagReleaseMessage>
</commitMessages>
</configuration>
</plugin>
Great Plugin - I like the possibility to add custom maven goals. Unfortunately the current possibilities do not exactly match my needs.
The background: We build Angular Frontends and Node.js Libraries with com.github.eirslett.frontend-maven-plugin, which executes npm commands during a Maven build. For Release builds they need the correct version to be set in the package.json file, and a npm publish can be done. During the process-resources phase the version ist set to the package.json file with the npm version command.
The problem: The gitflow plugin is updating the version in the pom.xml files of the release branch at the beginning of release-start, prior to the build itself. The maven build (mvn packge) then adopts the version in the package.json file. The gitflow:relese-finish then throws an error: [ERROR] Failed to execute goal com.amashchenko.maven.plugin:gitflow-maven-plugin:1.14.0:release-finish (default-cli) on project jee-starter: release-finish: You have some uncommitted files. Commit or discard local changes in order to proceed.
Possible soulutions:
This is my plugin configuration in parent pom.xml: