maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jesse Glick (JIRA)" <j...@codehaus.org>
Subject [jira] Commented: (MNG-5035) \ -> / on Unix for java.io.File-typed mojo param
Date Mon, 07 Mar 2011 18:44:24 GMT

    [ http://jira.codehaus.org/browse/MNG-5035?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=259154#action_259154
] 

Jesse Glick commented on MNG-5035:
----------------------------------

Right, this is in direct conflict with MNG-4464. Versionable files ought to be using forward
slashes (as in URLs) for all relative paths but some presumably are not.

I found Ant's behavior to be documented, though just barely. Is Maven's behavior documented
anywhere? http://maven.apache.org/guides/mini/guide-configuring-plugins.html#Mapping_Simple_Objects
does not talk about File-valued properties except to give a single example. I would expect
to see separators discussed. I would also expect to see what Maven does with relative paths
- {{FileConvertor.fromString}} would imply they are resolved against CWD, whereas experimentation
seems to say they are resolved against basedir (as in Ant).

> \ -> / 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

        

Mime
View raw message