I am using maven 3.2.2 and jdk-1.7.0_60. I am executing mvn compile for a particular project, the compilation succeeds. But when I run mvn clean install on the same component, I get the following error-
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /C:/projects/myProject/src/mainTest.java:[105,56] cannot find symbol
symbol: method getIdFromName(java.lang.String)
location: class java.lang.Object
What could be the reason behind this? Doesn't mvn compile actually compile everything? As far as I know, the only difference between mvn compile and mvn clean install is that the latter command copies the required jar.
If you take a look at the Maven Build Lifecycle, you will notice that test-compile phase goes after compile, but before install.
Since the file which fails to compile is mainTest.java, looks like this is your problem:
Doesn't
mvn compileactually compile everything?
No, it doesn't compile test sources.
I was facing same, this started when I added unit test cases, what worked for me is, first run
mvn clean install -DskipTests=true
Then again run
mvn clean install
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With