Using Maven, is it possible to override a Java constant?
Imagine I have
public static final String buildBy="Eclipse";
which when using Maven shall be changed to
public static final String buildBy="Maven";
Is that possible? Thanks :-)
Yes this is possible with filters. But you'd have to put the file under your resource directory. You could put the java file under the resource directory, but a much better way would be to extract the value into a property file, put that file under resources and have maven filter the property file.
The other possibility is to use the templating maven plugin which can be used to fulfill such purposes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With