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

rewrite-maven-plugin:4.17.0-SNAPSHOT:dryRun failed.: NullPointerException #269

Closed
ruben-garciapariente opened this issue Dec 15, 2021 · 2 comments · Fixed by #270
Closed
Assignees
Labels
bug Something isn't working
Milestone

Comments

@ruben-garciapariente
Copy link

Hello:

This error happens with version 4.17.0-SNAPSHOT of rewrite-maven-plugin but does not occur with version 4.16.0.

I'm using the recipe

recipeList:
  - org.openrewrite.maven.AddDependency:
      groupId: com.google.guava
      artifactId: guava
      version: 29.X
      onlyIfUsing: org.junit.jupiter.api.*
      versionPattern: -jre

I have in my setting.xml the activeByDefault enabled

<profiles>
    <profile>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>

If I try to execute the plugin I have the next error

λ mvn rewrite:dryRun
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------< com.test.project:test-openrewrite >------------------
[INFO] Building Test 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] >>> rewrite-maven-plugin:4.17.0-SNAPSHOT:dryRun (default-cli) > process-test-classes @ test-openrewrite >>>
[INFO]
[INFO] --- maven-resources-plugin:2.7:resources (default-resources) @ test-openrewrite ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ test-openrewrite ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.7:testResources (default-testResources) @ test-openrewrite ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\n129586\workspace\test-openrewrite\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ test-openrewrite ---
[INFO] No sources to compile
[INFO]
[INFO] <<< rewrite-maven-plugin:4.17.0-SNAPSHOT:dryRun (default-cli) < process-test-classes @ test-openrewrite <<<
[INFO]
[INFO]
[INFO] --- rewrite-maven-plugin:4.17.0-SNAPSHOT:dryRun (default-cli) @ test-openrewrite ---
[INFO] Using active recipe(s) [com.yourorg.AddDependencyExample]
[INFO] Using active styles(s) []
[INFO] Validating active recipes...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  56.119 s
[INFO] Finished at: 2021-12-15T15:35:29+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.openrewrite.maven:rewrite-maven-plugin:4.17.0-SNAPSHOT:dryRun (default-cli) on project test-openrewrite: Execution default-cli of goal org.openrewrite.maven:rewrite-maven-plugin:4.17.0-SNAPSHOT:dryRun failed.: NullPointerException -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

but if I comment activation node in settings.xml all works ok

<profiles>
    <profile>
        <!--<activation>
            <activeByDefault>true</activeByDefault>
        </activation>-->

To repeat the problem, the following code can be executed https://github.com/ruben-garciapariente/test-openwrite/tree/maven-system-property but it is also necessary to add to the settings.xml the activeByDefault node

Many thanks and regards

@aegershman aegershman self-assigned this Dec 15, 2021
@aegershman aegershman added the bug Something isn't working label Dec 15, 2021
@aegershman
Copy link
Contributor

Thanks @ruben-garciapariente taking a look 👍

@aegershman
Copy link
Contributor

aegershman commented Dec 15, 2021

(I forgot the keyword "fixes" would close this issue, apologies).

@ruben-garciapariente The fix is now available in latest snapshot; could you try this out again and @ me if it still has a null pointer? This should be good to go. Thanks for logging this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants