Is there a way to read `gradle.properties` in a pr...
# gradle
a
Is there a way to read
gradle.properties
in a project root folder from a submodule? It appears that the file must be within the submodule for it to be read
g
rootProject.properties
Actually not sure that those properties are not exposed to submodules automatically
a
I tried root project already. This is specifically for build src, so I guess it might be an independent project?
g
But build src is not a submodule at all, it’s completely different thing. buildSrc is just a separate gradle project, just by convention included to your build script classpath, so it have to be compiled before your rootProject even configured, because it’s part of build system now
So, returning to your question if we talking about sharing properties with buildSrc
In most cases you should keep any properties/configs in buildSrc, it allows you to share any classes, so no need to use dynamic properties file, so it’s a good thing
Bad thing that to configure buildSrc project itself you probably want to extract some versions to buildSrc/gradle.properties, and you of course can use it in build.gradle, settings.gradle of buildSrc, but you also want to share those versions with your main project config and there is no perfect solution. Ultimate is just read
buildSrc/gradle.properties
manually somewhere in buildSrc/src and expose it as part of build script class path (directly, or by exposing some Versions class etc)
👍 1