James Raitsev
James Raitsev

Reputation: 96391

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?

Upvotes: 3

Views: 2693

Answers (1)

rgettman
rgettman

Reputation: 178263

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.

Upvotes: 2

Related Questions