Open nmck257 opened 1 year ago
I think maybe we could predicate this on if the java.version
property exists in the resolved Maven model.
If java.version
exists and java.version
is less than the desired value, either add/update the property.
Yes, but, I'm afraid that might spam java.version
properties across multi-module projects -- can we easily check (within a visitor) whether a pom's parent is also a project file?
Good point, I think we would only want to add the java.version
to poms where the parent is either not present or not also in the list of source files. I think this is doable.
test case:
Spring Boot declares a
java.version
property, pre-wired into themaven-compiler-plugin
config. This is a convenient, common pattern to manage a project's Java version, and our recipes support updating that property if present.But, because Spring Boot provides a default value (1.8) for
java.version
, it's feasible for a Spring Boot app to have no explicit configuration for its Java version in its pom.xml. And in that case, the upgrade recipe will do everything but actually update the build's Java version. The test case above shows this.The tricky part here is deciding how generic the solution should be -- eg:
java.version
java.version
property to manage the Java version