This build.gradle
file tells me it could not find the getVersionNumber() method whic is indeed defined. I am baffled.
apply plugin: 'maven-publish'
group = "org.random"
publishing {
publications {
docs(MavenPublication) {
artifact(new File("build.gradle"))
}
}
}
task getVersionNumber {
doLast {
return 42
}
}
task setVersionTask() {
doLast {
project.version = getVersionNumber()
}
}
publishToMavenLocal.dependsOn setVersionTask
Execute: gradle publishToMavenLocal
. Gives:
$ gradle publishToMavenLocal
:generatePomFileForDocsPublication
:publishDocsPublicationToMavenLocal
:setVersionTask FAILED
FAILURE: Build failed with an exception.
* Where:
Build file '/mnt/homes/home/martin/tmp/gradle-method-not-found/build.gradle' line: 17
* What went wrong:
Execution failed for task ':setVersionTask'.
> Could not find method getVersionNumber() for arguments [] on task ':setVersionTask'.
Using Gradle 2.3.