Closed simontunnat closed 3 years ago
You can pass additional arguments to mvn goals using argLine
parameter, e.g. -DargLine="-Dchangelist="
.
Thank you, but that does not solve my problem.
If the value of revision
is 1.0
before the release, it will become 1.1-SNAPSHOT
after the release. I need an option to force the Gitflow plugin to NOT add the -SNAPSHOT
suffix.
Yes, -DargLine="-Dchangelist="
will set changelist
property to empty string in underlying maven commands. Try it out.
Should be supported. Feel free to reopen if something is missing.
Maybe I was not clear enough before: I use the automatic version numbering of the gitflow plugin. Tgat featire always adds the "-SNAPSHOT" suffix to the new development version. I nedd a way to disable this behaviour.
@simontunnat Which command you are running?
Example:
$ mvn gitflow:release-start -B
[INFO] Scanning for projects...
[INFO]
[INFO] -------< org.tunnat.maven:gitflow-ci-friendly-versions-example >--------
[INFO] Building org.tunnat.maven:gitflow-ci-friendly-versions-example 1.4-SNAPSHOT
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- gitflow-maven-plugin:1.16.0:release-start (default-cli) @ gitflow-ci-friendly-versions-example ---
[INFO] Checking for uncommitted changes.
[INFO] Fetching remote branch 'origin develop'.
[INFO] Comparing local branch 'develop' with remote 'origin/develop'.
[INFO] Checking out 'develop' branch.
[INFO] Checking for SNAPSHOT versions in dependencies.
[INFO] Version is blank. Using default version.
[INFO] Creating a new branch 'release/1.4' from 'develop'.
[INFO] Updating version(s) to '1.5-SNAPSHOT'.
[INFO] Updating property 'revision' to '1.5-SNAPSHOT'.
[INFO] Committing changes.
[INFO] Checking out 'release/1.4' branch.
[INFO] Pushing 'develop' branch to 'origin'.
[INFO] Pushing 'release/1.4' branch to 'origin'.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.845 s
[INFO] Finished at: 2021-08-04T11:06:55+02:00
[INFO] ------------------------------------------------------------------------
POM before command execution:
<properties>
<revision>1.4</revision>
<changelist>-SNAPSHOT</changelist>
</properties>
POM after command execution:
<properties>
<revision>1.5-SNAPSHOT</revision>
<changelist>-SNAPSHOT</changelist>
</properties>
The plugin is configured like this:
<build>
<plugins>
<plugin>
<groupId>com.amashchenko.maven.plugin</groupId>
<artifactId>gitflow-maven-plugin</artifactId>
<version>1.16.0</version>
<configuration>
<pushRemote>true</pushRemote>
<versionProperty>revision</versionProperty>
<skipUpdateVersion>true</skipUpdateVersion>
<commitDevelopmentVersionAtStart>true</commitDevelopmentVersionAtStart>
<digitsOnlyDevVersion>true</digitsOnlyDevVersion>
<useSnapshotInRelease>true</useSnapshotInRelease>
<preReleaseGoals>verify</preReleaseGoals>
<postReleaseGoals>verify</postReleaseGoals>
<gitFlowConfig>
<productionBranch>main</productionBranch>
<versionTagPrefix>v</versionTagPrefix>
</gitFlowConfig>
</configuration>
</plugin>
</plugins>
</build>
The same thing happens when I execute the command with the argLine parameter:
$ mvn gitflow:release-start -B -DargLine="-Dchangelist="
[INFO] Scanning for projects...
[INFO]
[INFO] -------< org.tunnat.maven:gitflow-ci-friendly-versions-example >--------
[INFO] Building org.tunnat.maven:gitflow-ci-friendly-versions-example 1.4-SNAPSHOT
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- gitflow-maven-plugin:1.16.0:release-start (default-cli) @ gitflow-ci-friendly-versions-example ---
[INFO] Checking for uncommitted changes.
[INFO] Fetching remote branch 'origin develop'.
[INFO] Comparing local branch 'develop' with remote 'origin/develop'.
[INFO] Checking out 'develop' branch.
[INFO] Checking for SNAPSHOT versions in dependencies.
[INFO] Version is blank. Using default version.
[INFO] Creating a new branch 'release/1.4' from 'develop'.
[INFO] Updating version(s) to '1.5-SNAPSHOT'.
[INFO] Updating property 'revision' to '1.5-SNAPSHOT'.
[INFO] Committing changes.
[INFO] Checking out 'release/1.4' branch.
[INFO] Pushing 'develop' branch to 'origin'.
[INFO] Pushing 'release/1.4' branch to 'origin'.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.878 s
[INFO] Finished at: 2021-08-04T11:11:49+02:00
[INFO] ------------------------------------------------------------------------
Setting the changelist parameter directly does not work as well:
$ mvn gitflow:release-start -B -DargLine="-Dchangelist=" -Dchangelist=
[INFO] Scanning for projects...
[INFO]
[INFO] -------< org.tunnat.maven:gitflow-ci-friendly-versions-example >--------
[INFO] Building org.tunnat.maven:gitflow-ci-friendly-versions-example 1.4
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- gitflow-maven-plugin:1.16.0:release-start (default-cli) @ gitflow-ci-friendly-versions-example ---
[INFO] Checking for uncommitted changes.
[INFO] Fetching remote branch 'origin develop'.
[INFO] Comparing local branch 'develop' with remote 'origin/develop'.
[INFO] Checking out 'develop' branch.
[INFO] Checking for SNAPSHOT versions in dependencies.
[INFO] Version is blank. Using default version.
[INFO] Updating version(s) to '1.4-SNAPSHOT'.
[INFO] Updating property 'revision' to '1.4-SNAPSHOT'.
[INFO] Committing changes.
[INFO] Creating a new branch 'release/1.4' from 'develop'.
[INFO] Updating version(s) to '1.5-SNAPSHOT'.
[INFO] Updating property 'revision' to '1.5-SNAPSHOT'.
[INFO] Committing changes.
[INFO] Checking out 'release/1.4' branch.
[INFO] Pushing 'develop' branch to 'origin'.
[INFO] Pushing 'release/1.4' branch to 'origin'.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.106 s
[INFO] Finished at: 2021-08-04T11:15:19+02:00
[INFO] ------------------------------------------------------------------------
I hope this finally make my issue clear. :)
@simontunnat Set useSnapshotInRelease
to false
or don't use it at all - the default is false
.
The plugin always behaves the same way: Even with useSnapshotInRelease
set to false
the next development version will be suffixed with -SNAPSHOT.
I'm bot sure what else I can do to make my issue clear. :(
Where did you set it? You need to set in the pom, since you have useSnapshotInRelease
there.
When you say "next development version", what do you mean by that? Version in the revision
property? After the release start or finish?
I mean the next version in the develop branch after the release finish or directly after the release start if I use the commitDevelopmentVersionAtStart
feature.
Well, you can try to use digitsOnlyDevVersion
which will strip any qualifiers from the version.
I'm already using that property, but it did not change the behaviour regarding the next development version.
A quick look into the code made it clear to me that changes would have to be made.
Would you be willing to accept an PR regarding this issue? I'm thinking of an additional property useSnapshotInDevVersion
. This property would be set to true
by default and the plugin would then behave in the same way it does now. But if the property is set to false
the plugin would remove the -SNAPSHOT suffix.
I have the following feature request:
I'm using the Maven CI-friendly versions (https://maven.apache.org/maven-ci-friendly.html) that where implemented in the Gitflow Maven plugin as part of the ticket https://github.com/aleksandr-m/gitflow-maven-plugin/issues/151.
My POM looks like this:
What I would like the plugin to do:
If I want to build a SNAPSHOT or RELEASE version would then be completely left to me, by doing something like this:
mvn -Dchangelist= clean verify
I could also use my CI system to do something like this:
mvn -Dchangelist="-20210718.191300" clean verify
A similar approach worked very well for me in the past and I would like to use it with the Gitflow Maven plugin.
If a PR for this might have some chances to be accepted, I could try to implement it myself (did not have look at the code base jet).