Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-7795

IllegalArgumentException: 'other' has different root during plugin validation

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.9.2
    • 3.9.3, 4.0.0-alpha-7, 4.0.0
    • Core
    • 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.

       

      In https://github.com/apache/maven/blob/c9616018c7a021c1c39be70fb2843d6f5f9b8a1c/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginValidationManager.java#L224

      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 ...

       

      Attachments

        Activity

          People

            adangel Andreas Dangel
            adangel Andreas Dangel
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: