jgitver-maven-plugin icon indicating copy to clipboard operation
jgitver-maven-plugin copied to clipboard

Jgitver configuration is not considered when building

Open igroeg opened this issue 3 years ago • 6 comments

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>

igroeg avatar May 17 '21 12:05 igroeg

Can you provide a reproducer ?

McFoggy avatar May 18 '21 07:05 McFoggy

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

igroeg avatar May 18 '21 10:05 igroeg

@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

McFoggy avatar May 18 '21 12:05 McFoggy

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?

igroeg avatar May 19 '21 11:05 igroeg

@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.

McFoggy avatar May 19 '21 12:05 McFoggy

@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?

igroeg avatar May 19 '21 14:05 igroeg