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 goal that works with Maven CI Friendly Versions and set property (revision) based on git tag #1071
Comments
Would you approve a PR with this functionality? |
maybe you should use an extension for this rather than a plugin. https://maven.apache.org/examples/maven-3-lifecycle-extensions.html |
Ended up creating our own plugin. Could use Maven SCM API and it did feel right to add the JGit dependency. We haven't published it yet, so we could potentially provide it as an extension but probably need some guidance then. Also, we are in need of this now really and I'm not sure how long it would take for a PR and a release to happen. |
Your code with JGit looks simple, Maven SCM Api add support for others tools - I will try with it.
As next goal will be easier than extension.
Release can happen in a few days after merge. I watch a repository and when we have new feature or bug fix I will simply release. |
@slawekjaranowski I tried with Maven SCM API, but it seemed like it was to simple for this use-case. Could be that I missed out on something. I reckon it might will be configurable later on how the git repo should be traversed from the starting commit (branch only etc), so for flexibility I'd prefer JGit. You wrote "I will try with it". Was that as in you or a suggestion for me?
Not following here either. We would rather see this feature incorporated in the Versions Maven plugin as it involves versioning of POMs but with another angle, i.e. instead of changing the actual POM.xml once uses CI/CD and tags. I'm a bit stressed for time now (3 weeks since I wrote here) and we need this feature asap. As for our code we will donate it without any copyright claims or what not. However, the plugin contains a modified (VersionInformation) of code that is copyrighted by Karl Heinz Marbaise under MIT License for mojohaus. Is there a solution to this (licenses are MIT for build-helper and Apache 2.0 for Versions)? |
Suggestion for you 😄
I think about new goal.
It is open source project maintained by volunteers in their free time, so I can not give you any promise about timelines.
We use maven-invoker-plugin for IT test, there are possibility to use pre - setup and post - verify script
We can copy as is with preserving license header .... or change @khmarbaise what do you think |
|
@slawekjaranowski Would it be possible to elaborate a little moe on how to use the maven invoker plugin for testing with git repos? I'm looking at e.g. it-823-ranges-update-report-001 and it-set-scm-tag-004 but it's not clear to me how I use maven invoker plugin to either use a pre-set git repository or to create on of the fly. This in order to have test data. I'm thinking that I need to use JGit to setup and then regular JUnit. I honestly think that testing Maven plugin is a mess. Shall I use the |
With invoker, create a file:
if git will not available on system test will be skipped next you create:
and finally create a you can execute only one test by:
|
Maven supports Maven CI Friendly Versions since version 3.5.
It allows the user to set a placeholder
<version>${revision}</version>
that can be replaced from command line using:
e.g.
mvn -Drevision=1.0.0-SNAPSHOT clean package
Our use-case is that you want this revision property (can be configurable) to be set by a Maven plugin using tag information from the scm (typically, git).
The revision property should be set as follows:
note: will be set to variants of nr of commits
That is the basics. I was contemplating writing a plugin for it, but we'll rather so it incorporated in into this plugin.
Build number will be handled correctly by Maven as can be seen here:
The text was updated successfully, but these errors were encountered: