Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Mar 30 10:45

    McFoggy on master

    introduce CHANGELOG (compare)

  • Mar 30 09:46

    McFoggy on integration

    introduce CHANGELOG (compare)

  • Mar 30 08:47

    McFoggy on 0.14.0

    (compare)

  • Mar 30 08:47

    McFoggy on master

    branchPolicy/pattern will accep… Add version pattern on branchin… update jgit to latest version and 1 more (compare)

  • Mar 30 08:31

    McFoggy on integration

    force mvnw checkout to use LF (compare)

  • Mar 30 07:28

    McFoggy on integration

    introduce depclean plugin, clea… (compare)

  • Mar 29 10:11

    McFoggy on integration

    branchPolicy/pattern will accep… Add version pattern on branchin… update jgit to latest version (compare)

  • Jan 15 14:19

    McFoggy on master

    add FUNDING.yml file to introdu… add sponsor button (compare)

  • Jan 15 13:45

    McFoggy on integration

    add FUNDING.yml file to introdu… add sponsor button (compare)

  • Jan 15 13:42

    McFoggy on integration

    add sponsor button (compare)

  • Jan 15 13:32

    McFoggy on integration

    add FUNDING.yml file to introdu… (compare)

  • Jan 14 21:50

    McFoggy on 0.13.1

    (compare)

  • Jan 14 21:50

    McFoggy on master

    update nexus-staging-maven-plug… (compare)

  • Jan 14 10:14

    McFoggy on integration

    force dependency resolution to … update to guava-30.1-jre fixes… update nexus-staging-maven-plug… (compare)

  • Jan 14 10:00

    McFoggy on master

    update to guava-30.1-jre fixes… (compare)

  • Jan 14 08:39

    McFoggy on issue-116

    update to guava-30.1-jre fixes… (compare)

  • Jan 14 08:13

    McFoggy on master

    force dependency resolution to … (compare)

  • Jan 14 08:07

    McFoggy on issue-115

    force dependency resolution to … (compare)

  • Jan 14 07:42

    McFoggy on pr-114

    (compare)

  • Jan 13 11:58

    McFoggy on master

    add COMMIT_ISO_TIMESTAMP metada… (compare)

Matthieu Brouillard
@McFoggy
@blawlor there is no possibility for this in current implementation
Gerard Bosch
@gerardbosch

Hi there! Does anybody know if in Spring Boot the following "automatic property expansion at build time" will work using jgitver?

app.encoding=@project.build.sourceEncoding@
build.version=@project.version@

Will the app.java.version be captured properly?

Reference: https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto-automatic-expansion

Cool project & thx!!

P.S. The above is intended to be part of the bootstrap.properties of spring boot.
Gerard Bosch
@gerardbosch
(edited) Sorry I meant build.version=@project.version@
Matthieu Brouillard
@McFoggy
if it is at build time, it should work if the springboot plugin is written correctly
Gerard Bosch
@gerardbosch
Thanks @McFoggy I guessed so, but just to be sure if anyone had any experience about it. I will try to introduce jgitver in one of my work projects. Just wanted to be sure that breaks nothing and I noticed that property in the bootstrap.properties.
Matthieu Brouillard
@McFoggy
the springboot plugin should lookup values from the POM (as in-memory object model) ; if so it will work. If on the opposite it tries to do things on its own by reading the pom.xml file, then it will read a wrong value.
Matthieu Brouillard
@McFoggy
@gerardbosch just tested it with a generated springboot app from spring initialzr:
  • added : project.version=@project.version@ in application.proerties
  • mvn package
  • open the generated jar , look BOOT-INF\classes\application.properties , version is 0.0.1-SNAPSHOT as in the pom.xml file
  • add jgitver with the .mvn\extensions.xml file
  • mvn package
  • open the generated jar , look BOOT-INF\classes\application.properties , version is now the one generated by jgitver 0.0.0-NOT_A_GIT_REPOSITORY
Matthieu Brouillard
@McFoggy
otherwise, and for those not using spring, standard resource filtering will work for sure
Gerard Bosch
@gerardbosch
Great news! Thanks a lot Matthieu for making the test :)
Gerard Bosch
@gerardbosch

Hi, I'm looking at the docs if is there a way to not qualify a branch that matches a wildcard (or regex). In my particular case I would like to not qualify release/ branches. How would be the way to achieve sth like this:

