[
http://jira.codehaus.org/browse/MNG-5035?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Benjamin Bentmann closed MNG-5035.
----------------------------------
Resolution: Not A Bug
For a little more conistency across the platforms, both forms of slashes are
treated as directory separators in our smallish Java app and I have yet to hear
a very good reason that demands the use of backslashes as ordinary filenames
(I'm sorry but "Unix supports it" is not a good reason). Jesse no offense but I
will repeat myself, Maven works as intended (btw, your proposed patch doesn't
help as it yields the very platform-specific behavior mentioned in MNG-4464
that is to be avoided).
Let me close with this example from another not uncommon build tool:
{code:xml}
<project default="test">
<property name="dir.name" value="test"/>
<target name="test">
<mkdir dir="${dir.name}"/>
</target>
</project>
{code}
{noformat}
bentmann@ubuntu:~/shared/ant$ ant -Ddir.name=foo\\baz
Buildfile: /home/bentmann/shared/ant/build.xml
test:
[mkdir] Created dir: /home/bentmann/shared/ant/foo/baz
BUILD SUCCESSFUL
Total time: 0 seconds
{noformat}
> \ -> / on Unix for java.io.File-typed mojo param
> ------------------------------------------------
>
> Key: MNG-5035
> URL: http://jira.codehaus.org/browse/MNG-5035
> Project: Maven 2 & 3
> Issue Type: Bug
> Components: Plugin API
> Affects Versions: 3.0.3
> Environment: Ubuntu 10.04, JDK 6
> Reporter: Jesse Glick
> Assignee: Benjamin Bentmann
>
> I created a file {{/tmp/a\b/c}} (note backslash). I created a quickstart app
> with
> {noformat}
> public static void main( String[] args )
> {
> System.out.println( System.getProperty("user.dir") );
> System.out.println(Arrays.toString(new File("").listFiles()));
> }
> {noformat}
> and then run it with
> {noformat}
> 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
> {noformat}
> I see
> {noformat}
> [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
> {noformat}
> where I expected to see
> {noformat}
> [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]
> {noformat}
> I believe the guilty code is in
> {{org.codehaus.plexus.component.configurator.converters.basic.FileConverter}}:
> {noformat}
> new File( str.replace( '\\', File.separatorChar ).replace( '/',
> File.separatorChar ) )
> {noformat}
> 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.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira