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

new URI( url.toString() ) when using a jar path with a space in it results in error

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 3.0-alpha-1
    • Fix Version/s: 3.0-alpha-1
    • Component/s: POM
    • Labels:
      None

      Description

      When maven.home contains a space, reading the super-POM from the maven-project jar results in:

      Error stacktrace:
      org.apache.maven.reactor.MavenExecutionException: Error scanning for extensions: Error building super-POM for retrieving the default remote repository list: Failed build model from URL 'jar:file:/c:/Program Files/maven2.1/bin/../lib/maven-project-2.1-SNAPSHOT.jar!/org/apache/maven/project/pom-4.0.0.xml'
      Error: 'Illegal character in opaque part at index 20: jar:file:/c:/Program Files/maven2.1/bin/../lib/maven-project-2.1-SNAPSHOT.jar!/org/apache/maven/project/pom-4.0.0.xml' for project org.apache.maven:super-pom
      at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:286)
      at org.apache.maven.DefaultMaven.createReactorManager(DefaultMaven.java:109)
      at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:166)
      at org.apache.maven.embedder.MavenEmbedder.execute(MavenEmbedder.java:784)
      at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:179)
      at org.apache.maven.cli.MavenCli.main(MavenCli.java:71)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
      at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
      at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:408)
      at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:351)
      Caused by: org.apache.maven.extension.ExtensionScanningException: Error building super-POM for retrieving the default remote repository list: Failed build model from URL 'jar:file:/c:/Program Files/maven2.1/bin/../lib/maven-project-2.1-SNAPSHOT.jar!/org/apache/maven/project/pom-4.0.0.xml'
      Error: 'Illegal character in opaque part at index 20: jar:file:/c:/Program Files/maven2.1/bin/../lib/maven-project-2.1-SNAPSHOT.jar!/org/apache/maven/project/pom-4.0.0.xml' for project org.apache.maven:super-pom
      at org.apache.maven.extension.DefaultBuildExtensionScanner.getInitialRemoteRepositories(DefaultBuildExtensionScanner.java:357)
      at org.apache.maven.extension.DefaultBuildExtensionScanner.scanInternal(DefaultBuildExtensionScanner.java:109)
      at org.apache.maven.extension.DefaultBuildExtensionScanner.scanForBuildExtensions(DefaultBuildExtensionScanner.java:81)
      at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:282)
      ... 13 more
      Caused by: org.apache.maven.project.ProjectBuildingException: Failed build model from URL 'jar:file:/c:/Program Files/maven2.1/bin/../lib/maven-project-2.1-SNAPSHOT.jar!/org/apache/maven/project/pom-4.0.0.xml'
      Error: 'Illegal character in opaque part at index 20: jar:file:/c:/Program Files/maven2.1/bin/../lib/maven-project-2.1-SNAPSHOT.jar!/org/apache/maven/project/pom-4.0.0.xml' for project org.apache.maven:super-pom
      at org.apache.maven.project.DefaultMavenProjectBuilder.readModel(DefaultMavenProjectBuilder.java:1073)
      at org.apache.maven.project.DefaultMavenProjectBuilder.getSuperModel(DefaultMavenProjectBuilder.java:1281)
      at org.apache.maven.project.DefaultMavenProjectBuilder.buildStandaloneSuperProject(DefaultMavenProjectBuilder.java:228)
      at org.apache.maven.extension.DefaultBuildExtensionScanner.getInitialRemoteRepositories(DefaultBuildExtensionScanner.java:353)
      ... 16 more
      Caused by: java.net.URISyntaxException: Illegal character in opaque part at index 20: jar:file:/c:/Program Files/maven2.1/bin/../lib/maven-project-2.1-SNAPSHOT.jar!/org/apache/maven/project/pom-4.0.0.xml
      at java.net.URI$Parser.fail(URI.java:2809)
      at java.net.URI$Parser.checkChars(URI.java:2982)
      at java.net.URI$Parser.parse(URI.java:3019)
      at java.net.URI.<init>(URI.java:578)
      at org.apache.maven.project.DefaultMavenProjectBuilder.readModel(DefaultMavenProjectBuilder.java:1062)
      ... 19 more

      This is because URI instances cannot contain spaces, and the following code is used to translate this jar path into a URI:

      uri = new URI( url.toString() ); //DefaultMavenProjectBuilder.readModel(String, URL, boolean): Model (revId: 587777)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jdcasey John Dennis Casey
                Reporter:
                jdcasey John Dennis Casey
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: