You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Andreas Dangel (Jira)" <ji...@apache.org> on 2023/05/25 09:57:00 UTC
[jira] [Created] (MNG-7795) IllegalArgumentException: 'other' has different root during plugin validation
Andreas Dangel created MNG-7795:
-----------------------------------
Summary: IllegalArgumentException: 'other' has different root during plugin validation
Key: MNG-7795
URL: https://issues.apache.org/jira/browse/MNG-7795
Project: Maven
Issue Type: Bug
Components: Core
Affects Versions: 3.9.2
Reporter: Andreas Dangel
Assignee: Andreas Dangel
Fix For: 3.9.3
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:
{code:java}
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)
{code}
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|https://github.com/jgitver/jgitver-maven-plugin], which creates a temporary pom file for the current project with the new version determined from the git status.
In [https://github.com/apache/maven/blob/c9616018c7a021c1c39be70fb2843d6f5f9b8a1c/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginValidationManager.java#L224]
{code:java}
result += " (" + rootBasedir.toPath().relativize(currentPom.toPath()) + ")"; {code}
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 ...
--
This message was sent by Atlassian Jira
(v8.20.10#820010)