[ http://jira.codehaus.org/browse/MNG-1711?page=all ]
Brett Porter closed MNG-1711:
-----------------------------
Assign To: Brett Porter
Resolution: Won't Fix
you can't reliably set the user.dir in java without forking. Your options:
1) don't use paths at all (use getResource[AsStream]() and resources)
2) use System.getProperty( "basedir" ) to obtain the project basedir (Maven
provides it, not portable outside Maven)
3) fork the tests (functionality yet to land, but when forked user.dir =
basedir)
> Tests Using Relative Paths Fail From Parent - Absolute Paths are Non-portable
> -----------------------------------------------------------------------------
>
> Key: MNG-1711
> URL: http://jira.codehaus.org/browse/MNG-1711
> Project: Maven 2
> Type: Bug
> Components: maven-surefire-plugin
> Versions: 2.0
> Environment: Code base and repository on Unix. Build from Windows and Unix.
> Reporter: Mike Whittemore
> Assignee: Brett Porter
>
>
> Tests in a child project fail to find files via relative path if they are run
> from a parent project, as the "basedir" of the child evaluates to the project
> where "mvn test" is run from. For example, a child project with a "test-data"
> directory in its base dir might have a unit test that loads a data file: new
> File("test-data/data1.xml"). Running "mvn test" from that child project's
> basedir works fine. If "mvn test" is run from the parent directory (which has
> no test-data directory in this example), the child project's test cannot find
> the file. This was not a problem with Maven 1. According to closed issue
> MNG-1570, this will not be fixed. One workaround is to use an aboslute path
> in the test file. Unfortunately, this instantly makes it non-portable, i.e.
> the test cannot be run from both windows and unix (as we routinely do on my
> software project). There are ugly workarounds available to the test
> develoeprs, but I request the Maven 1 behavior be added to Maven 2 so they
> are not necessary.
--
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
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]