Skip to content
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

Jgitver configuration is not considered when building #154

Open
igroeg opened this issue May 17, 2021 · 6 comments
Open

Jgitver configuration is not considered when building #154

igroeg opened this issue May 17, 2021 · 6 comments
Labels

Comments

@igroeg
Copy link

igroeg commented May 17, 2021

I'm using maven 3.6.3 with java 8 and started to use jgitver. The plugin seems to work fine, but doesn't ignore nonQualifierBranches. I tried to edit the configuration inside jgitver.config.xml but it really doesn't matter what I'm configuring, it's not considered at all. The configuration is as follow

<configuration xmlns="http://jgitver.github.io/maven/configuration/1.0.0"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:schemaLocation="http://jgitver.github.io/maven/configuration/1.0.0 https://jgitver.github.io/maven/configuration/jgitver-configuration-v1_0_0.xsd ">
    <useDirty>false</useDirty>
    <nonQualifierBranches>master</nonQualifierBranches>
</configuration>
@McFoggy
Copy link
Contributor

McFoggy commented May 18, 2021

Can you provide a reproducer ?

@igroeg
Copy link
Author

igroeg commented May 18, 2021

Sure, just created https://github.com/igroeg/testing-jgitver/tree/master/test-123 this repo, my maven is
image
and the result from mvn validate is
image

@McFoggy McFoggy added bug and removed bug labels May 18, 2021
@McFoggy
Copy link
Contributor

McFoggy commented May 18, 2021

@igroeg the result looks correct. What is the problem you have?

the nonQualifierBranches is a parameter telling jgitver not to introduce a qualifier for some branches.
Here the computed version is 0.0.0-SNAPSHOT without a qualifier as expected.

> git checkout -b my-branch
> mvn validate
[INFO] Using jgitver configuration file: C:\workspace\projects\oss\jgitver\reproducers\issue-154\test-123\.mvn\jgitver.config.xml
[INFO] Using jgitver-maven-plugin [1.7.1] (sha1: 8df68168ee27bd90e0609cc393330520d86884da)
[INFO]     version '0.0.0-my_branch-SNAPSHOT' computed in 401 ms
[INFO]
[INFO] Scanning for projects...
[INFO] jgitver-maven-plugin is about to change project(s) version(s)
[INFO]     test::test-123::1.0-SNAPSHOT -> 0.0.0-my_branch-SNAPSHOT
[INFO]
[INFO] ---------------------------< test:test-123 >----------------------------
[INFO] Building test-123 0.0.0-my_branch-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.681 s
[INFO] Finished at: 2021-05-18T14:52:30+02:00
[INFO] ------------------------------------------------------------------------

now the computed version has a qualifier built from the branch name

@igroeg
Copy link
Author

igroeg commented May 19, 2021

Maybe it's my misunderstanding, but I expected when you have not qualifying branches, just don't apply the plugin at all and just use the default version inside the pom?

@McFoggy
Copy link
Contributor

McFoggy commented May 19, 2021

@igroeg that's not how it works, nonQualifierBranches just tell jgitver not to compute/add a qualifier from the branch name for the given branches. It does not prevent jgitver to operate and compute a version.

If you use a CI, you can skip jgitver for some branches to reach your goal, just pass -Djgitver.skip=true when buidling the branches where you would like to keep the original version.

@igroeg
Copy link
Author

igroeg commented May 19, 2021

@McFoggy I want to configure jgitver as follows - for branch master use provided hardcoded version (or i could try to disable the extention in the CI, it's not a problem at all. But then I want for all other branches the version to be branch-tag-snapshot. Is it possible at all?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants