I've written some JUnit tests and, according to how our our boss decided, these tests sit on some laptop and being run manually when needed, by someone right-clicking (in IntelliJ) the test class and "run".
Now, someone finally listened to me and picked up the tests for running automatically, in the build system... However, this way we've found out that the tests don't even compile from command line!
On the same machine, which has only one JDK installed - Oracle JDK-8 (and I guess the JBR that comes with IntelliJ), IntelliJ reports no problems when editing the code, nor when compiling and running the code successfully... But when I use IntelliJ's terminal: mvn test -Pmytests - it complains about some missing packages (and stops the build):
[ERROR] /C:/.../soaptest/customhttp/HttpSoapConnection.java:[3,43] package com.sun.xml.internal.messaging.saaj does not exist
I want to know what is it that IntelliJ knows, that Maven doesn't? I try to keep the configuration as same as possible between Maven and IntelliJ. So, that we don't have any craziness like this and things work even without the IDE... Actually, my project is super simple... Pretty sure everything in IntelliJ is just the defaults.
I am sorry I don't know exactly what more to share with you, I have no idea what could be the difference. If someone suggests things to check, I will update! :)
- Oh, one idea that I have: I looked into the resulting "run configuration" that IntelliJ creates when rightclick-run-ing the class and I see it does
-cp mymodule- is that something I need to configure in the pom.xml file?
Update: Since the classes I am having trouble to compile are linked to each other, I've been unable to show just "one" class in my reproducible example. Instead, I've hugely cut down the project and uploaded here: https://github.com/DraxDomax/intellijmaven
To reproduce (requires JDK8):
1] Open in IntelliJ and right-click on the src/test/java/com/nominet/qa/proto/SoapProtoTest.java and then "run"
= This will run a test that will fail - but notice that the method gets executed because it compiled...
2] Delete the target folder
3] In the command line (I used the IDEA Terminal), type: mvn test -Psurefiredemo
= Notice now the test doesn't even get run and you get compilation errors!



