Question

I have a fresh git clone of my Java project located at C:\dev\1234567890 (don't worry about the name yet) and commanding mvn clean compile ends with BUILD SUCCESS. How ever Maven does not compile all the classes in my project and commanding again mvn compile (without clean) compiles rest of the classes. This means that mvn clean test will fail because of missing compiled classes.

C:\dev\1234567890> mvn clean compile
...
[INFO] Compiling 708 source files to C:\dev\1234567890\target\classes
...
[INFO] ----------------------------------------------------------
[INFO] BUILD SUCCESS  
[INFO] ----------------------------------------------------------

C:\dev\1234567890>mvn compile
...
[INFO] Compiling 690 source files to C:\dev\1234567890\target\classes
...
[INFO] ----------------------------------------------------------
[INFO] BUILD SUCCESS  
[INFO] ----------------------------------------------------------

Third run will tell me that all classes are up to date.

Where things go weird. Following operations will end in a successful build (with mvn clean test).

C:\dev\1234567890>cd ..
C:\dev>mv 1234567890 12345678901
C:\dev>cd 12345678901
C:\dev\12345678901>mvn clean test
...
[INFO] --------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] --------------------------------------------------------
[INFO] Total time: 19.955s
[INFO] Finished at: Wed Dec 29 11:57:52 EET 2010
[INFO] Final Memory: 4M/58M
[INFO] --------------------------------------------------------

Then again if I change the name of the directory to the original (or to what ever 10 characters long) I will end up with BUILD FAILURE. It seems that only the length of the directory name makes a difference (everything <11 will result a build failure). Am I missing something? Any ideas? I am out of them.

mvn -version
Apache Maven 3.0.1 (r1038046; 2010-11-23 12:58:32+0200)
Java version: 1.5.0_22
Java home: C:\Program Files (x86)\Java\jdk1.5.0_22\jre
Default locale: fi_FI, platform encoding: Cp1252
OS name: "windows 7" version: "6.1" arch: "x86" Family: "windows"
Was it helpful?

Solution 2

I managed to solve my problems switching from JDK 1.5 to 1.6. But I still have no clue why it didn't work properly with JDK 1.5.

OTHER TIPS

C:\dev\1234567890> mvn clean compile
[INFO] Compiling 708 source files to C:\dev\1234567890\target\classes

C:\dev\1234567890>mvn compile
[INFO] Compiling 690 source files to C:\dev\1234567890\target\classes

One possible explanation would be that you have some maven plugin that generates Java Source code attached to the compile phase. In the first call, it would execute after the compiler and generate the sources, in the second call the sources would already be present, so the compiler would use them as well.

If you do have a plugin that generates java source, always map it to the phases generate-sources and generate-test-sources.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top