Dieter Deforce created MNG-8504:
-----------------------------------

             Summary: Maven deploy with "release-profile" fails due to 
exception in plugin validation
                 Key: MNG-8504
                 URL: https://issues.apache.org/jira/browse/MNG-8504
             Project: Maven
          Issue Type: Bug
          Components: Plugins and Lifecycle
    Affects Versions: 3.9.9, 3.9.8, 3.9.7, 3.9.6, 3.9.5, 3.9.4, 3.9.3
            Reporter: Dieter Deforce
         Attachments: build.log, release-profile-validation-bug-project.zip

Since Maven version 3.9.3 we are running into an exception when trying to 
release Maven projects with the built-in "release-profile". This bug is still 
present in 3.9.9. It only seems to happen when the plugin validation tries to 
report a warning related to the Maven deploy plugin. Instead of reporting the 
plugin warning it fails the build with the following stack trace:
 
{code:java}
[ERROR] Illegal char <:> at index 3: 
jar:file:\C:\projects\tools\apache-maven-3.9.9\lib\maven-model-builder-3.9.9.jar!\org\apache\maven\model\pom-4.0.0.xml
 java.nio.file.InvalidPathException: Illegal char <:> at index 3: 
jar:file:\C:\projects\tools\apache-maven-3.9.9\lib\maven-model-builder-3.9.9.jar!\org\apache\maven\model\pom-4.0.0.xml
     at sun.nio.fs.WindowsPathParser.normalize (WindowsPathParser.java:182)     
at sun.nio.fs.WindowsPathParser.parse (WindowsPathParser.java:153)     at 
sun.nio.fs.WindowsPathParser.parse (WindowsPathParser.java:77)     at 
sun.nio.fs.WindowsPath.parse (WindowsPath.java:92)     at 
sun.nio.fs.WindowsFileSystem.getPath (WindowsFileSystem.java:232)     at 
java.io.File.toPath (File.java:2387)     at 
org.apache.maven.plugin.internal.DefaultPluginValidationManager.pluginDeclaration
 (DefaultPluginValidationManager.java:322)     at 
org.apache.maven.plugin.internal.DefaultPluginValidationManager.reportPluginMojoValidationIssue
 (DefaultPluginValidationManager.java:203)     at 
org.apache.maven.plugin.internal.DeprecatedCoreExpressionValidator.lambda$doValidate$0
 (DeprecatedCoreExpressionValidator.java:80)     at 
java.util.stream.ForEachOps$ForEachOp$OfRef.accept (ForEachOps.java:183)     at 
java.util.stream.ReferencePipeline$3$1.accept (ReferencePipeline.java:197)     
at java.util.stream.ReferencePipeline$2$1.accept (ReferencePipeline.java:179)   
  at java.util.ArrayList$ArrayListSpliterator.forEachRemaining 
(ArrayList.java:1625)     at java.util.stream.AbstractPipeline.copyInto 
(AbstractPipeline.java:509)     at 
java.util.stream.AbstractPipeline.wrapAndCopyInto (AbstractPipeline.java:499)   
  at java.util.stream.ForEachOps$ForEachOp.evaluateSequential 
(ForEachOps.java:150)     at 
java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential 
(ForEachOps.java:173)     at java.util.stream.AbstractPipeline.evaluate 
(AbstractPipeline.java:234)     at java.util.stream.ReferencePipeline.forEach 
(ReferencePipeline.java:596)     at 
org.apache.maven.plugin.internal.DeprecatedCoreExpressionValidator.doValidate 
(DeprecatedCoreExpressionValidator.java:80)     at 
org.apache.maven.plugin.internal.AbstractMavenPluginParametersValidator.validate
 (AbstractMavenPluginParametersValidator.java:85)     at 
org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo 
(DefaultMavenPluginManager.java:570)     at 
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo 
(DefaultBuildPluginManager.java:114)     at 
org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 
(MojoExecutor.java:328)     at 
org.apache.maven.lifecycle.internal.MojoExecutor.doExecute 
(MojoExecutor.java:316)     at 
org.apache.maven.lifecycle.internal.MojoExecutor.execute 
(MojoExecutor.java:212)     at 
org.apache.maven.lifecycle.internal.MojoExecutor.execute 
(MojoExecutor.java:174)     at 
org.apache.maven.lifecycle.internal.MojoExecutor.access$000 
(MojoExecutor.java:75)     at 
org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)  
   at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute 
(DefaultMojosExecutionStrategy.java:39)     at 
org.apache.maven.lifecycle.internal.MojoExecutor.execute 
(MojoExecutor.java:159)     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:906)     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:77)     at 
jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke 
(DelegatingMethodAccessorImpl.java:43)     at java.lang.reflect.Method.invoke 
(Method.java:568)     at 
org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced 
(Launcher.java:255)     at 
org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:201)    
 at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode 
(Launcher.java:361)     at 
org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:314){code}
 
I found that the fix for issue MNG-7795 introduced this regression in the class 
DefaultPluginValidationManager. The reason the plugin validation logic throws 
this exception is because the built-in "release-profile" is defined in the 
super pom, which is not a file system resource, but a classpath resource 
defined in maven-model-builder-3.9.9.jar. When the 
DefaultPluginValidationManager detects a validation issue with a plugin then it 
tries to print the filesystem location of the pom.xml file containing the 
validation error. But the modified code in MNG-7795 tries to use the 
java.nio.file.Path API to print the path to the super pom file, which fails 
because the Path API doesn't support paths that point to resources inside of 
JAR files.
 
I have included a minimal sample project which reproduces the error when you 
execute the command 
{code:java}
mvn -X -Prelease-profile deploy{code}
 with Maven 3.9.3 or above. The build log of the build is attached as well.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to