Mysterious javac behavior: linux vs. windows
I have a peculiar situation.
At one instant, I needed to branch, so I made a copy of my eclipse workspace and began working on two (2) parallel versions of the same project.
Development is done on a Windows workstation. For testing purposes, the application is deployed onto a Linux server.
If I run mvn jetty:run or mvn clean compile for either project on the Windows workstation, everything works fine. The projects use identical pom.xml so there is no difference.
However, if I transfer the source code onto the Linux server, only old branch compiles 100% and the new branch compiles something like 45% meaning if I run it, it will give quite many complaints of ClassNotFoundException...
The strange part is that:
- both projects are practically identical, copies of each other, 98%
- encoding UTF8 for Java, no strange non-alphabet filenames
- mvn compiles without error, it says "BUILD SUCCESSFUL" on both projects
- however, after compilation looking into the target/classes of the newer project, there are .class files missing for which there are .java files in its respective src/main/java/ path
- I have tried javac with verbose and nowarn and such parameters, no difference
- jdk 1.6_33
Is very confusing. Now what I have to do is compile the source on Windows workstation and copy the target/classes contents onto the Linux server, but seems really unnecessary. The only thing that comes into my mind is that the newer version is using some heavy bleeding-edge-generics, but if that would hurt I would assume that a) same result on Windows as Linux, b) some error message. But nothing, just "BUILD SUCCESSFUL" with lots of missing .class files.
Any ideas? Woodoo?
Here is some update to the issue: It began to occur on Windows also (magically not compiling significant portion of java files without any error indication) and then I simply took a DIFF between the recently compiling version and the later non compiling version. Diff was easy because only a few changes. I found out that I had a java file of size approx 600k (lots of inline data initialization etc.) which seemed to make the difference. I split this particular java file into 2 pieces (original into 109k and helper into 567k). Now it compiles again for Windows and I will probably continue looking for other such big files or splitting this one further to see if it will start to compile on Linux also!
The problem was eventually fixed by itself when we upgraded to JDK 7.