Skip to content

UpgradePluginVersion does not support pluginRepositories #5065

Open
@froque

Description

What version of OpenRewrite are you using?

I am using

  • Maven/Gradle plugin v6.1.4

How are you running OpenRewrite?

I am using the Maven plugin, and my project is a single module project.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.example</groupId>
    <artifactId>openrewrite-upgrade-plugin-demo</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>io.quarkus</groupId>
                <artifactId>quarkus-maven-plugin</artifactId>
                <version>3.14.0</version>
            </plugin>
        </plugins>
    </build>

    <!-- Works with Maven, does not work with UpgradePluginVersion -->
    <pluginRepositories>
        <pluginRepository>
            <id>redhat-ga</id>
            <url>https://maven.repository.redhat.com/ga/</url>
        </pluginRepository>
    </pluginRepositories>

    <!-- Does not work with Maven, works with UpgradePluginVersion -->
<!--
    <repositories>
        <repository>
            <id>redhat-ga</id>
            <url>https://maven.repository.redhat.com/ga/</url>
        </repository>
    </repositories>
-->
</project>

What is the smallest, simplest way to reproduce the problem?

rewrite.yml

type: specs.openrewrite.org/v1beta/recipe
name: QuarkusMavenPluginUpgradeVersion
recipeList:
  - org.openrewrite.maven.UpgradePluginVersion:
      groupId: io.quarkus
      artifactId: quarkus-maven-plugin
      newVersion: 3.15.3.redhat-00002
JAVA_HOME=/usr/lib/jvm/java-1.17.0-openjdk-amd64 \
  /opt/maven/apache-maven-3.9.9/bin/mvn \
      org.openrewrite.maven:rewrite-maven-plugin:6.1.4:run \
        -Drewrite.configLocation=rewrite.yml \
        -Drewrite.activeRecipes=QuarkusMavenPluginUpgradeVersion

What did you expect to see?

I expected openrewrite to be able to upgrade the plugin version when using pluginRepositories.

What did you see instead?

Openrewrite UpgradePluginVersion recipe only upgrades the plugin if the repository is defined in repositories.

What is the full stack trace of any errors you encountered?

N/A

Are you interested in contributing a fix to OpenRewrite?

Yes, but the code involved seems complex.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    • Status

      Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions