I just want to use maven placeholder in my Java class at compile time in order to reduce duplication.
Something like that:
pom.xml
If you are working with Spring, you can inject a property. The steps are:
dev
Dev Value
custom.some.version=${some.version}
...
...
package com.brand; public class CustomConfig { private String someVersion; public getSomeVersion() { return this.someVersion; } public setSomeVersion(String someVersion) { this.someVersion = someVersion; } }
package com.brand.sub public class YourLogicClass { @Autowired private CustomConfig customConfig; // ... your code }
On the final compilation, you have the correct values.