feat: Add Dynamic Versioning SCM plugin#1082
feat: Add Dynamic Versioning SCM plugin#1082slawekjaranowski merged 13 commits intomojohaus:masterfrom
Conversation
d2fad86 to
bb1bbea
Compare
|
@slawekjaranowski I suddenly keep getting: Not sure how this build is setup but tried rebuilding all the modules from root with a simple |
|
Fully implemented and it pass with:
Will squash commits later and change to ready. @slawekjaranowski How does it look? |
382164d to
90ac453
Compare
be1810a to
149dcad
Compare
| * Maven plugin that uses SCM/VCS to enable dynamic versioning based on your | ||
| * version control system. | ||
| * | ||
| * @author Jimisola Laursen | ||
| * @since 2.17.0 | ||
| */ | ||
| @Mojo(name = "set-version-from-scm-tag", defaultPhase = LifecyclePhase.INITIALIZE) |
There was a problem hiding this comment.
This goal only discover version based on SCM and set project property with it ...
Most of goals of this plugin manipulate project pom to update it according to goal.
We need to think about name
There was a problem hiding this comment.
Ok. I'm all ears about the name of the goal as long as the functionality is there. What are your thoughts about the name?
There was a problem hiding this comment.
Brainstorming here, but the key elements to get in the goal are at least:
- updates project.version in-memory (dynamic)
- sets version based on tag in scm
Is there another word that set that would indicate that the pom.xml itself is left untouched?
The best I can come up with now are:
- use-dynamic-version-from-scm: execution will use but not set version
- impersonate-dynamic-version-from-scm: sadly, inversionate is not a word ;)
There was a problem hiding this comment.
use-dynamic-version-from-scm look ok for me 😄
There was a problem hiding this comment.
Ok. Let's go with use-dynamic-version-from-scm then.
|
@slawekjaranowski Would it be possible for us to get this moving so that it can be merged to main before the next release? |
|
please:
|
a450087 to
72cc356
Compare
Not sure that I'm following. After rebase, I ran
Should be done now. |
Pleas look at https://github.com/mojohaus/versions/actions/runs/9527983742/job/26266186230 Please also rebuild whole project |
61bf8ee to
db8fd01
Compare
Fixed. |
|
On CI we don't have a git configuration for user from build log: So pease set git user in verify scripts ... without |
|
I can't get it to work with neither environment variables in invoker.properties or git config commands in setup script (you wrote verify, but you meant setup right?). I could have understood if the environment variables were set in a different shell (scope) and not available later on but even when I set git config locally and see that they're set it's not picked up by git . If is set it globally then it works. Any ideas? [...]
exec('git config init.defaultBranch "main"')
exec('git config user.email "user@example.com"')
exec('git config user.name "User Example"')
exec('git config --list --local')
exec('git init')
exec('git add test.txt')
exec('git commit -m initial-commit')
[...]As you can see below default branch, email and name are shown using |
|
Running relevant git commands in setup.py as follows works:
but it's really annoying having to submit it for each command. Please advise if that is a workaround we can use. |
|
@lfvjimisola - ups ... my fault environment set in invoker.properties are available during test plugin execution |
I wrote above you reply that it does not work for me in setup.groovy with It works if:
|
|
I just realized when I saw your commits that I might have executed git config prior to git init 🙄 |
slawekjaranowski
left a comment
There was a problem hiding this comment.
We should add goal to list at page: https://www.mojohaus.org/versions/versions-maven-plugin/index.html
We can also add en example page with examples - what version will be set according to git repo content.
74909ce to
8fb2a24
Compare
|
ok, looks good enough open questions:
|
5eee8dc to
49ef3f7
Compare
9fa2645 to
3dc48bf
Compare
FYI, there is a discrepancy between the goals listed in https://www.mojohaus.org/versions/versions-maven-plugin/#goals-overview and https://www.mojohaus.org/versions/versions-maven-plugin/plugin-info.html Is there a reason why Single Source of Truth (SSOT) and only the auto-generated list is used? |
You right you can think about to drop manual docs at all in order to use generated one. |
|
Thank you @slawekjaranowski |
|
@lfvjimisola thanks also for contributing - I will release next version in a few days |
Adds dynamic versioning based on SCM tag (git supported for now). This plugin goal differs from other Versions Maven Plugin goals since it does not change the pom.xml but simply updates project.version in-memory during execution.
Closes: #1071