Uploaded image for project: 'Maven Wrapper'
  1. Maven Wrapper
  2. MWRAPPER-114

Maven wrapper relative distributionUrl does not work on Windows

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Normal
    • Resolution: Unresolved
    • 3.2.0
    • None
    • Maven Wrapper Jar
    • None
    • Windows

    Description

      If Maven Wrapper is used with a relative distributionUrl on Windows then an error message indicating invalid path characters is shown.

       

      # Directory structure 
      ./mvnw
      ./mvnw.cmd
      ./.mvn/wrapper/maven-wrapper.jar
      ./.mvn/wrapper/maven-wrapper.properties
      ...
      # maven-wrapper.properties
      distributionUrl=apache-maven-3.8.8-bin.zip
      wrapperUrl=maven-wrapper.jar

      When run

      ./mvnw
      
      ...
      java.nio.file.InvalidPathException: Illegal char <:> at index 2: /C:/some-path/apache-maven-3.8.8.zip 

      This is caused by PathAssembler.java:getBaseName unnecessarilly stringifying the distibution URL. The fix is as follows

          private String getBaseName(URI distUrl) {
      -       return Paths.get(distUrl.getPath()).getFileName().toString();
      +       return Paths.get(distUrl).getFileName().toString();
          }

       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              danishcake Edward Woolhouse
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: