java-plain icon indicating copy to clipboard operation
java-plain copied to clipboard

Some small improvements to pom.xml

Open rmcdouga opened this issue 4 years ago • 0 comments

Thanks for this. I have something similar in a gist that I use as my minimal pom.xml file.

+1 I maintained this template locally and got the idea of sharing it on github. Now it is easier to maintain.

I have a couple of suggestions for the pom.xml:

  • If you move the java.version property up a couple of lines, you could use ${java.version} in your maven.compiler.* properties (saving duplication of the 16 number and making it easier to move to newer versions).

I thought about that and decided to publish another template for Java 17. "My" way is redundant, but easier to read. I don't think we will ever have to update the property.

  • You might want to move the versions of your dependencies into properties. The Spring does this in their pom.xml and I find it handy not to have to go looking for version numbers (since it's one of the things that gets updated the most). This would make the pom.xml a little longer (maybe making it not the "smallest possible" :)), but I think it would make it a little easier to maintain.

I like to keep the versions of plugins usw. directly in the definition. I get the best "auto-completion" that way in the IDEs. Maybe I will write a blogpost about that.

I can submit a PR if you'd like. Either way, the changes are small so if you don't think they are worth it, that's OK too.

I would like to keep the pom.xml that way for now. I don't like the declaration of maven-surefire-plugin, but it is necessary for JUnit 5...

Big thanks for your feedback and your time!

rmcdouga avatar Apr 30 '21 15:04 rmcdouga