You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Gabriel Falkenberg (JIRA)" <ji...@codehaus.org> on 2010/11/12 15:06:03 UTC

[jira] Commented: (SUREFIRE-219) Tests Using Relative Paths Fail From Parent - Absolute Paths are Non-portable

    [ http://jira.codehaus.org/browse/SUREFIRE-219?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=242895#action_242895 ] 

Gabriel Falkenberg commented on SUREFIRE-219:
---------------------------------------------

I understand why this cannot be fixed but I would like the documentation to highlight this fact preferably somewhere here: http://maven.apache.org/plugins/maven-surefire-plugin/test-mojo.html#forkMode Something along the lines:

Please note that choosing "never" or "none" will limit the ability to work with relative file paths, in modules of a multi module project, because of a limitation of the JVM: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4117557

> Tests Using Relative Paths Fail From Parent - Absolute Paths are Non-portable
> -----------------------------------------------------------------------------
>
>                 Key: SUREFIRE-219
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-219
>             Project: Maven Surefire
>          Issue Type: Bug
>         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