I want to read few properties from a static java class file as below
class MyClass {
public static final class MyStaticClass {
public static final String PROPERTY_A = "myStringA";
public static final String PROPERTY_B = "myStringB";
}
}
This would be in MyClass.java file under
src/main/java/myProject/
I need to read PROPERTY_A
, and PROPERTY_B
in my app build.gradle inside android{} block.
Note that these need to be read from java file for a specific reason, and are not general properties. Hence, I am not reading them from gradle.properties
files.
I went through How do I call a static Java method from Gradle
but the article wasn't super clear.
I also tried gradle docs, but couldn't find a super clear answer.
I am bit new to groovy, so any suggestions here would be super helpful.
Thanks!
So, it sounds like It's not possible in the initialization part of gradle build to read static java classes from the answers so far. I decided to read it via .properties file eventually.