Where communities thrive


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

    McFoggy on master

    introduce CHANGELOG (compare)

  • Mar 30 2021 09:46

    McFoggy on integration

    introduce CHANGELOG (compare)

  • Mar 30 2021 08:47

    McFoggy on 0.14.0

    (compare)

  • Mar 30 2021 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 2021 08:31

    McFoggy on integration

    force mvnw checkout to use LF (compare)

  • Mar 30 2021 07:28

    McFoggy on integration

    introduce depclean plugin, clea… (compare)

  • Mar 29 2021 10:11

    McFoggy on integration

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

  • Jan 15 2021 14:19

    McFoggy on master

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

  • Jan 15 2021 13:45

    McFoggy on integration

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

  • Jan 15 2021 13:42

    McFoggy on integration

    add sponsor button (compare)

  • Jan 15 2021 13:32

    McFoggy on integration

    add FUNDING.yml file to introdu… (compare)

  • Jan 14 2021 21:50

    McFoggy on 0.13.1

    (compare)

  • Jan 14 2021 21:50

    McFoggy on master

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

  • Jan 14 2021 10:14

    McFoggy on integration

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

  • Jan 14 2021 10:00

    McFoggy on master

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

  • Jan 14 2021 08:39

    McFoggy on issue-116

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

  • Jan 14 2021 08:13

    McFoggy on master

    force dependency resolution to … (compare)

  • Jan 14 2021 08:07

    McFoggy on issue-115

    force dependency resolution to … (compare)

  • Jan 14 2021 07:42

    McFoggy on pr-114

    (compare)

  • Jan 13 2021 11:58

    McFoggy on master

    add COMMIT_ISO_TIMESTAMP metada… (compare)

Gerard Bosch
@gerardbosch
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?
soloturn
@soloturn
see here for an example @su5ed:matrix.org : https://github.com/ripmeapp2/ripme/blob/main/build.gradle.kts
Su5eD
@su5ed:matrix.org
[m]
Is it possible to optionally append the commit hash depending on the branch?
I was thinking of having a separate version pattern for dev and release branches
dev-samples
@dev-samples

I am using gradle and jenkins. Is is possible in my jenkinsfile to pass the jgitver generated version to e.g. sonar in my pipeline:

        stage('sonar') {
            withSonarQubeEnv('SonarAuth') {
              sh "${scannerHome}/bin/sonar-scanner -Dsonar.projectVersion=${version}"
            }
        }

I know I can get the version by first calling:

        stage('sonar') {
            withSonarQubeEnv('SonarAuth') {
              sh "./gradlew version"
              sh "${scannerHome}/bin/sonar-scanner -Dsonar.projectVersion=${version}"
            }
        }

and then I could do some processing on the output from the gradle call but is there a simpler way?

2 replies
Su5eD
@su5ed:matrix.org
[m]
Is there a way to sum up a tag's patch version and the commit distance, and then use that as the project's patch version?
Su5eD
@su5ed:matrix.org
[m]
looks like the SCRIPT strategy is what i'm looking for
or is it also achievable using a pattern?
Jannis Gumz
@JannisGz

Hi there @McFoggy and everybody else!
I am giving the jgitver-maven-extension a try and all my artifacts are being named correctly. It is a really nice tool to have!
However, there are a few questions remaining:

1) The Versionname is correcctly displayed on the command line and the version name in my original POM is not overwritten (as intended). However the POM in my target directory is not overwritten either. Is this intended or am I missing something?

2) When I build a jar there are actually two pom.xml's packaged into it. One with the unmodified version and one with the version calculated using jgitver. How does that work? Is there a way to only have the modified pom in my jar file?

Thank you in advance and kind regarards
JannisGz

1 reply
Bob
@naugler
when using the gradle plugin, is there a way to access intermediate components of the versioning calculation? For example, if I configure jgitver to use the MAVEN strategy but I still want to include COMMITDISTANCE in part of another package name, can I access that variable even though it is not being included when VERSION is set?
1 reply
lbruun
@lbruun
@McFoggy. A new release of jgitver-maven-plugin into Maven Central would be welcome. :-) Eagerly awaiting jgitver/jgitver-maven-plugin#163 which has been merged to mainline.
Matthieu Brouillard
@McFoggy
@lbruun 1.9.0 has been just released
sorry for the long time you had to wait for it
Frank Jakop
@fjakop
Hi there, I think version calculation on branches has a breaking change in it switching from 1.7.1 to 1.8.0. In the former version, a tag on a feature branch would calculate (correctly) to a non-snapshot version. Since 1.8.0 it would calculate to the branch version snapshot. I've opened jgitver/jgitver-maven-plugin#166 on beginning of November but unfortunately no reply yet. Can anyone confirm that behaviour?
Jon-Håkon Bøe Røli
@jonhakr
Hello! Is https://github.com/jgitver/jgitver-maven-plugin/wiki/Intellij-IDEA-configuration still the way to go to be able to use jgitver and have IntelliJ refactoring, go-to-def and all the other goodies work?
lbruun
@lbruun

@jonhakr : I would expect so. We don't use jgitver in our projects' git code. It is used extensively, but only from CI pipelines which "injects" the needed setup for the JGitVer Maven Plugin. So we don't have the problem of whether jgitver plays nicely with the IDE or not. (I can recommend this approach).

In any case, they way I understood it is that there's only a problem wrt IntelliJ IDEA and jgitver at the moment of project loading ... for which problem you need to use the trick in the link. Once the project is "loaded" then the IDE doesn't know jgitver is there and everything in the IDE will work as it is supposed to (for example refactoring, go-to-def, etc). Bottom line: I would expect everything to work as it should once you've passed the hurdle of loading (aka opening) the project.

1 reply
Matthieu Brouillard
@McFoggy
as @lbruun said, unfortunately dynamic versioning is not friendly with how the way any IDE works, especially when you have multiple modules, multiple projects referncing each others. The safest way, is really to disable jgitver inside the IDE (IDEA or Eclipse) and use a fixed version. Reserve jgitver usage where it matters and rocks, on the command line/CI !!! Enjoy !
Roland Tepp
@roland-tepp:matrix.org
[m]
Hi,
I wonder if Gradle plugin exposes jgitver in some way that I could use to generate docker image tags based on the information jgitver had collected?
1 reply
christopinka
@christopinka
How do I start a Maven project? What should <version></version> be set to initially? If at all?
3 replies
Franco
@foxhound91
Hi guys, I recently upgraded to Gradle v7 and my jgitver format changed :/
now it's like "3.0.227-2" instead of "3.0.227"
How can I get rid of the last digits concatenated to the patch version?
2 replies
Saulo S. Toledo
@saulotoledo
Hi all. I am new to jgitver. Im trying to use meta.NEXT_MINOR_VERSION in my pattern, but that particular attribute is empty. WHat are the possible causes? I need the version calculated to be the previous version + 1 for minor or patch attributes.
2 replies
Saulo S. Toledo
@saulotoledo
Is there a way to define a default value in case some environment variables are not defined?
I used this: <versionPattern>${M}.${env.MINOR_VERSION}.${env.PATCH_VERSION}</versionPattern>
The environment variables are defined in my CI. But locally that will fail. I would like to default them to 0
if the variables are not yet defined
Matthieu Brouillard
@McFoggy
@saulotoledo there is currently no default value in variable expansion, open an issue on jgitver to track the request for enhancement
Saulo S. Toledo
@saulotoledo
Thanks @McFoggy.
I am having another issue: after using jgitver in a multimodule project maven fails with "The POM violates the code style. Please format it by running mvn tidy:pom." The issue is not making sense to me at first glance. Any hints about what may have been causing it? It works if I disable jgitver.
1 reply
soloturn
@soloturn
i am trying to use the release process of github now with gradle. if the release is good, i want to click the github gui and create the tag. unfortunately github does not create an annotated tag, but lightweight. so the next verison built has no increased patch version. can i use a property to increase the patch version as well for a lightweight tag?
Zoltan Altfatter 👨🏻‍💻
@altfatterz_twitter
hello everybody. Does anyone have experience with overriding/upgrading a dependency of jgitver? I have issue with a pulled in transitive dependency commons-io:jar:2.6 which is vulnerable. jgitver/jgitver#146 I am using jgitver with maven.
Frank Jakop
@fjakop
I recently observed a strange behaviour with jgitver in conjunction with maven incremental compilation. Think of a multimodule project where module a references module b. When I split the "mvn install" into two maven calls, i.e. "mvn package" followed by "mvn install", maven will always recompile module a, printing a message: "Changes detected - recompiling the module".
Investigating further ("-X") it shows the cause for this: "New dependency detected: module b". This happens only when using jgitver. Disabling jgitver this works as expected without recompilation.
Can anyone confirm this?
Suresh
@sureshg
Hi, first of all, thanks for creating jgitver and build tools plugins. I am using it in a few of my oss demo projects. I am facing a few minor issues (jgitver/gradle-jgitver-plugin#34) that might get fixed by updating to the latest version of jgitver. Are there any plans to update the Gradle /Maven plugin to have the latest version of libraries (https://github.com/jgitver/gradle-jgitver-plugin/pulls)?