The questions, as written, aren’t really answerable.
Gradle is a build automation tool. You can setup a build to do whatever your application needs, but there is no scenario where the application code in src/main/java
is going to be aware of what’s in the Gradle build.
You need to define what your application needs (System properties? Command line args? Generated property files?) and then configure Gradle to provide or generate something that meets that requirement.
The build and the application are two separate contexts. The build can read / write files in the application source or provide configuration that can be passed when starting a JVM process, but they’re not going to share memory / variables like they’re a single application.