I just want to use maven placeholder in my Java class at compile time in order to reduce duplication.
Something like that:
pom.xml
<properties>
<some.version>1.0</some.version>
</properties>
SomeVersion.java
package some.company;
public class SomeVersion {
public static String getVersion() {
return "${some.version}"
}
}
simply create file app.properties in src/main/resources with content like this
then enable maven filtering like this
That’s all – in app code just read properties file
and provide method like this