Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate a better solution to running the maven plugin from a multi-module project. #103

Closed
tkvangorder opened this issue Mar 25, 2021 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@tkvangorder
Copy link
Contributor

Currently, if you add the rewrite maven plugin to the top-level pom of a multi-module project, the following error is encountered if you run mvn rewrite:fix from the top level:

[ERROR] No plugin found for prefix 'org.openrewrite.maven.rewrite' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories

Running the same command from the sub-modules works ok.

A workaround for this issue is to add the following to your maven settings file ~/.m2/settings.xml

    <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
      <pluginGroups>
        <pluginGroup>org.openrewrite.maven</pluginGroup>
      </pluginGroups>
    </settings>

The error provides this link and we should investigate a better solution.
https://cwiki.apache.org/confluence/display/MAVEN/NoPluginFoundForPrefixException

@traceyyoshima traceyyoshima self-assigned this Apr 8, 2021
@sambsnyd sambsnyd assigned aegershman and unassigned traceyyoshima Apr 12, 2021
@sambsnyd sambsnyd added the enhancement New feature or request label Apr 12, 2021
@aegershman
Copy link
Contributor

aegershman commented Apr 14, 2021

I’m shaking out “why”, but spring-cloud-config only seems to have an issue with resolving the rewrite prefix within the <module>spring-cloud-config-dependencies</module> module. If you comment it out and run rewrite:dryRun (or whatever), it’ll resolve the rewrite prefix just fine. I believe it has something to do with pluginRepository resolution and some quirkiness with the parent pom.

It’s only an issue for spring-cloud-config-dependencies, and I know it’s not isolated to just the rewrite-maven-plugin. Their use of the jacoco plugin has to be fully-qualified for spring-cloud-config-dependencies, too.

In any case, a straightforward workaround is to just use the fully-qualified goal name: ./mvnw org.openrewrite.maven:rewrite-maven-plugin:discover.

@aegershman
Copy link
Contributor

Closing for the time being. After troubleshooting and reading, I don't believe this is fundamentally an issue with how we have the rewrite-maven-plugin structured or metadata publishing 👍 Included hint about it in the docs just for reference to help folks who might run into it and how one might get unstuck if that were to happen. But I don't believe it's an issue with the plugin, I believe it's something contingent on how the pom.xml is set up.

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
None yet
Development

No branches or pull requests

4 participants