Is there any reliable way to resolve gradle proper...
# community-support
n
Is there any reliable way to resolve gradle properties in an init script? We used to rely on
DefaultGradlePropertiesController#loadGradlePropertiesFrom
, but that moved to an internal package with gradle 9. I'd really like to avoid relying on internal classes.
v
That was probably never public api. Especially the
Default...
classes are usually just the implementation of an interface. But even the interface was moved and there is no breaking change for it recorded in the upgrade notes. It's also not listed in the old list of public API, while that also says the list is not exhaustive. 🤷‍♂️ What do you want to do with the property? Can you maybe delay whatever you want to do to later where they are already available?
This for example works from a Kotlin DSL init script:
Copy code
gradle.beforeSettings {
    val foo: String? by settings
    println(foo)
}
n
We need it to provide credentials for our repositories in order to add libraries to the classpath of the initscript itself. So there's not really any option to delay, I'm afraid.
v
Hm, that's bad then. Maybe just use plain old
Properties
if you anyway had to specify the file?
n
we didn't have to specify the file. The
From
in that method is the project's baseDir.
v
Ah, I see