Hi lords and ladies!

I try to get my head around the ticket MASSEMBLY-775.
It is related to MASSEMBLY-746 and MASSEMBLY-665.

The problem is basically that a reference to <dest>/somedirectory</dest> is 
interpreted as absolute path on *nix and as relative path on Win*.

And sometimes we have code of the form

 File destDir = new File(dest);
 if (! destDir.isAbsolute()) {
   destDir = new File(basedir destDir); 
 }

And thus we treat e.g. <dest>/src/test/my.txt</dest> as relative to 
${project.basedir} on Windows but as an absolute path in OSX and Linux for 
example. But Maven projects should by default be perfectly portable on 
different operating systems.

It get's a bit more complicated when also taking mingw and cygwin into 
consideration.

I wrote a tiny class and tested it on multiple systems. 

public class Test {
   public static void main(String[] args) {
       java.lang.System.out.println("path: " + new 
java.io.File(args[0]).getAbsolutePath());
   }
}

Feeding /test as parameter gives the following values:
OSX: /test
Linux: /test
Windows CMD: c:\test
Windows mingw: c:\opt\GIT\test    <- a bit unexpected tbh...
Windows Powershell: c\test

I don't have cygwin at hand. Anyone?

It looks like using / as detector for an absolute file *in addition* to 
File#isAbsolute() would be the most porbable way to handle it?
At least if we otherwise concat it to our basedir like we did in 
maven-assembly-plugin.

Wdyt?

LieGrue,
strub



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org

Reply via email to