Working directory is not setup correctly when running a unit test in the child 
subproject if run from the parent's directory
----------------------------------------------------------------------------------------------------------------------------

         Key: MSUREFIRE-133
         URL: http://jira.codehaus.org/browse/MSUREFIRE-133
     Project: Maven 2.x Surefire Plugin
        Type: Bug

    Versions: 2.1.3    
 Environment: Windows XP with cygwin or Ubuntu Linux  or MacOSX 10.4.6
Java 1.5, maven 2.0.4
    Reporter: toli kuznets
 Attachments: pathBug.tar

Current working directory is not setup correctly when you run all the unit 
tests of the child module from the parent directory.

Create a maven parent project that only contains a child subproject with one 
unit test, which tries to open/create a file in the relative subdirectory of 
the current directory.

When you run the test directly from the pathBugh/subproject/ directory, then 
the test passes just fine.
If you run the test from the parent project directory, the test fails (cur. 
working directory is not setup correctly). 
If, however, the target directory already exists in child module, then 
everything works.

Reproduction:
1. open the tarball
2. run 'mvn test' from the parent directory - unit test will fail
3. you can run 'mvn test' from child project it should pass. remember to delete 
the "output" directories after you successfully run the test in the child 
subdir.

I've noticed that this bug only happens when the "releases" of Maven plugins is 
enabled in the parent POM (see the parent POM file for the truth table of 
what's necessary to get the test to fail). so it may be a failure that only 
happens in current plugin version. 
there's a mvn.out file in the attached tarball that has the debug information 
(-X) for the output of the maven test run.

This only happens under maven. When you run the same unit test with ant or 
IntelliJ it works fine.

See the attached tarball.

note: the actual error may be in any other maven plugin, but i have a feeling 
it's in the surefire/unit test setup.


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

Reply via email to