Skip to content

Upgrade maven-compiler-plugin version + handle source/target configuration #37

@aegershman

Description

@aegershman

Can log handling the configuration of source/target to release as a separate issue from bumping the plugin version itself.

This may be tricky because there are variations on this; e.g., some folks having their <configuration> keyed with <source> + <target>, some using <release>, people using Spring Boot can use <java.version>, etc.

Generally, though, something to the effect of:

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.6.1</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>

going to

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.1</version>
        <configuration>
            <release>11</release>
        </configuration>
      </plugin>

Possibly a problem for upstream rewrite-- plugins under the groupId org.apache.maven.plugins do not always have their groupId explicitly declared in a user's pom.xml; declaring them are optional. They are considered part of the default pom. It appears doing UpgradePluginVersion (or any other plugin-related recipe) on a groupId/artifactId such as org.apache.maven.plugins/maven-compiler-plugin only works if a user has the groupId explicitly declared. Can log this separately.

Pasting for convenience:

  - org.openrewrite.maven.UpgradePluginVersion:
      groupId: org.apache.maven.plugins
      artifactId: maven-compiler-plugin
      newVersion: 3.8.x

Metadata

Metadata

Assignees

No one assigned

    Labels

    recipeRecipe requested

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions