gradle / gradle

Adaptable, fast automation for all
https://gradle.org
Apache License 2.0
16.99k stars 4.77k forks source link

Specify project-relative path in `gradle.properties` #31391

Open Loffe opened 2 days ago

Loffe commented 2 days ago

Expected Behavior

Hi,

We need to run Gradle with a custom cacerts file with company-specific certificates, and specify this in gradle.properties. Like:

systemProp.javax.net.ssl.trustStore=gradle/cacerts
systemProp.javax.net.ssl.trustStorePassword=changeit

This works well when running Gradle from the root project directory, but breaks when invoking Gradle from a subproject directory since the JVM treats the path relative to the current working directory.

I want to be able to specify a path relative to the root project, and let Gradle expand it when reading the file. Something like this

systemProp.javax.net.ssl.trustStore=${rootProject}/gradle/cacerts
systemProp.javax.net.ssl.trustStorePassword=changeit

Would this be feasible?

I am open to contributing such a feature. I am not aware of any existing "expansions" in the properties files. Is there any similar already?

Current Behavior (optional)

No response

Context

I have tried re-setting it to an absolute path from the root build.gradle. Then it is possible to start the Gradle daemon from the root project directory, and then run commands from sub-projects, as long as the same daemon is reused. However, this leads to non-deterministic failures on occasions.

RakeshSunda commented 1 day ago

I don't want griddle.