Skip to content

Conversation

timtebeek
Copy link
Member

@timtebeek timtebeek commented Apr 4, 2022

Partial fix for #66

@timtebeek
Copy link
Member Author

@tkvangorder opened a PR as suggested! :)

type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.migrate.JavaVersion11
displayName: Change Maven property java.version to 11
description: Change the Maven compiler source and target versions to 11, via Spring Boot property java.version.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was doubting to fully remove any mention of Spring here, as I'm not sure if the property is used as a convention in any other framework. So without the mention of Spring, we would also have to remove the maven compile source & target reference, as there's not guarantee it does anything at all if Spring is not present.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either way, welcome to change this as you see fit; I'll be asleep for the next few hours :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 Yeah, you are right, I guess this property is more a "spring" thing.

I think it might be safer to add all three property changes (and only make the change if the property already exists)

  • java.version
  • maven.compiler.source
  • maven.compiler.target

That will take care of the three most common use cases.

Then beyond this, Once we have added plugin/pluginManagement to the semantic model for maven, this can be converted to an imperative recipe, so we can make decisions like "if the property is not defined, add it to the top-level pom"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed a change to now also change the values of the maven compiler properties if present.

I'd be inclined to rename the recipe, displayName & description to reflect that we are changing the maven compiler source & target version, rather than any Spring/Java specific property. That's essentially what we aim to do here, with the Spring specifics just being an implementation detail for some projects.

Welcome to weigh in or make any changes to wrap this up. :)

@tkvangorder
Copy link
Contributor

Yep, I would just change the description to remove mention of "spring" and we are good to go. Thanks for your work on this.

@timtebeek
Copy link
Member Author

Ok all done; sadly just too late for the patch release, but still good to see this make it in. Would drop another manual step from my blogpost. :)

@tkvangorder
Copy link
Contributor

Good news, since I am the one doing the point release....I will just release this project again.

@tkvangorder tkvangorder merged commit 7305d5c into openrewrite:main Apr 5, 2022
@timtebeek timtebeek deleted the SpringBootJavaVersion11 branch April 5, 2022 19:46
@tkvangorder tkvangorder added the enhancement New feature or request label Apr 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants