-
-
Notifications
You must be signed in to change notification settings - Fork 181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for changelist property per branch for maven ci friendly versioning - closes #305 #314 #315
base: master
Are you sure you want to change the base?
Conversation
src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java
Outdated
Show resolved
Hide resolved
@@ -611,7 +685,7 @@ protected boolean gitCheckTagExists(final String tagName) throws MojoFailureExce | |||
* @throws MojoFailureException | |||
* @throws CommandLineException | |||
*/ | |||
protected void gitCheckout(final String branchName) | |||
private void gitCheckout(final String branchName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed visibility to make sure the wrapper checkoutAndSetConfigForBranch
is used in the future.
@@ -628,7 +702,7 @@ protected void gitCheckout(final String branchName) | |||
* @throws MojoFailureException | |||
* @throws CommandLineException | |||
*/ | |||
protected void gitCreateAndCheckout(final String newBranchName, | |||
private void gitCreateAndCheckout(final String newBranchName, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed visibility to make sure the wrapper createAndCheckoutAndSetConfigForBranch
is used in the future.
src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java
Outdated
Show resolved
Hide resolved
Could you give a hint for the code-format/formatter you are using? I tried to resemble the current style as much as possible. |
613faca
to
d04a867
Compare
The formatting looks good, great job! There is .editorconfig with some general rules.
Have you tried that? Why there is need for the property replacing in |
We need to tackle two use-case:
|
d04a867
to
b9086e6
Compare
@aleksandr-m I have created a feature/add_maven_ci_friendly_changelist_handling__via_mvn_execute-branch which uses the approach to append the args in the |
b9086e6
to
c8fa4ec
Compare
@aleksandr-m this would be the diff between those two versions (argLine-manipulation vs append mvn args) |
I tried to run first implementation and it always appended development changelist property for me. Maybe I need to configure something differently. Can you share configuration, goals needed to be run and expected results? |
Hi @aleksandr-m, thank for having a look. <configuration>
<verbose>true</verbose>
<pushRemote>true</pushRemote>
<useSnapshotInHotfix>false</useSnapshotInHotfix>
<allowSnapshots>true</allowSnapshots>
<versionProperty>revision</versionProperty>
<skipUpdateVersion>true</skipUpdateVersion>
<versionDigitToIncrement>1</versionDigitToIncrement>
<gitFlowConfig>
<productionBranch>master</productionBranch>
<developmentBranch>dev</developmentBranch>
</gitFlowConfig>
</configuration> And then on eg a hotfix-branch I run: |
@aleksandr-m excpected result would be, that dependent on which branch is currently checked out by the plugin, the |
For example if I run
|
c8fa4ec
to
abd6890
Compare
@aleksandr-m I additionally updated the |
Hi @aleksandr-m, do you already have some input to share about this PR? Or is it still not behaving properly on your side and you need more information? |
abd6890
to
12731a7
Compare
Hi @aleksandr-m, I prefer the property addition variant, so I decided to switch the content of the PR to that version. Both branches still exists in my repo for comparison and to use one or the other.
Testing and behavior in the end is the same for both. |
I would also prefer the solution using the additional properties. I did not have any time to follow up on my related issue so I'm very grateful that you started working on it. :) |
12731a7
to
eecb75e
Compare
Hi @aleksandr-m, I just wanted to let you know, that I published a fork of your repo based on 1.16.0 including the changes of this PR. I will just keep the releases streamlined with yours and only add this changes. We only use the plugin internally without advertising the existence of the fork. I hope that is fine, thank you very much! |
Are you building dependency projects separately? Why do you call |
Yes, dependency projects are build separately. We have multiple dependent modules, And I know, that for full support of Maven-CI-friendly versioning, there would still be changes needed, that no -SNAPSHOT is set into the revision field, we currently run a replacer after the gitlfow-maven-plugin, but I just see, if there is a nice way to support that as well in the plugin. |
Not sure how you can use
What do you mean? Calling
How do you end up with snapshot when you use |
Why not with a streamlined/unified version number between the modules? But I simplified that a little bit for the example. We more or less push the version number of all modules on every release, but in practice we use properties like
Because if the hotfix is merged to dev as well in if (supportBranchName == null) {
// SNIP
// if release branch exists merge hotfix changes into it
if (StringUtils.isNotBlank(releaseBranch)) {
// SNIP
} else if (!skipMergeDevBranch) {
GitFlowVersionInfo developVersionInfo = new GitFlowVersionInfo(currentVersion);
if (notSameProdDevName()) {
// git checkout develop
// SNIP
// get next snapshot version
final String nextSnapshotVersion = developVersionInfo.getSnapshotVersionString();
// SNIP
mvnSetVersions(nextSnapshotVersion);
Map<String, String> properties = new HashMap<String, String>();
properties.put("version", nextSnapshotVersion);
// git commit -a -m updating for next development version
gitCommit(commitMessages.getHotfixFinishMessage(), properties);
}
}
} |
@aleksandr-m is there any chance you will merge this soon? :) |
eecb75e
to
5476358
Compare
If I got it right, then the whole thing is needed for correct dependencies resolution during plugin run and main issue with that is the usage of Personally, I don't see much benefit in using The more I dig into this the more it seems like workaround for very specific edge use case. |
No description provided.