<nonQualifierBranches>master,release/*</nonQualifierBranches>

N.B. Using the Maven strategy

Gerard Bosch
@gerardbosch
Just to clarify, what I waht is that the version computed when in branch e.g. release/1.0.0 is 1.0.0 and not 1.0.0-release_1.0.0
Gerard Bosch
@gerardbosch

I've finally managed to do it using a <branchPolicy> with IGNORE, but in this case I observe that I need to explicitly define a policy with IGNORE for each branch I do not want to qualify (master, develop, release). And that when configuring it this way, the <nonQualifierBranches> takes no longer effect.

I guess this is the intended way to achieve it. But I'm wondering myself if nonQualifierBranches> could accept regex or wildcards.
If I'm wrong at some point, anybody can correct me :)

Gerard Bosch
@gerardbosch
Hello @McFoggy , do you have any idea about my doubts/question above? :pray: thx!! :)
htrost
@htrost

Hi...if Im setting an empty JGITVER_BRANCH through export JGITVER_BRANCH= jgitver adds a - to the version.

foo@foo MINGW64 /c/model ((0.2.6))
$ export JGITVER_BRANCH=

foo@foo MINGW64 /c/model ((0.2.6))
$ mvn validate
[INFO] Using jgitver configuration file: C:\model\.mvn\jgitver.config.xml
[INFO] Using jgitver-maven-plugin [1.5.1] (sha1: e45d1669b39cedb98720dd33cc14d0185b455ca1)
[INFO]     version '0.2.6-' computed in 277 ms
[INFO]
[INFO] Scanning for projects...
[INFO] jgitver-maven-plugin is about to change project(s) version(s)
[INFO]     ngn::model::0 -> 0.2.6-
[INFO]
[INFO] ----------------------< ngn:model >-----------------------
[INFO] Building model 0.2.6-
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.554 s
[INFO] Finished at: 2020-07-24T15:28:49+02:00
[INFO] ------------------------------------------------------------------------

Is this the expected behavior?

htrost
@htrost

I m using jgitver within gitlab and I now managed to get a workaround.

before_script:
  - if [ -z "$CI_COMMIT_BRANCH" ]]; then export JGITVER_BRANCH=$CI_COMMIT_BRANCH; fi

if jgitver doesnt add the - when JGITVER_BRANCH set to "" it would be easier and I could just do

JGITVER_BRANCH: $CI_COMMIT_BRANCH
Marvin Kruse
@gimmebytes
Hi @McFoggy! We're using the jgitver maven plugin and I've a quick question: is it somewhat possible in maven multi module project to have different versions per module set, based on specific tags used for calculating the actual versions?
I was thinking of structuring an internal API alongside with a spring boot starter and dropwizard bundle in the same repo, but the API and the starter and bundle can have different versions - if the plugin cant do that I might think about using git sub modules or such to reach the desired behaviour
Jörn Guy Süß
@jgsuess_gitlab
Hi!
I have a (possibly silly) question. Within a multi-module project, if I have dependencies among the different modules, how do I give the version number of the module I depend on. I have tried using <version>0</version>. That fails in POM resolution. Now I am using <version>${jgitver.calculated_version}</version>, this works for the build, but it means my IDE complains about an undeclared value and cannot resolve look-ups into the other code any more. Is this normal behaviour or am I missing something?
Marvin Kruse
@gimmebytes
@jgsuess_gitlab I think <version>${project.version}</version> is the thing you're looking for!
Jörn Guy Süß
@jgsuess
Oh man, the patently obvious. Thanks.
Marvin Kruse
@gimmebytes
@jgsuess_gitlab you're welcome (-:
Gerard Bosch
@gerardbosch

Hi, I've got the same question of @jgsuess_gitlab but my structure is like parent-pom <--- microservice where they are not packaged together (don't belong to the same build unit/aggregator) and have different versions. In parent-pom I have a dependency with the same version of parent-pom to another component. But if I declare it using something like ${project.version} when I compile microservice, the actual value of project.version is not the one of parent-pom but the microservice one.

I guess using ${jgitver.calculated_version} will be the same.
I'm looking how can I make it work without hardcoding the value of the version for that dependency so I can fully automate it with JGitVer. Can't find a Maven property that refers to "this exact POM version". Any idea? Thx!

Matthieu Brouillard
@McFoggy
Sorry for the loooooong absence.
@jgsuess_gitlab the answer is not that obvious because of the dynamic nature of versions with jgitver.
But for sure the answer within the multi-module is <version>${project.version}</version>. On the other hand I'd tend to deactivate jgitver inside the IDE.
@gerardbosch do you have a minimal example of what you want to achieve ?
@gimmebytes I do not see any possibility to achieve something like what you exposed. Even submodules will not help in this case I think.
Matthieu Brouillard
@McFoggy
also yesterday I have integrated and released the jgitver/jgitver#108 initiated by Cedric.
It lacks docs but for sure it will allow a lot of freedom.
see jgitver-0.13.0 & jgitver-maven-plugin-0.6.0
Gerard Bosch
@gerardbosch

Hi @McFoggy , I hope everything is fine.
I've tried to create a Gist with a sample structure of what I mean, I hope it helps to have an idea.
I think it is not a strictly speaking JGitVer question, but probably a Maven one. I tagged the problem with <!-- PROBLEM EXAMPLE -->.

https://gist.github.com/gerardbosch/cffd7bf8eaf6be4ea658e3599cb04e98

Matthieu Brouillard
@McFoggy
@gerardbosch please checkout https://github.com/jgitver/jgitver-samples/tree/external-microservice/external-microservice and tell me if the project structure fits what you expect (without jgitver at the moment).
do not hesitate to PR to update it
Gerard Bosch
@gerardbosch
Hello @McFoggy , thank you very much! Yes, the project structure you've created fits the use case I'm trying to solve. But, the version for the dependency in the application should not be there (it is a managed dependency). I've updated it and issued a PR.
I think that should be the right structure for the sake of the problem :)
28 replies
You will see the commit:
Remove dependency version for managed dependencies The version of the library is provided in a<dependencyManagement>block somewhere in the parent chain of this microservice application.
YaytayAtWork
@YaytayAtWork
I would like to have SNAPSHOT versions only when the repo is dirty.
Any builds that come from our CI should have a releasable version.
At the moment I don't think it's possible to get this because there aren't any conditional expressions in the pattern language.
Am I right, or is there a way around this?
Thanks
Matthieu Brouillard
@McFoggy
@YaytayAtWork you're right out of the box this is not possible but with the new SCRIPT strategy you can probably do something
YaytayAtWork
@YaytayAtWork
@McFoggy , ah yes, I have a script working they way I want, but do you know any way to stop the reflective access operation warnings appearing with recent JDKs?
Switched from Groovy to BeanShell hoping that would be better, but it still spits out five lines of WARNINGs :(
YaytayAtWork
@YaytayAtWork

Oh, I got it, using BeanShell with its built in map lookup expressions works cleanly.
Experimenting with this setup now:

<configuration xmlns="http://jgitver.github.io/maven/configuration/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jgitver.github.io/maven/configuration/1.1.0 https://jgitver.github.io/maven/configuration/jgitver-configuration-v1_1_0.xsd">
<strategy>SCRIPT</strategy>
<scriptType>BEAN_SHELL</scriptType>
<script><![CDATA[
parts = new ArrayList();
parts.add(Integer.toString(metadata{"CURRENT_VERSION_MAJOR"}));
parts.add(Integer.toString(metadata{"CURRENT_VERSION_MINOR"}));
parts.add(Integer.toString(metadata{"COMMIT_DISTANCE"}));
if ((metadata{"QUALIFIED_BRANCH_NAME"} != null) && !metadata{"DETACHED_HEAD"}) {
parts.add(metadata{"QUALIFIED_BRANCH_NAME"});
}
if (System.getenv(){"CI_COMMIT_BRANCH"} != null && !"master".equals(System.getenv(){"CI_COMMIT_BRANCH"})) {
parts.add(System.getenv(){"CI_COMMITBRANCH"}.replaceAll("-", ""));
}
if (metadata{"DIRTY"}) {
parts.add("SNAPSHOT");
}
System.out.print(String.join(";", parts));
]]></script>
<exclusions>
<exclusion>.m2</exclusion>
</exclusions>
</configuration>

The silly bit with CI_COMMIT_BRANCH is because GitLab always has a detached head :(

Matthieu Brouillard
@McFoggy
where do you see those warnings? using which jdk ? I tried with OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.3+7, mixed mode) and did not noticed the warning from the maven build output
Freebios
@Freebios_gitlab

Hi there, I'm looking forward to use jgitver in my Gitlab CI workflow, but i'm facing two issues on gitlab runners (self hosted on more powerful servers) that seems to slow down my build time.

First one:

1235 [INFO] Using jgitver configuration file: /builds/av3ng3rs/java/core/services-parent/.mvn/jgitver.config.xml
1311 [INFO] Using jgitver-maven-plugin [1.7.0] (sha1: d1ec089e1beee96c5492c0caf9c6f4b46f99b080)
7830 [WARNING] locking FileBasedConfig[/root/.gitconfig] failed after 5 retries
8035 [INFO]     version '1.0.0-feature_ci-SNAPSHOT' computed in 6724 ms

It seems that the process of calculating the version is quite long on the runner, almost 7s, when I run it localy i'm more close to 250ms
When i check logs with -X, i end up with thousand of repeating line like theses

1641 [DEBUG] file=/builds/path_to_project/.git/.probe-bf19f382-62b0-4007-b7eb-ac6e416f8293, create new FileSnapshot: lastRead=2020-12-12 22:51:08.073486000, lastModified=2020-12-12 22:51:08.068086142, size=1, fileKey=(dev=903,ino=28054694)
1642 [DEBUG] file=/builds/path_to_project/.git/.probe-bf19f382-62b0-4007-b7eb-ac6e416f8293, isRacyClean=false, read=2020-12-12 22:51:08.073486000, lastModified=2020-12-12 22:51:08.068086142, delta=5399858 ns, racy<=15000 ns
1642 [DEBUG] file=/builds/path_to_project/.git/.probe-bf19f382-62b0-4007-b7eb-ac6e416f8293, is unmodified
1642 [DEBUG] file=/builds/path_to_project/.git/.probe-bf19f382-62b0-4007-b7eb-ac6e416f8293, create new FileSnapshot: lastRead=2020-12-12 22:51:08.074386000, lastModified=2020-12-12 22:51:08.072086147, size=1, fileKey=(dev=903,ino=28054694)
1642 [DEBUG] file=/builds/path_to_project/.git/.probe-bf19f382-62b0-4007-b7eb-ac6e416f8293, isRacyClean=false, read=2020-12-12 22:51:08.074386000, lastModified=2020-12-12 22:51:08.072086147, delta=2299853 ns, racy<=15000 ns
1643 [DEBUG] file=/builds/path_to_project/.git/.probe-bf19f382-62b0-4007-b7eb-ac6e416f8293, is unmodified
[...]
6621 [DEBUG] delta [ns] since modification FileSnapshot failed to detect
count, failures, racy limit [ns], delta min [ns], delta max [ns], delta avg [ns], delta stddev [ns]
3980, 3707, 15000, 1871090.0, 5676723.0, 3736739.391151875, 1081476.559029328

The same goes on with

10709 [DEBUG] file=/root/.probe-e8249699-261f-4a3a-a44f-fbafa3aa266a, is unmodified
10710 [DEBUG] delta [ns] since modification FileSnapshot failed to detect
count, failures, racy limit [ns], delta min [ns], delta max [ns], delta avg [ns], delta stddev [ns]
2007, 1914, 5000, 1860421.0, 5691155.0, 3759235.1191222565, 1101913.3936016075

And also /root/.gitconfig fail to lock

7830 [WARNING] locking FileBasedConfig[/root/.gitconfig] failed after 5 retries

I found an issue similar but that might be unrelated, as the workaround they advice is to change the FS of docker to overlay2, which is the one we are already using
gitlab-org/gitlab-runner#26618

Did you ever encounter something similar, if not then I'll probably open an issue to track this

Thanks :)

BalanDm
@BalanDm
Hello @McFoggy ! I have a little question :) I want use simple X.Y.Z version. But if I setting <auto Increment Patch> true </autoIncrementPatch> <regexVersion Tag> r ([0-9] +) </ regexVersion Tag>
and creating git tag -a r1, I see 2.0.0. But i want 1.0.1, and after next tag i want see 1.0.2. Thanks :)
4 replies
BalanDm
@BalanDm
Hello! I need help :( I have multi-modules project which contains several static version modules. When i create a build with plugin in my maven repository, then renaimed version appears. How to turn off the module renaiming? Thanks in advance.
7 replies
ProggerPete
@ProggerPete
Is there a way to have my dev machine build snapshot versions while my build server is building non-snapshot versions?
1 reply
BalanDm
@BalanDm
This message was deleted
BalanDm
@BalanDm

Hello @McFoggy ! I have a problem again...

[Step 2/3] [ERROR] The build could not read 3 projects -> [Help 1]
[00:25:34] [Step 2/3] [ERROR]
[00:25:34] [Step 2/3] [ERROR] The project by.softclub.netteller.services:by.softclub.services.mobile:1.0-SNAPSHOT (/opt/teamcity/TeamCity/buildAgent/work/cc51edd9d3f8a704/by.softclub.services.mobile/pom.xml) has 1 error
[00:25:34] [Step 2/3] [ERROR] Non-resolvable parent POM for by.softclub.netteller.services:by.softclub.services.mobile:1.0-SNAPSHOT: Could not find artifact by.softclub.netteller.services:by.softclub.netteller.services:pom:1.0-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 6, column 13 -> [Help 2]
[00:25:34] [Step 2/3] [ERROR]
[00:25:34] [Step 2/3] [ERROR] The project by.softclub.netteller.services:by.softclub.banking.utils:1.0.2 (/opt/teamcity/TeamCity/buildAgent/work/cc51edd9d3f8a704/by.softclub.banking.utils/pom.xml) has 1 error
[00:25:34] [Step 2/3] [ERROR] Non-resolvable parent POM for by.softclub.netteller.services:by.softclub.banking.utils:1.0.2: Could not find artifact by.softclub.netteller.services:by.softclub.netteller.services:pom:1.0-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 7, column 13 -> [Help 2]
[00:25:34] [Step 2/3] [ERROR]
[00:25:34] [Step 2/3] [ERROR] The project by.softclub.netteller.services:flyway:1.0-SNAPSHOT (/opt/teamcity/TeamCity/buildAgent/work/cc51edd9d3f8a704/flyway/pom.xml) has 1 error
[00:25:34] [Step 2/3] [ERROR] Non-resolvable parent POM for by.softclub.netteller.services:flyway:1.0-SNAPSHOT: Could not find artifact by.softclub.netteller.services:by.softclub.netteller.services:pom:1.0-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 5, column 13 -> [Help 2]
[00:25:34] [Step 2/3] [ERROR]

my project structure:
(directory)-.mvn
(module)-by.softclub.banking.utils
(module)-by.softclub.services.mobile
(module)-flyway
.gitignore
pom.xml

jgitver.config.xml

<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_1_0.xsd">
<strategy>PATTERN</strategy>
<versionPattern>${M}.${m}.${meta.COMMIT_DISTANCE}${-~meta.QUALIFIED_BRANCH_NAME}${-~meta.GIT_SHA1_8}</versionPattern>
<tagVersionPattern>${M}.${m}.${meta.COMMIT_DISTANCE}${-~meta.QUALIFIED_BRANCH_NAME}${-~meta.GIT_SHA1_8}</tagVersionPattern>

<exclusions> <!-- Optional list of directory path -->
<exclusion>by.softclub.banking.utils</exclusion>
<exclusion>by.softclub.services.mobile</exclusion>
<exclusion>flyway</exclusion>
</exclusions>

<branchPolicies>
<branchPolicy>
<pattern>(production)</pattern>
<transformations>
<transformation>IGNORE</transformation>
</transformations>
</branchPolicy>
</branchPolicies>
</configuration>

1 reply
Peter Merikan
@merikan
I am still using version 1.4.4 of the maven plugin in my projects and I'm about to upgrade. Is there a changelog somewhere for jgitver and jgitver-maven? Since I couldn't find one I thought I would ask before I start reading the commit logs ;-)
3 replies
Pedro Lopes
@pedrolopix
Hi! I'm trying using jgitver in Github action, but without success, anyone already try it?
15 replies
soloturn
@soloturn
i updated the PR to use new gradle version + jgitver 0.14.0 for the gradle-jgitver-plugin, btw ...
Frank Jakop
@fjakop
Hello, we're using jGitVer 1.7.1 in a reactor project where some modules have dependencies to each other. This builds well with maven, but the integration in IntelliJ IDEA fails to resolve the reactor modules. Does anyone know a solution/workaround?
1 reply
igroeg
@igroeg
Hi @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?
1 reply
Su5eD
@su5ed:matrix.org
[m]
Hi! I'm trying to use the jgitver gradle plugin, but it ignores my configuration. Might it be related to the kotlin dsl?