This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
STR: 1) Create a maven project. 2) Write a JUnit test: public class MyTest extends TestCase { @Override protected void setUp() throws Exception { System.out.println("Current workdir: " + System.getProperty("user.dir")); } } 3) Set the project's working directory to something else than project's dir: File -> Project properties... Run -> Working directory 4) Run the test: Run -> Test file 5) The test will print project's base dir as CWD. So, the Working dir does not apply for Surefire's actions. It would be nice to have this working. Even better would be if user could override it for specific Action - i.e.: File -> Project properties... Actions -> ... When the POM has Surefire's workingDirectory property set, it would be also overriden if user set's it in NetBeans.
Actually, it might be Surefire's bug. I've tried to modify workingDirectory by hand and run the goal from a console, and I can't get it working, either.
The Run panel only customizes the actual Run action, which is an IDE-managed use of exec:exec. To adjust CWD for Surefire, use e.g. <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.7.2</version> <configuration> <workingDirectory>${java.io.tmpdir}</workingDirectory> </configuration> </plugin> </plugins> </build>