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

\ -> / on Unix for java.io.File-typed mojo param

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • 3.0.3
    • None
    • Plugin API
    • None
    • Ubuntu 10.04, JDK 6

    Description

      I created a file /tmp/a\b/c (note backslash). I created a quickstart app with

          public static void main( String[] args )
          {
              System.out.println( System.getProperty("user.dir") );
              System.out.println(Arrays.toString(new File("").listFiles()));
          }
      

      and then run it with

      mvn -Dexec.workingdir=/tmp/a\\b "-Dexec.args=-classpath %classpath ....App" -Dexec.executable=.../java process-classes org.codehaus.mojo:exec-maven-plugin:1.2:exec -X
      

      I see

      [DEBUG] Configuring mojo 'org.codehaus.mojo:exec-maven-plugin:1.2:exec' with basic configurator -->
      [DEBUG]   (f) workingDirectory = /tmp/a/b
      [DEBUG] Making working directory '/tmp/a/b'.
      /tmp/a/b
      null
      

      where I expected to see

      [DEBUG] Configuring mojo 'org.codehaus.mojo:exec-maven-plugin:1.2:exec' with basic configurator -->
      [DEBUG]   (f) workingDirectory = /tmp/a\b
      /tmp/a\b
      [/tmp/a\b/c]
      

      I believe the guilty code is in org.codehaus.plexus.component.configurator.converters.basic.FileConverter:

      new File( str.replace( '\\', File.separatorChar ).replace( '/', File.separatorChar ) )
      

      should probably replace only / with \ and only on Windows. Not sure what compatibility regressions there might be, if some POM written by a Windows developer uses \ as the separator character for relative paths.

      Attachments

        Issue Links

          Activity

            People

              bentmann Benjamin Bentmann
              jglick Jesse N. Glick
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: