qoomon / gradle-git-versioning-plugin Goto Github PK
View Code? Open in Web Editor NEWThis extension will set project version, based on current Git branch or tag.
License: GNU General Public License v3.0
This extension will set project version, based on current Git branch or tag.
License: GNU General Public License v3.0
The 'LATEST' version couldn't be found, but version 1.2.3 can be found. Is the LATEST in another plugin repository?
* What went wrong:
Plugin [id: 'me.qoomon.git-versioning', version: 'LATEST'] was not found in any of the following sources:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'me.qoomon.git-versioning:me.qoomon.git-versioning.gradle.plugin:LATEST')
Searched in the following repositories:
Gradle Central Plugin Repository
Hi,
first of all: thanks a lot for your gradle plugin. So far, it did exactly what I needed!
Now, however, I experience an error when executing the plugin as part of my build.gradle:
Object [full hash of commit] is not a commit.
org.eclipse.jgit.errors.IncorrectObjectTypeException: Object [full hash of commit] is not a commit.
This error pops up in my CI build on github and started once I did the following:
I searched the internet for the error message and came up with this website:
https://paul.wellnerbou.de/2015/06/18/getting-commits-between-annotated-tags-with-jgit/
As I did (pre-)releases on GitHub and changed them after creating them (which I have never done before) around the time I experienced the error for the first time, I guess this is somehow related to the git tagging.
Please let me know if there is anything you need from me to look into this.
uli-f
if i just copy and paste the example from the README.md
i get a org.gradle.internal.exceptions.LocationAwareException
i think it's because the pattern for the "/pull" prefix is invalid:
branch(closureOf<VersionDescription>{
pattern = "pull/.+)"
versionFormat = "\${branch}-SNAPSHOT"
})
leads to: Unmatched closing ')' near index 6 pull/.+)
think it should be like:
branch(closureOf<VersionDescription>{
pattern = "pull/(.+)"
versionFormat = "\${branch}-SNAPSHOT"
})
works for me at least :D
Full stacktrace:
Unmatched closing ')' near index 6
pull/.+)
^
at org.gradle.kotlin.dsl.execution.InterpreterKt$locationAwareExceptionFor$2.invoke(Interpreter.kt:558)
at org.gradle.kotlin.dsl.execution.InterpreterKt.locationAwareExceptionFor(Interpreter.kt:565)
at org.gradle.kotlin.dsl.execution.InterpreterKt.locationAwareExceptionHandlingFor(Interpreter.kt:531)
at org.gradle.kotlin.dsl.execution.InterpreterKt.access$locationAwareExceptionHandlingFor(Interpreter.kt:1)
at org.gradle.kotlin.dsl.execution.Interpreter$ProgramHost.handleScriptException(Interpreter.kt:381)
at Program.execute(Unknown Source)
This failure is due to the different line endings.
When configuring updateGradleProperties directly in the apply block, this setting is never considered.
As the VersionDescription is inialized with updateGradleProperties set to false, the method GitVersioningPluginExtension.getUpdateGradlePropertiesFileOption is always left without considering the property in GitVersioningPluginConfig.
Currently properties like commit.timestamp, commit.timestamp.year uses the commit author date (the date when commit was originally made). Can you add a new properties which contains commit date (the date when the commit is being modified)
To keep compatibility with current behavior I suggest to use commit.timestamp, commit.timestamp.year and so on to track author date and new properties like commit.committed.timestamp commit.committed.timestamp.year and so on to track committed date
${describe.tag}
chooses the first tag in the alphabetical order, instead of the latest one, like git describe
does.
Steps to reproduce:
a
b
gitVersioning.apply {
rev {
version = '${describe.tag}'
}
}
Actual behaviour:
./gradlew :version
returns a
. git describe
returns b
.
Expected behaviour:
./gradlew :version
returns b
.
Tested on the plugin version 6.1.1.
another documentation improvement for https://github.com/qoomon/gradle-git-versioning-plugin#gitlab-ci-setup
instead of defining the version env variables for each job or using the before_script block, it is possible to define them as "global" variables:
variables:
VERSIONING_GIT_TAG: ${CI_COMMIT_TAG}
VERSIONING_GIT_BRANCH: ${CI_COMMIT_BRANCH}
this way the job execution is a bit faster, since the before_script havn't to be executed, if there is nothing else in it and the variables are available in all jobs :)
The latest release was named 9.4.1. Shouldn't this be 6.4.1?
I accidentally applied it via allprojects
block and got this error:
Cannot add task 'version' as a task with that name already exists
So apparently, when applied to the subproject, this plugin searches for the root project and adds version
task to it. In case of multiple projects, it attempts to add the same task twice.
Hello! I love the plugin!
I'm utilizing it in a project being built by Bamboo and I'm running into a few issues. Here's details about the setup:
gitVersioning.apply {
refs {
considerTagsOnBranches = true
//Tags will be used explicitly, e.g. 1.0.0
tag("(?<version>.*)") {
version = "\${ref.version}"
}
//release/1.0.0 -> 1.0.0-SNAPSHOT
//hotfix/1.0.1 -> 1.0.1-SNAPSHOT
branch("(release|hotfix)/(?<release>.+)") {
version = "\${ref.release}-SNAPSHOT"
}
//Branch names will be used explicitly
branch(".+") {
version = "\${ref}-SNAPSHOT"
}
}
// optional fallback configuration in case of no matching ref configuration
rev {
version = "\${commit}"
}
commit be04be543a5a53322172473b2ab26a26c93a6187 (HEAD -> release/1.0.0, origin/release/1.0.0)
During the build, the following log details are output:
Starting task 'Checkout Default Repository' of type 'com.atlassian.bamboo.plugins.vcs:task.vcs.checkout'
Checking out into /home/bamboo-agent-home/xml-data/build-dir/JS-LDB0-JOB1
Updating source code to revision: be04be543a5a53322172473b2ab26a26c93a6187
Fetching 'refs/heads/release/1.0.0' from 'ssh://[email protected]:7999/js/myreponame.git'.
Checking out revision be04be543a5a53322172473b2ab26a26c93a6187.
Creating local git repository in '/home/bamboo-agent-home/xml-data/build-dir/JS-LDB0-JOB1/.git'.
Cloning into '/home/bamboo-agent-home/xml-data/build-dir/JS-LDB0-JOB1'...
done.
Switched to a new branch 'release/1.0.0'
Branch release/1.0.0 set up to track remote branch release/1.0.0 from origin.
Updated source code to revision: be04be543a5a53322172473b2ab26a26c93a6187
Finished task 'Checkout Default Repository' with result: Success
The build then attempts to run the following:
export VERSIONING_GIT_BRANCH=${bamboo.planRepository.branchDisplayName}
echo branchDisplayName ${bamboo.planRepository.branchDisplayName}
echo revision ${bamboo.planRepository.revision}
./gradlew --stacktrace check clean build
The following is the output:
branchDisplayName release/1.0.0
revision be04be543a5a53322172473b2ab26a26c93a6187
Downloading https://services.gradle.org/distributions/gradle-8.0-bin.zip
...........10%............20%............30%............40%............50%............60%...........70%............80%............90%............100%
Welcome to Gradle 8.0!
For more details see https://docs.gradle.org/8.0/release-notes.html
Starting a Gradle Daemon (subsequent builds will be faster)
> Configure project :
matching ref: BRANCH - release/1.0.0
ref configuration: BRANCH - pattern: (release|hotfix)/(?<release>.+)
version: ${ref.release}-SNAPSHOT
FAILURE: Build failed with an exception.
* Where:
Build file '/home/bamboo-agent-home/xml-data/build-dir/JS-LDB0-JOB1/build.gradle' line: 58
* What went wrong:
A problem occurred evaluating root project 'myprojectname'.
> org.eclipse.jgit.errors.MissingObjectException: Missing unknown be04be543a5a53322172473b2ab26a26c93a6187
* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Exception is:
org.gradle.api.GradleScriptException: A problem occurred evaluating root project 'myprojectname'.
at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:93)
at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.lambda$apply$0(DefaultScriptPluginFactory.java:135)
at org.gradle.configuration.ProjectScriptTarget.addConfiguration(ProjectScriptTarget.java:79)
at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:138)
at org.gradle.configuration.BuildOperationScriptPlugin$1.run(BuildOperationScriptPlugin.java:65)
at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:47)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:68)
at org.gradle.configuration.BuildOperationScriptPlugin.lambda$apply$0(BuildOperationScriptPlugin.java:62)
at org.gradle.configuration.internal.DefaultUserCodeApplicationContext.apply(DefaultUserCodeApplicationContext.java:44)
at org.gradle.configuration.BuildOperationScriptPlugin.apply(BuildOperationScriptPlugin.java:62)
at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.lambda$applyToMutableState$0(DefaultProjectStateRegistry.java:388)
at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.fromMutableState(DefaultProjectStateRegistry.java:406)
at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.applyToMutableState(DefaultProjectStateRegistry.java:387)
at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:42)
at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:26)
at org.gradle.configuration.project.ConfigureActionsProjectEvaluator.evaluate(ConfigureActionsProjectEvaluator.java:35)
at org.gradle.configuration.project.LifecycleProjectEvaluator$EvaluateProject.lambda$run$0(LifecycleProjectEvaluator.java:109)
at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.lambda$applyToMutableState$0(DefaultProjectStateRegistry.java:388)
at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.lambda$fromMutableState$1(DefaultProjectStateRegistry.java:411)
at org.gradle.internal.work.DefaultWorkerLeaseService.withReplacedLocks(DefaultWorkerLeaseService.java:345)
at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.fromMutableState(DefaultProjectStateRegistry.java:411)
at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.applyToMutableState(DefaultProjectStateRegistry.java:387)
at org.gradle.configuration.project.LifecycleProjectEvaluator$EvaluateProject.run(LifecycleProjectEvaluator.java:100)
at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:47)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:68)
at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:72)
at org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:792)
at org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:156)
at org.gradle.api.internal.project.ProjectLifecycleController.lambda$ensureSelfConfigured$2(ProjectLifecycleController.java:84)
at org.gradle.internal.model.StateTransitionController.lambda$doTransition$13(StateTransitionController.java:247)
at org.gradle.internal.model.StateTransitionController.doTransition(StateTransitionController.java:258)
at org.gradle.internal.model.StateTransitionController.doTransition(StateTransitionController.java:246)
at org.gradle.internal.model.StateTransitionController.lambda$maybeTransitionIfNotCurrentlyTransitioning$10(StateTransitionController.java:207)
at org.gradle.internal.work.DefaultSynchronizer.withLock(DefaultSynchronizer.java:34)
at org.gradle.internal.model.StateTransitionController.maybeTransitionIfNotCurrentlyTransitioning(StateTransitionController.java:203)
at org.gradle.api.internal.project.ProjectLifecycleController.ensureSelfConfigured(ProjectLifecycleController.java:84)
at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.ensureConfigured(DefaultProjectStateRegistry.java:362)
at org.gradle.execution.TaskPathProjectEvaluator.configure(TaskPathProjectEvaluator.java:33)
at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:47)
at org.gradle.configuration.DefaultProjectsPreparer.prepareProjects(DefaultProjectsPreparer.java:42)
at org.gradle.configuration.BuildTreePreparingProjectsPreparer.prepareProjects(BuildTreePreparingProjectsPreparer.java:64)
at org.gradle.configuration.BuildOperationFiringProjectsPreparer$ConfigureBuild.run(BuildOperationFiringProjectsPreparer.java:52)
at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:47)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:68)
at org.gradle.configuration.BuildOperationFiringProjectsPreparer.prepareProjects(BuildOperationFiringProjectsPreparer.java:40)
at org.gradle.initialization.VintageBuildModelController.lambda$prepareProjects$2(VintageBuildModelController.java:84)
at org.gradle.internal.model.StateTransitionController.lambda$doTransition$13(StateTransitionController.java:247)
at org.gradle.internal.model.StateTransitionController.doTransition(StateTransitionController.java:258)
at org.gradle.internal.model.StateTransitionController.doTransition(StateTransitionController.java:246)
at org.gradle.internal.model.StateTransitionController.lambda$transitionIfNotPreviously$11(StateTransitionController.java:221)
at org.gradle.internal.work.DefaultSynchronizer.withLock(DefaultSynchronizer.java:34)
at org.gradle.internal.model.StateTransitionController.transitionIfNotPreviously(StateTransitionController.java:217)
at org.gradle.initialization.VintageBuildModelController.prepareProjects(VintageBuildModelController.java:84)
at org.gradle.initialization.VintageBuildModelController.prepareToScheduleTasks(VintageBuildModelController.java:71)
at org.gradle.internal.build.DefaultBuildLifecycleController.lambda$prepareToScheduleTasks$3(DefaultBuildLifecycleController.java:134)
at org.gradle.internal.model.StateTransitionController.lambda$doTransition$13(StateTransitionController.java:247)
at org.gradle.internal.model.StateTransitionController.doTransition(StateTransitionController.java:258)
at org.gradle.internal.model.StateTransitionController.doTransition(StateTransitionController.java:246)
at org.gradle.internal.model.StateTransitionController.lambda$maybeTransition$9(StateTransitionController.java:198)
at org.gradle.internal.work.DefaultSynchronizer.withLock(DefaultSynchronizer.java:34)
at org.gradle.internal.model.StateTransitionController.maybeTransition(StateTransitionController.java:194)
at org.gradle.internal.build.DefaultBuildLifecycleController.prepareToScheduleTasks(DefaultBuildLifecycleController.java:132)
at org.gradle.internal.buildtree.DefaultBuildTreeWorkPreparer.scheduleRequestedTasks(DefaultBuildTreeWorkPreparer.java:36)
at org.gradle.configurationcache.VintageBuildTreeWorkController$scheduleAndRunRequestedTasks$1.apply(VintageBuildTreeWorkController.kt:36)
at org.gradle.configurationcache.VintageBuildTreeWorkController$scheduleAndRunRequestedTasks$1.apply(VintageBuildTreeWorkController.kt:35)
at org.gradle.composite.internal.DefaultIncludedBuildTaskGraph.withNewWorkGraph(DefaultIncludedBuildTaskGraph.java:109)
at org.gradle.configurationcache.VintageBuildTreeWorkController.scheduleAndRunRequestedTasks(VintageBuildTreeWorkController.kt:35)
at org.gradle.internal.buildtree.DefaultBuildTreeLifecycleController.lambda$scheduleAndRunTasks$1(DefaultBuildTreeLifecycleController.java:68)
at org.gradle.internal.buildtree.DefaultBuildTreeLifecycleController.lambda$runBuild$4(DefaultBuildTreeLifecycleController.java:98)
at org.gradle.internal.model.StateTransitionController.lambda$transition$6(StateTransitionController.java:177)
at org.gradle.internal.model.StateTransitionController.doTransition(StateTransitionController.java:258)
at org.gradle.internal.model.StateTransitionController.lambda$transition$7(StateTransitionController.java:177)
at org.gradle.internal.work.DefaultSynchronizer.withLock(DefaultSynchronizer.java:44)
at org.gradle.internal.model.StateTransitionController.transition(StateTransitionController.java:177)
at org.gradle.internal.buildtree.DefaultBuildTreeLifecycleController.runBuild(DefaultBuildTreeLifecycleController.java:95)
at org.gradle.internal.buildtree.DefaultBuildTreeLifecycleController.scheduleAndRunTasks(DefaultBuildTreeLifecycleController.java:68)
at org.gradle.internal.buildtree.DefaultBuildTreeLifecycleController.scheduleAndRunTasks(DefaultBuildTreeLifecycleController.java:63)
at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:31)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.internal.buildtree.ProblemReportingBuildActionRunner.run(ProblemReportingBuildActionRunner.java:49)
at org.gradle.launcher.exec.BuildOutcomeReportingBuildActionRunner.run(BuildOutcomeReportingBuildActionRunner.java:65)
at org.gradle.tooling.internal.provider.FileSystemWatchingBuildActionRunner.run(FileSystemWatchingBuildActionRunner.java:140)
at org.gradle.launcher.exec.BuildCompletionNotifyingBuildActionRunner.run(BuildCompletionNotifyingBuildActionRunner.java:41)
at org.gradle.launcher.exec.RootBuildLifecycleBuildActionExecutor.lambda$execute$0(RootBuildLifecycleBuildActionExecutor.java:40)
at org.gradle.composite.internal.DefaultRootBuildState.run(DefaultRootBuildState.java:122)
at org.gradle.launcher.exec.RootBuildLifecycleBuildActionExecutor.execute(RootBuildLifecycleBuildActionExecutor.java:40)
at org.gradle.internal.buildtree.DefaultBuildTreeContext.execute(DefaultBuildTreeContext.java:40)
at org.gradle.launcher.exec.BuildTreeLifecycleBuildActionExecutor.lambda$execute$0(BuildTreeLifecycleBuildActionExecutor.java:65)
at org.gradle.internal.buildtree.BuildTreeState.run(BuildTreeState.java:53)
at org.gradle.launcher.exec.BuildTreeLifecycleBuildActionExecutor.execute(BuildTreeLifecycleBuildActionExecutor.java:65)
at org.gradle.launcher.exec.RunAsBuildOperationBuildActionExecutor$3.call(RunAsBuildOperationBuildActionExecutor.java:61)
at org.gradle.launcher.exec.RunAsBuildOperationBuildActionExecutor$3.call(RunAsBuildOperationBuildActionExecutor.java:57)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199)
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:73)
at org.gradle.launcher.exec.RunAsBuildOperationBuildActionExecutor.execute(RunAsBuildOperationBuildActionExecutor.java:57)
at org.gradle.launcher.exec.RunAsWorkerThreadBuildActionExecutor.lambda$execute$0(RunAsWorkerThreadBuildActionExecutor.java:36)
at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:249)
at org.gradle.internal.work.DefaultWorkerLeaseService.runAsWorkerThread(DefaultWorkerLeaseService.java:109)
at org.gradle.launcher.exec.RunAsWorkerThreadBuildActionExecutor.execute(RunAsWorkerThreadBuildActionExecutor.java:36)
at org.gradle.tooling.internal.provider.continuous.ContinuousBuildActionExecutor.execute(ContinuousBuildActionExecutor.java:110)
at org.gradle.tooling.internal.provider.SubscribableBuildActionExecutor.execute(SubscribableBuildActionExecutor.java:64)
at org.gradle.internal.session.DefaultBuildSessionContext.execute(DefaultBuildSessionContext.java:46)
at org.gradle.tooling.internal.provider.BuildSessionLifecycleBuildActionExecuter$ActionImpl.apply(BuildSessionLifecycleBuildActionExecuter.java:100)
at org.gradle.tooling.internal.provider.BuildSessionLifecycleBuildActionExecuter$ActionImpl.apply(BuildSessionLifecycleBuildActionExecuter.java:88)
at org.gradle.internal.session.BuildSessionState.run(BuildSessionState.java:69)
at org.gradle.tooling.internal.provider.BuildSessionLifecycleBuildActionExecuter.execute(BuildSessionLifecycleBuildActionExecuter.java:62)
at org.gradle.tooling.internal.provider.BuildSessionLifecycleBuildActionExecuter.execute(BuildSessionLifecycleBuildActionExecuter.java:41)
at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:63)
at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:31)
at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:50)
at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:38)
at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:47)
at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:31)
at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:65)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:39)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:29)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:35)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.create(ForwardClientInput.java:78)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.create(ForwardClientInput.java:75)
at org.gradle.util.internal.Swapper.swap(Swapper.java:38)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:75)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:64)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:63)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:84)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:52)
at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:297)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:49)
Caused by: java.lang.RuntimeException: org.eclipse.jgit.errors.MissingObjectException: Missing unknown be04be543a5a53322172473b2ab26a26c93a6187
at me.qoomon.gitversioning.commons.Lazy.get(Lazy.java:24)
at me.qoomon.gitversioning.commons.GitSituation.getTimestamp(GitSituation.java:56)
at me.qoomon.gradle.gitversioning.GitVersioningPluginExtension.generateGitProjectProperties(GitVersioningPluginExtension.java:627)
at me.qoomon.gradle.gitversioning.GitVersioningPluginExtension.apply(GitVersioningPluginExtension.java:151)
at me.qoomon.gradle.gitversioning.GitVersioningPluginExtension.apply(GitVersioningPluginExtension.java:79)
at me.qoomon.gradle.gitversioning.GitVersioningPluginExtension.apply(GitVersioningPluginExtension.java:73)
at me.qoomon.gradle.gitversioning.GitVersioningPluginExtension_Decorated.apply(Unknown Source)
at me.qoomon.gradle.gitversioning.GitVersioningPluginExtension_Decorated$apply.call(Unknown Source)
at build_8tae4cwgx664h2dx6g0lucy1o.run(/home/bamboo-agent-home/xml-data/build-dir/JS-LDB0-JOB1/build.gradle:58)
at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:91)
... 162 more
Caused by: org.eclipse.jgit.errors.MissingObjectException: Missing unknown be04be543a5a53322172473b2ab26a26c93a6187
at org.eclipse.jgit.internal.storage.file.WindowCursor.open(WindowCursor.java:135)
at org.eclipse.jgit.lib.ObjectReader.open(ObjectReader.java:214)
at org.eclipse.jgit.revwalk.RevWalk.parseAny(RevWalk.java:1081)
at org.eclipse.jgit.revwalk.RevWalk.parseCommit(RevWalk.java:992)
at org.eclipse.jgit.lib.Repository.parseCommit(Repository.java:1230)
at me.qoomon.gitversioning.commons.GitUtil.revTimestamp(GitUtil.java:125)
at me.qoomon.gitversioning.commons.GitSituation.timestamp(GitSituation.java:149)
at me.qoomon.gitversioning.commons.Lazy.get(Lazy.java:22)
error 15-Nov-2023 14:31:50 ... 171 more
The following portion of the stacktrace appears to be most relevant:
Caused by: org.eclipse.jgit.errors.MissingObjectException: Missing unknown be04be543a5a53322172473b2ab26a26c93a6187
at org.eclipse.jgit.internal.storage.file.WindowCursor.open(WindowCursor.java:135)
at org.eclipse.jgit.lib.ObjectReader.open(ObjectReader.java:214)
at org.eclipse.jgit.revwalk.RevWalk.parseAny(RevWalk.java:1081)
at org.eclipse.jgit.revwalk.RevWalk.parseCommit(RevWalk.java:992)
at org.eclipse.jgit.lib.Repository.parseCommit(Repository.java:1230)
at me.qoomon.gitversioning.commons.GitUtil.revTimestamp(GitUtil.java:125)
at me.qoomon.gitversioning.commons.GitSituation.timestamp(GitSituation.java:149)
at me.qoomon.gitversioning.commons.Lazy.get(Lazy.java:22)
The above points to https://github.com/qoomon/gradle-git-versioning-plugin/blob/master/src/main/java/me/qoomon/gitversioning/commons/GitUtil.java#L123.
It seems, for some reason, the jgit plugin isn't able to find the specific git commit object (be04be543a5a53322172473b2ab26a26c93a6187
) even though that is the current commit hash. I'm not sure where to go from here.
For commits after the release tag (e.g. v1.4.4), we would like to have the next version proposed with SNAPSHOT (e.g. 1.4.5-SNAPSHOT). Currently, it is required to write:
refs {
branch('master') {
version = '${describe.tag.version.major}-${describe.tag.version.minor}-${describe.tag.version.patch.next}-SNAPSHOT'
}
...
while:
version = '${describe.tag.version.nextPatch}-SNAPSHOT' //doesn't work
would be more convenient (together the variant for minor and major).
Unfortunately, the naming (e.g. nextMinor
) doesn't match the already using naming convention. version.next.patch
would be better, but people might expect to have the patch number from the next version. WDYT about adding something lilke that?
As a bonus (might be a separate issues, if preffered), in that approach, having the patch version usually bumped, it could be useful to from time to time release the bigger library update (e.g. 1.4.4 โ 2.0.0). With nextPatch
(and others) it would be problematic on CI. Maybe there could be also just version.next
available to bump patch digit by default (probably configurable by the user), but with the ability to override which value should be bumped with next
(with Gradle property or anything sensible for the CI environment). WDYT?
Update. After thinking about that, the bonus part doesn't seem to be crucial as the release version is taken from the tag, so only the SNAPSHOT versioning is affected, which could be "easily" override with changing the plugin configuration in the feature branch (just for releasing snapshots) and removing the changes before merge to master, followed by the tag creation.
it looks like the documentation wasn't updated after renaming the environment variables:
GIT_VERSIONING_TAG -> VERSIONING_GIT_TAG
GIT_VERSIONING_BRANCH -> VERSIONING_GIT_BRANCH
I wanted to add the branch name to my version. I started with
gitVersioning.apply {
refs {
branch('.+') {
version = '${version}-test'
}
}
}
in a repo where the current branch name is nkiesel/main/StringBuilder
, but that fails with "invalid provided ref nkiesel/main/StringBuilder - needs to start with refs/". If I replace .+
with m.+
(i.e. the pattern no longer matcheds the current branch name), ./gradew version
works and prints
Configuration on demand is an incubating feature.
> Configure project :
skip - no matching ref configuration and no rev configuration defined
git refs:
branch: nkiesel/main/StringBuilder
tags: []
defined ref configurations:
BRANCH - pattern: m.+
skip - no matching ref configuration and no rev configuration defined
...
I tried different branch names, but that does not seem to make a difference.
I used the default exemple:
version '0.0.0-SNAPSHOT'
gitVersioning.apply {
refs {
branch('.+') {
version = '${ref}-SNAPSHOT'
}
tag('v(?<version>.*)') {
version= '${ref.version}'
}
}
// optional fallback configuration in case of no matching ref configuration
rev {
version = '${commit.short}'
}
}
When building/run i got this error message:
Using ${version} in a versionFormat with any other macro results in multiple expansion.
For example, with the following configuration:
gitVersioning {
branch {
pattern = 'master'
versionFormat = '${version}'
}
branch {
pattern = 'feature/(?<user>.+)/(?<feature>.+)'
versionFormat = '${version}_${user}_${feature}'
}
}
With a project where in the root build.gradle.kts has the following:
allprojects {
version = "0.1"
}
on the master branch, version is "0.1" as expected, but on a feature branch like "features/myuser/myfeature" the version is set to "0.1_myuser_myfeature_myuser_myfeature", where I would expect it to be "0.1_myuser_myfeature"
This problem seems specific to sub-projects. For example, if in the root directory I do "gradlew version", I get "0.1_myuser_myfeature", but if I do "gradlew :subproject:version" I see "0.1_myuser_myfeature_myuser_myfeature"
When i update from 5.1.1 to 5.1.2 or 5.1.3 i get the following error:
Caused by: java.lang.NoClassDefFoundError: org/gradle/util/internal/ConfigureUtil
at me.qoomon.gradle.gitversioning.GitVersioningPluginExtension.apply(GitVersioningPluginExtension.java:66)
at me.qoomon.gradle.gitversioning.GitVersioningPluginExtension$apply.call(Unknown Source)
Hello!
Plugin version 5.1.0.
$subject :)
You can check this two commits:
develop
branch some time ago)v123
) and run ./gradlew jar
, you'll see that jar recieves name matching "branch" configuration (bsl-language-server-develop-7001455.jar
)bsl-language-server-123.jar
).It's not a big problem, but looks like a reggression compared with 4.x
I've tried setting it up but it keeps selecting main-SNAPSHOT
build.gradle.kts config: https://github.com/Kantis/ks3/blob/ee42e3cd3be08dc3c12563c8c5f04d8aa0ae0507/build.gradle.kts#L8-L20
version = "0.0.0-SNAPSHOT"
gitVersioning.apply {
refs {
// if git HEAD is attached:
branch(".+") { version = "\${ref}-SNAPSHOT" }
// if HEAD is detached:
tag("v(?<version>.*)") { version = "\${ref.version}" }
}
// optional fallback configuration in case of no matching ref configuration
rev { version = "\${commit}" }
}
Here's the GHA, trigged from a commit on the main branch: https://github.com/Kantis/ks3/actions/runs/3327175830
There is a tag, v0.0.1, on main branch https://github.com/Kantis/ks3/releases/tag/v0.0.1
However git-versioning-plugin picks the version as 'main-SNAPSHOT' https://github.com/Kantis/ks3/actions/runs/3327175830/jobs/5501672555#step:6:310
Hello
I tried to use provided example, from readme
My build.gradle.kts
looks like below
plugins {
id("org.springframework.boot") version "3.0.2-SNAPSHOT"
id("io.spring.dependency-management") version "1.1.0"
id("org.graalvm.buildtools.native") version "0.9.18"
kotlin("jvm") version "1.7.22"
kotlin("plugin.spring") version "1.7.22"
id("me.qoomon.git-versioning") version "6.3.8"
}
group = "org.example"
version = "0.0.0-SNAPSHOT"
gitVersioning.apply {
refs {
// branch(".+") {
// version = "\${ref}-SNAPSHOT"
// }
tag(".+") {
version = "\${ref}"
}
}
// optional fallback configuration in case of no matching ref configuration
// rev {
// version = "\${commit}"
// }
}
The problem is that the result during run is like below
skip - no matching ref configuration and no rev configuration defined
git refs:
branch: master
defined ref configurations:
TAG - pattern: .+
I went from the original example (including only tag("v(?<version>.+)")
), reducing it to the given form.
I am runing this in PowerShell, but in bash for git the result is the same.
Gradle is the newest - 7.6.
Java openjdk 18 (build 18+36-2087)
git describe --tags --first-parent
v0.0.6
I'm trying to use this plugin to generate different versioning for my software, mainly docker images.
When I just added the recommended configuration to my gradle plugin, I get jars with the commit.version in the name, as expected, but I don't know how I can use this same version in different tasks, mainly a copy task and to docker (plantir plugin) so I can create images with this version as the tag.
Can you just show an example on how to use the computed version, please?
I tried things, like "${version}" and it didn't work. Always refer to the version = '1.0.0' I have in the build.gradle.
Hey, thanks for publishing this project. Please say under which license can community use it.
I thought I'd make a new ticket, because my first question was more than just a quick answer and I didn't want to clog up the discussion :)
@aSemy: I am confused by this line
gradle-git-versioning-plugin/README.md
Line 112 in 41e0fea
Is it ordered by ascending priority, as in the first definition will be overridden by later definition, if they match?
@qoomon:
โน First matching configuration will be used.
from top to bottom. Does that help?
Ah I think I understand my confusion now. Does the ordering refer to just the refs {}
and rev {}
blocks? Are the contents of the refs {}
block also ordered? Because the example in the README...
refs {
branch(".+") {
version = "\${ref}-SNAPSHOT"
}
tag("v(?<version>.*)") {
version = "\${ref.version}"
}
}
To me it looks like branch(".+")
matches everything, and it's first, so the tag(...)
bit won't ever be selected.
Hello. I have problems with plugin upgrading from 3.0 to 4.0.
Gradle (kotlin dsl) can't find CommitVersionDescription
and fails on script compilation.
PR with upgrade: 1c-syntax/bsl-language-server#1544
Build logs: https://github.com/1c-syntax/bsl-language-server/pull/1544/checks?check_run_id=1977036787
build.gradle.kts: https://github.com/1c-syntax/bsl-language-server/blob/dependabot/gradle/me.qoomon.git-versioning-4.0.0/build.gradle.kts#L32-L45
Any thougts?
Hi,
how would I need to configure this plugin correctly, to be used within a monorepo with multiple applications?
The latest release 6.4.1 has a dependency on version 6.4.0.202211300538-r
of the artifact org.eclipse.jgit:org.eclipse.jgi
.
There is a security advisory for this version.
In the head this dependency is already updated to latest. I'd appreciate it if you could release a new version that includes this dependency update.
Trying to create a template repository for teams to create projects from and I'm finding that the describe.tag doesn't quite work with the placeholder default values functionality.
My configuration
version = '0.0.0-SNAPSHOT'
gitVersioning.apply {
refs {
considerTagsOnBranches = true
tag('v(?<version>.*)') {
version = '${ref.version}'
}
branch('main') {
version = '${describe.tag.version.major:-0}.${describe.tag.version.minor:-0}.${describe.tag.version.patch.next:-0}-SNAPSHOT'
}
branch('.+') {
version = '${describe.tag:-0.0.0}-${describe.distance:-1}-SNAPSHOT'
}
}
}
If there are no tags currently, this will work fine for the main branch, but I've discovered that describe.tag
will return root
instead of being replaced with 0.0.0
. It seems like it should allow for the placeholder to take over here rather than always returning root
in this case. Perhaps that was necessary before the placeholders functionality was available?
My work around is to use the following since it isn't an issue once you try to access the describe.tag.version
:
version = '0.0.0-SNAPSHOT'
gitVersioning.apply {
refs {
considerTagsOnBranches = true
tag('v(?<version>.*)') {
version = '${ref.version}'
}
branch('main') {
version = '${describe.tag.version.major:-0}.${describe.tag.version.minor:-0}.${describe.tag.version.patch.next:-0}-SNAPSHOT'
}
branch('.+') {
version = '${describe.tag.version}-${describe.distance:-1}-SNAPSHOT'
}
}
}
So perhaps just a documentation note indicating that describe.tag
will always return some value once the repository is not shallow?
Additionally this still breaks when the clone is shallow, and will result in the following:
* What went wrong:
A problem occurred evaluating root project 'develop-java-library-workflows'.
> java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.IllegalStateException: couldn't find matching tag in shallow git repository
This certainly makes sense if there were no default placeholders, and it's definitely useful to emit that no tag could be found in a shallow git repository, but it feels that with the placeholder with a default value defined that it should gracefully accept the default value instead?
This is mostly an issue with github actions/checkout and reusable workflows where not expecting to do full clones by default, nor is it straight forward to pass env vars to reusable workflows either.
For the moment I'll look at disabling or trying to make those unshallow, though I might try and automatically unshallow a clone with some scripting before the plugin applies.
I have Gradle Configuration Cache enabled. When I run ./gradlew version
I get a warning.
1 problem was found storing the configuration cache.
- Task `:version` of type `me.qoomon.gradle.gitversioning.VersionTask`: invocation of 'Task.project' at execution time is unsupported.
See https://docs.gradle.org/7.5.1/userguide/configuration_cache.html#config_cache:requirements:use_project_during_execution
This is because of the use of a Gradle Project instance during execution-time
This instance should be easy to fix by creating an @Input val projectVersion: Property<String>
that is set with a convention of the project's version - but maybe there are other usages of Project during execution time.
I am running in an issue upgrading to version 6.4.0. When creating a tag and running into CircleCI, version is resolved as UNKNOWN. However, if I downgrade to my previous version 6.3.6, the tag is resolved correctly in CircleCI. My configuration is as below.
version = "UNKNOWN"
gitVersioning.apply {
refs {
tag(".+") {
version = "\${ref}"
}
branch("master") {
version = "develop"
}
branch(".+") {
version = "\${ref}"
}
}
rev {
version = "UNKNOWN"
}
}
6.4.0 logs from build:
gather git situation from Circle CI environment variables: CIRCLE_BRANCH and CIRCLE_TAG
matching ref: COMMIT - 0032a954f455a82b45e0d611c8298d993e394a76
ref configuration: COMMIT - pattern: null
version: UNKNOWN
6.3.6 logs from build:
gather git situation from Circle CI environment variables: CIRCLE_BRANCH and CIRCLE_TAG
matching ref: TAG - 0.4.0
ref configuration: TAG - pattern: .+
version: ${ref}
set version to 0.4.0
project version: 0.4.0
is there a way to limit the generated version string?
situation:
example:
version of a branch with a verry long branchname: MY-TICKETID-123456_testing-deployment-with-a-verry-long-branch-name-SNAPSHOT
(more than 63 cahrs)
expected:
versionMaxLenght=63
result: MY-TICKETID-123456_testing-deployment-with-a-verry-lon-SNAPSHOT
(63 characters, branchname + '-SNAPSHOT')
would be awesome to have something like this :)
Hello.
If would be great if this plugin will provide a method to get computed "version" as gradle-git-version-calculator does.
I use this version to set some manifest properties.
Hi, maybe it's a good idea to add a Kotlin DSL example to the documentation.
I got it working with this setup:
build.gradle.kts
import me.qoomon.gradle.gitversioning.GitVersioningPluginExtension.VersionDescription
plugins {
id("me.qoomon.git-versioning") version "1.2.3"
}
gitVersioning {
branch(closureOf<VersionDescription> {
pattern = ".*"
versionFormat = "\${branch}-SNAPSHOT"
})
tag(closureOf<VersionDescription>{
pattern = "(?<tagVersion>[0-9].*)"
versionFormat = "\${tagVersion}"
})
}
Didn't found a better or easier to read example so far ... :-/
At the moment the version is constructed based on a static string template. The plugin will do a find/replace in the version
string for format placeholders, and replace them with existing format placeholder values.
However I would like to dynamically select the version, based on the format placeholder values. For example:
If CODEBUILD_WEBHOOK_TRIGGER
is not available, then use the 'ref' placeholder.
version = "0.0.0-SNAPSHOT"
gitVersioning.apply {
refs {
branch(".+") {
// if the env-var is unavailable, use the 'ref'
version = "\${commit.timestamp.datetime}-\${env.CODEBUILD_WEBHOOK_TRIGGER.slug:-\${ref}}"
}
}
rev { version = "\${commit.timestamp.datetime}-\${commit}" }
}
This resolves to
20220425.112958-${ref}
But I want it to be
20220425.112958-feat-add-widget
Perhaps the find/replace can be made more intelligent, but I'd recommend an alternative. Remove the string templating, and provide the git variables as parameters to the existing action.
public void branch(String pattern, Action<GitProperties, RefPatchDescription> action) {
RefPatchDescription ref = new RefPatchDescription(BRANCH, Pattern.compile(pattern));
// action.execute(ref); // don't execute immediately, evaluate it later, once the git properties are determined
this.list.add(action);
}
// when required, evaluate the version
public RefPatchDescription evaluateVersion() {
for (var Action<> action in list) {
return action.invoke(gitProperties)
}
}
(I'm not sure on the correct Action
class to use, but in this case GitProperties
would be provided as an argument and the Action
must return a RefPatchDescription
.
In build.gradle.kts
it would be used something like this
version = "0.0.0-SNAPSHOT"
gitVersioning.apply {
// List of ref configurations, ordered by priority. First matching configuration will be used.
refs {
branch(".+") { gitProperties ->
var gitRef = gitProperties.env("CODEBUILD_WEBHOOK_TRIGGER")
if (gitRef.isNullOrBlank()) gitRef = gitProperties.ref()
version = "${gitProperties.commit.timestamp.datetime}-${gitRef}"
}
}
rev { gitProperties ->
version = "${gitProperties.commit.timestamp.datetime}-${gitProperties.commit}" }
}
A quick question, rather than making a ticket just for for it, I am confused by this line
gradle-git-versioning-plugin/README.md
Line 112 in 41e0fea
Is it ordered by ascending priority, as in the first definition will be overridden by later definition, if they match?
properties.put does not set property
Steps to reproduce:
build.gradle
plugins {
id 'me.qoomon.git-versioning' version '5.1.1'
}
ext.x = 'abc'
gitVersioning.apply {
refs {
branch('.*') {
properties.put('x','cde')
}
}
}
task printProp {
doLast { println "x=$x" }
}
The output (some unimportant lines was deleted)
$ ./gradlew -i printProp
> Configure project :
....
matching ref: BRANCH - master
ref configuration: BRANCH - pattern: .*
describeTagPattern: .*
All projects evaluated.
...
> Task :printProp
....
x=abc
When the properties are set directly all is ok
plugins {
id 'me.qoomon.git-versioning' version '5.1.1'
}
ext.x = 'abc'
gitVersioning.apply {
refs {
branch('.*') {
properties = ['x':'cde']
}
}
}
task printProp {
doLast { println "x=$x" }
}
The output
> Configure project :
matching ref: BRANCH - master
ref configuration: BRANCH - pattern: .*
describeTagPattern: .*
properties: null
x - cde
properties:
set property x to cde
All projects evaluated.
> Task :printProp
x=cde
Greetings!
I have a hard time to figure out how to get the Version correctly:
are@archlinux ~/d/s/J/JSQLParser (sphinx)> git describe --tags --always --dirty=-SNAPSHOT
jsqlparser-4.5-64-g08141a35-SNAPSHOT
group = 'com.github.jsqlparser'
version = '4.5'
gitVersioning.apply {
refs {
branch('master') {
describeTagPattern = 'jsqlparser-.+(?<version>.*)'
version = '${ref}${dirty.snapshot}'
}
tag('jsqlparser-.+(?<version>.*)') {
version = '${ref.version}'
}
}
// optional fallback configuration in case of no matching ref configuration
rev {
version = '${ref}${dirty.snapshot}'
}
}
Does not match the branch
and falls back to rev
only.
I assume, that <version>
expects a x.y.z
format, while I have only a x.y
format. How can I change that?
could it be possible to add a section in the guide : How to add that to our project in Jenkins pipeline ?
I'm using jenkins in Kubernetes. We could use a maven-agent, but don't know how to package the extension in it, or maybe use a global library and call it from our pipeline.
I would like to call that script to update my pom.xml version when I receive a webhook about a new branch was created. Like that I'll be sure that all my branches doesn't have the same artifact version
Hi, I've just updated to v6.1.1 and I'm getting an error
./gradlew version -q
FAILURE: Build failed with an exception.
* What went wrong:
java.lang.UnsupportedClassVersionError: me/qoomon/gradle/gitversioning/GitVersioningPlugin has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
> me/qoomon/gradle/gitversioning/GitVersioningPlugin has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
I see this changed in this commit: 4a7d963
I've set the plugin in my buildSrc/build.gradle.kts
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
idea
`kotlin-dsl`
kotlin("jvm") version "1.6.21"
}
dependencies {
// ...
implementation("me.qoomon:gradle-git-versioning-plugin:6.1.1")
}
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = "11"
apiVersion = "1.6"
languageVersion = "1.6"
}
}
kotlin {
jvmToolchain {
(this as JavaToolchainSpec).languageVersion.set(
JavaLanguageVersion.of("11")
)
}
kotlinDslPluginOptions {
jvmTarget.set("11")
}
}
I've set similar options for the subprojects that have the Kotlin JVM plugin.
I'm not quite sure what's wrong. I've tried a few options.
I think perhaps the best thing to do is for Git Versioning Plugin to set its JVM target to 1.8, so while the plugin requires and is written with 11, it produces class files that are compatible with 1.8.
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_1_8
I'll keep investigating. I'm making this ticket in case there's something I've missed.
Update: it looks like this issue gradle/gradle#18935. Even though I specify 11 in buildSrc/build.gradle.kts
it isn't acknowledged, because Gradle uses an embedded version of Kotlin that's bugged. It might be fixed in Gradle 7.5?
Since Gradle 8.1
, any exec
command that is not done trough providers
is forgiven at configuration time:
FAILURE: Build failed with an exception.
* What went wrong:
Configuration cache problems found in this build.
2 problems were found storing the configuration cache.
- Build file 'plugin/build.gradle.kts': external process started '/opt/homebrew/bin/git --version'
See https://docs.gradle.org/8.1.1/userguide/configuration_cache.html#config_cache:requirements:external_processes
- Build file 'plugin/build.gradle.kts': external process started '/opt/homebrew/bin/git config --system --show-origin --list -z'
See https://docs.gradle.org/8.1.1/userguide/configuration_cache.html#config_cache:requirements:external_processes
See the complete report at file:///xxx/configuration-cache-report.html
> Starting an external process '/opt/homebrew/bin/git --version' during configuration time is unsupported.
> Starting an external process '/opt/homebrew/bin/git config --system --show-origin --list -z' during configuration time is unsupported.
I'm getting this error:
org/eclipse/jgit/storage/file/FileRepositoryBuilder has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
There is a problem in newly created repository where is none any tags. When I try to use ${describe.tag.version.major:-0} I receive:
matching ref: BRANCH - feature/test
ref configuration: BRANCH - pattern: feature/(?<text>.+)
describeTagPattern: v(?<version>\d+\.\d+\.\d+)
version: ${describe.tag.version.major:-0}.${describe.tag.version.minor.next:-0}.0-${ref.text.slug}
FAILURE: Build failed with an exception.
> java.lang.RuntimeException: java.lang.NullPointerException
My configuration:
gitVersioning.apply {
describeTagPattern = /v(?<version>\d+\.\d+\.\d+)/
refs {
considerTagsOnBranches = true
branch(/feature\/(?<text>.+)/) {
version = '${describe.tag.version.major:-0}.${describe.tag.version.minor.next:-0}.0-${ref.text.slug}'
}
tag(/v(?<version>\d+\.\d+\.\d+)/) {
version = 's${ref.version}'
}
branch('master|master-test') {
version = '${describe.tag}-${describe.distance}'
}
}
// optional fallback configuration in case of no matching ref configuration
rev {
version = '0.0.0'
}
}
Good to have opportunity to use default value in this case.
I'd like to use tag versioning and commit versioning as failback ( appropriate version descriptions were created in build.gradle), but as per code review repoSituation.getHeadBranch() will return 'master' on master branch, so tag branch will never be executed:
if (repoSituation.getHeadBranch() != null) {
// branch versioning
for (final VersionDescription branchVersionDescription : branchVersionDescriptions) {
Optional<String> versionBranch = Optional.of(repoSituation.getHeadBranch())
.filter(branch -> branch.matches(branchVersionDescription.getPattern()));
if (versionBranch.isPresent()) {
gitRefType = "branch";
gitRefName = versionBranch.get();
versionDescription = branchVersionDescription;
break;
}
}
} else if (!repoSituation.getHeadTags().isEmpty()) {
// tag versioning
for (final VersionDescription tagVersionDescription : tagVersionDescriptions) {
Optional<String> versionTag = repoSituation.getHeadTags().stream()
.filter(tag -> tag.matches(tagVersionDescription.getPattern()))
.max(comparing(DefaultArtifactVersion::new));
if (versionTag.isPresent()) {
gitRefType = "tag";
gitRefName = versionTag.get();
versionDescription = tagVersionDescription;
break;
}
}
}
So following calling of gradle will always use commit versioning:
$VERSIONING_GIT_TAG=1.10.1 ./gradlew :version -q
By the way, 1.2.1 was not pushed into the github repository
When at least one repository tag is lightweight, GitUtil throws an NPE on line 39. The object is peeled, but there is no peeled id.
in readme, there are provided project properties (git.commit, git.ref ...)
I use the property "git.commit" like this.
attributes "Implementation-Version": project.property("git.commit")
but after update from 4.3.0 to 5.0.0, i got this gradle error
A problem occurred evaluating root project 'test'.
> Could not get unknown property 'git.commit' for root project 'test' of type org.gradle.api.Project.
4.3.0 works well.
Hello.
Have your ever thought about placeholders with numbers after some events?
Like 5 commits after last tag in current branch
or 5 commits from "parent" branch
?
it could be usefull in feature-branches to determinate "freshness" of the build or range from main-branch. also for develop branch - to see progress from last release. and so on.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.