Test passes in IDE, fails on command line

The tests writes stuff to a file and then reads from a file to make sure some things happen. The tests (always) pass in my IntelliJ.

When running mvn clean install, the test fails with

java.io.FileNotFoundException: log/sample1_2013-09-17.log (No such file or directory)

What could explain this consistency?


IntelliJ must be running the tests in a different working directory than in the command line.

What I would do is make sure that the command-line mvn succeeds by moving the log directory (and any other resources) to the appropriate directory. Back in IntelliJ, you can specify the working directory to be used. Use the same working directory as the working directory where mvn succeeds.

Leave a Reply

Your email address will not be published. Required fields are marked *