Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
3.9.2
-
None
Description
This bug happens under Windows only and is the reason, why one IT (MPMD-323-ruleset-basedir-jgitver) is failing for m-pmd-p with the following exception:
java.lang.IllegalArgumentException: 'other' has different root
at sun.nio.fs.WindowsPath.relativize (WindowsPath.java:404)
at sun.nio.fs.WindowsPath.relativize (WindowsPath.java:42)
at org.apache.maven.plugin.internal.DefaultPluginValidationManager.pluginOccurrence (DefaultPluginValidationManager.java:224)
at org.apache.maven.plugin.internal.DefaultPluginValidationManager.reportPluginValidationIssue (DefaultPluginValidationManager.java:111)
at org.apache.maven.plugin.internal.PlexusContainerDefaultDependenciesValidator.doValidate (PlexusContainerDefaultDependenciesValidator.java:49)
at org.apache.maven.plugin.internal.AbstractMavenPluginDependenciesValidator.validate (AbstractMavenPluginDependenciesValidator.java:50)
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo (DefaultMavenPluginManager.java:560)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:114)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:342)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:330)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:175)
at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:76)
at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:163)
at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:160)
at org.apache.maven.lifecycle.internal.MojoExecutor.executeForkedExecutions (MojoExecutor.java:462)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:325)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:175)
at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:76)
at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:163)
at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:160)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:910)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
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:283)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348)
E.g. see GitHub Actions: https://github.com/apache/maven-pmd-plugin/actions/runs/5024694265 (unfortunately without a stack trace)
This IT uses the extension jgitver-maven-plugin, which creates a temporary pom file for the current project with the new version determined from the git status.
result += " (" + rootBasedir.toPath().relativize(currentPom.toPath()) + ")";
rootBaseDir is e.g. "X:\maven-pmd-plugin\target\it\MPMD-323-ruleset-basedir-jgitver" and currentPom is e.g. "C:\Users\adang\AppData\Local\Temp". Using relativize here leads to "IllegalArgumentException: 'other' has different root".
Doesn't happen on Linux/Mac as there is only one filesystem root.
We probably should check with currentPom.getPath().startsWith(rootBasedir.getPath()) before relativizing it (similar to the method pluginDeclaration() above).
I'll try to create a PR for this.
FYI cstamas - as you are working on MNG-7791 ...