gradle-semantic-build-versioning
gradle-semantic-build-versioning copied to clipboard
build exception - Cannot invoke method split() on null object
Running,
------------------------------------------------------------
Gradle 7.4.2
------------------------------------------------------------
Build time: 2022-03-31 15:25:29 UTC
Revision: 540473b8118064efcc264694cbcaa4b677f61041
Kotlin: 1.5.31
Groovy: 3.0.9
Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM: 18.0.1.1 (Homebrew 18.0.1.1+0)
OS: Mac OS X 12.5 aarch64
in settings.gradle I have,
...
buildscript {
repositories {
...
}
dependencies {
classpath 'io.alcide:gradle-semantic-build-versioning:4.2.2'
}
}
apply plugin: "io.alcide.gradle-semantic-build-versioning"
...
and in my code repo i have a tag,
git tag
0.1.0
but when i run
./gradlew build
I get a build failure,
./gradlew build --stacktrace
FAILURE: Build failed with an exception.
* What went wrong:
Cannot invoke method split() on null object
* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Exception is:
java.lang.NullPointerException: Cannot invoke method split() on null object
at net.vivin.gradle.versioning.VersionUtils.incrementVersion(VersionUtils.groovy:227)
Had the same issue yesterday but managed to fix it by pruning local tags that didn't exist on remote: git fetch origin --prune --prune-tags
Saw this issue again today - on a different repo but couldn't remember how i fixed it previously 😭
- Exception is: java.lang.NullPointerException: Cannot invoke method split() on null object at net.vivin.gradle.versioning.VersionUtils.incrementVersion(VersionUtils.groovy:227)
As a reminder of the problem (in our case at least) and how to ~~remedy~~ bodge it,
- i've cloned a repo that uses the plugin.
- on the main branch; git reports one existing tag.
% git tag
0.1.0
- via
settings.gradlewe include the plugin. - in
semantic-build-versioning.gradlethere is the autobump property and instructions; there is also an entrystartingVersion = '0.1.0'. - At this point the build is failing ... but add a new local tag to the repo,
git tag -a 0.1.1and then it builds ok... 😕 - I don't really want the tag
0.1.1but if i remove it, the problem recurs 😒