I am trying to put the app name in the gradle.properties file, located in the root directory of the project.
artifactId = app-name
However, when I try to access the value in the settings.gradle I get the error in the title.
The goal is to use the same app name value in both my gradle configuration as well as my Jenkinsfile. Accessing the rootProject.name from Jenkinsfile always includes single quotes around the string 'app-name'
but I want an uncomplicated way to get the value without single quotes app-name
. My solution was to add the app name to the gradle.properties file because I can access gradle properties without the single quotes surrounding them. The only issue is that now I can't access gradle properties from settings.gradle
Here is what I tried
rootProject.name = project.properties['artifactId']
I have also tried using findProperty(), but I get the same error.
rootProject.name = project.findProperty('artifactId')
If you're in Groovy, Gradle properties are available directly in the script, so try:
rootProject.name = artifactId
In Kotlin, the settings
(or project
) object is a delegate for these properties, so you can write:
val artifactId: String by settings
rootProject.name = artifactId