You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As part of this investigation openrewrite/rewrite-testing-frameworks#20, discovered using rewrite libs 6.1.5, maven plugin 2.4.1 on spring-cloud-netflix's "spring-cloud-netflix-eureka-server" module. The same thing would probably happen with any of the modules in the project.
The directory structure looks like this:
spring-cloud-netflix <- This folder contains the parent pom defining the modules
| pom.xml <- The "relative" path to this pom comes out as an absolute path
\ spring-cloud-netflix-eureka-server <- Maven is being invoked from this folder
| pom.xml <- This is the pom where parsing produces the NPE
Stack trace:
java.lang.NullPointerException
at org.openrewrite.maven.internal.MavenDownloader.lambda$download$3 (MavenDownloader.java:171)
at java.util.Optional.map (Optional.java:265)
at org.openrewrite.maven.internal.MavenDownloader.download (MavenDownloader.java:168)
at org.openrewrite.maven.internal.RawMavenResolver.processParent (RawMavenResolver.java:327)
at org.openrewrite.maven.internal.RawMavenResolver.processTask (RawMavenResolver.java:117)
at org.openrewrite.maven.internal.RawMavenResolver.resolve (RawMavenResolver.java:101)
at org.openrewrite.maven.internal.RawMavenResolver.resolve (RawMavenResolver.java:78)
at org.openrewrite.maven.MavenParser.lambda$parseInputs$1 (MavenParser.java:71)
at java.util.stream.ReferencePipeline$3$1.accept (ReferencePipeline.java:195)
at java.util.ArrayList$ArrayListSpliterator.forEachRemaining (ArrayList.java:1654)
at java.util.stream.AbstractPipeline.copyInto (AbstractPipeline.java:484)
at java.util.stream.AbstractPipeline.wrapAndCopyInto (AbstractPipeline.java:474)
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential (ReduceOps.java:913)
at java.util.stream.AbstractPipeline.evaluate (AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.collect (ReferencePipeline.java:578)
at org.openrewrite.maven.MavenParser.parseInputs (MavenParser.java:74)
at org.openrewrite.Parser.parse (Parser.java:38)
at org.openrewrite.maven.AbstractRewriteMojo.listChanges (AbstractRewriteMojo.java:155)
at org.openrewrite.maven.RewriteWarnMojo.execute (RewriteWarnMojo.java:31)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
PathrelativePomPath = Paths.get(pom.getSourcePath())
.getParent() // "relativeTo" the directory containing this pom
.resolve(Paths.get(relativePath, "pom.xml"))
.normalize();
The relative path of the pom is just "pom.xml". Paths.get("pom.xml").getParent() returns null. null.resolve() therefore throws the NPE.
This situation appears to be the result of, or at least adjacent to, mismatched assumptions between the Maven Plugin and the Maven Parser.
Since maven is being invoked from with the spring-cloud-netflix/spring-cloud-netflix-eureka-server folder, that's the "root" folder for path relativization. But the logic in the parser seems to assume it would be invoked from spring-cloud-netflix.
And our plugin has to be invoked from within spring-cloud-netflix-eureka-server. Trying to run it from the root produces a message like this:
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] spring-cloud-netflix-dependencies .................. SKIPPED
[INFO] Spring Cloud Netflix ............................... SKIPPED
[INFO] Spring Cloud Netflix Eureka Client ................. SKIPPED
[INFO] Spring Cloud Netflix Eureka Server ................. SKIPPED
[INFO] Spring Cloud Starter Netflix Eureka Client ......... SKIPPED
[INFO] Spring Cloud Starter Netflix Eureka Server ......... SKIPPED
[INFO] Spring Cloud Netflix Eureka Client TLS Tests ....... SKIPPED
[INFO] Spring Cloud Netflix Docs .......................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.622 s
[INFO] Finished at: 2020-12-11T13:59:11-08:00
[INFO] Final Memory: 22M/97M
[INFO] ------------------------------------------------------------------------
[ERROR] No plugin found for prefix 'rewrite' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (/mnt/c/Users/Samuel.000/.m2/repository), spring-snapshots (https://repo.spring.io/libs-snapshot-local), spring-milestones (https://repo.spring.io/libs-milestone-local), spring-releases (https://repo.spring.io/release), central (https://repo.maven.apache.org/maven2)] -> [Help 1]
The text was updated successfully, but these errors were encountered:
As part of this investigation openrewrite/rewrite-testing-frameworks#20, discovered using rewrite libs 6.1.5, maven plugin 2.4.1 on spring-cloud-netflix's "spring-cloud-netflix-eureka-server" module. The same thing would probably happen with any of the modules in the project.
The directory structure looks like this:
Stack trace:
This is the NPE-producing expression in question.
The relative path of the pom is just "pom.xml".
Paths.get("pom.xml").getParent()
returnsnull
.null.resolve()
therefore throws the NPE.This situation appears to be the result of, or at least adjacent to, mismatched assumptions between the Maven Plugin and the Maven Parser.
Since maven is being invoked from with the spring-cloud-netflix/spring-cloud-netflix-eureka-server folder, that's the "root" folder for path relativization. But the logic in the parser seems to assume it would be invoked from spring-cloud-netflix.
And our plugin has to be invoked from within spring-cloud-netflix-eureka-server. Trying to run it from the root produces a message like this:
The text was updated successfully, but these errors were encountered: