Carey Brown wrote:Is there a maven'ism that would allow you to specify the Java version via an environment variable?
Carey Brown wrote:I have something a bit different. Is mine correct?
Is there a maven'ism that would allow you to specify the Java version via an environment variable?
I'm not really well versed in Maven so when I ran across the plugin example I started using it. I wasn't aware of the properties short cut. Is there any advantage to using the plugin approach? Where do I find out about other property short cuts I may be missing?Stephan van Hulst wrote:
Carey Brown wrote:I have something a bit different. Is mine correct?
Sure it's fine. You just declared a project variable to hold the java version and used it to set both the source and target versions of the compiler. Note that a lot of plugin settings have a so called "user property" alias that allows you to set the property in the <properties> element without having to declare the <plugin>. I prefer the user property because it's less verbose.
Yes, I read that warning in the answer link. If I was still writing commercial code I'd agree with you 100%, but I'm retired and I'm dealing with a 100 small to middlin sized personal projects that I'm trying to keep in sync with the Java version I'm using (i.e. the latest). I still have some projects hard wired for Java 8 but mostly I want them all to use the latest. I don't know if there's a better way of dealing with this.Is there a maven'ism that would allow you to specify the Java version via an environment variable?
You've found an answer, and though I haven't reviewed it yet I can already tell you this is a really bad idea. Maven builds really really really need to be reproducible. If you check out a project 5 years after it's been installed at a customer, you still want to be able to build it without fiddling with it. Environment variables will completely mess that up.
Carey Brown wrote:Is there any advantage to using the plugin approach?
Where do I find out about other property short cuts I may be missing?
I still have some projects hard wired for Java 8 but mostly I want them all to use the latest. I don't know if there's a better way of dealing with this.
Tom Joe wrote:Which version do I set for Java 10 and above ? Is it 10 or 1.10 ? Have the tags changed for Java 10 and above ?
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
What? What, what, what? What what tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
|