gradle-git-properties
gradle-git-properties copied to clipboard
Error trying to set a custom resources dir using `gitPropertiesResourceDir` config
I just got and error trying to set a custom resources dir using gitPropertiesResourceDir
config:
org.gradle.api.GradleScriptException: A problem occurred evaluating root project.
Caused by: java.lang.IllegalArgumentException: Cannot set the value of extension 'gitProperties' property 'gitPropertiesResourceDir' of type org.gradle.api.file.Directory using an instance of type org.codehaus.groovy.runtime.GStringImpl.
I'm using gradle 7
Regards.
It is always very helpful to provide zero context but the plain error message, now everyone can pull out their crystal balls and guess what you did, try to reproduce and supply numerous solutions that all don't work because they guessed wrong...
The error message says you tried to assign a GString to a Directory, i would try to assign a Directory instead.
@sodevel Error trying to set a custom resources dir using gitPropertiesResourceDir config
. Not sure what context do we need explain when setting a config value not working. Also I've mentioned that I'm using gradle 7.
I'm only trying what docs says:
And the error that it cause is the displayed above. So seems we need fix docs.
Pdta.
I've fixed it changing as following:
gitPropertiesResourceDir = file("${project.rootDir}/my-generated/resources-dir")
@eriknyk You are right, the doc is out of date and should be fixed.
In a recent commit, type of gitPropertiesResourceDir
has been changed but README was not updated
Docs should also be updated for setting dotGitDirectory
property, i.e.:
dotGitDirectory = file("${project.rootProject.rootDir}/.git")
Works well with just string like gitPropertiesResourceDir = "${project.rootDir}/src/main/resources"
for Gradle 6.8, but need to use gitPropertiesResourceDir = file("${project.rootDir}/src/main/resources")
for Gradle 7.x.
Same for dotGitDirectory
For Kotlin DSL:
configure<com.gorylenko.GitPropertiesPluginExtension> {
(gitPropertiesResourceDir as DirectoryProperty).set(file("${project.rootDir}/some/path"))
}