|[m2e-users] Why does Maven along with m2eclipse successfully build a project with compile errors?|
I have a project that I got initially working with an Ant build, and then I converted it to build with Maven. I had a JAXB plugin project and the app project. When converting to Maven, I converted it all to a "build" aggregator project, an "ear" project, a "war" project, and the JAXB plugin project. I build the application with "mvn install" in the "build" project. I've been developing with this process for a few weeks now. I edit the code in Eclipse, using the m2eclipse plugin. What I only just noticed this morning is that if I have a compile error in my project, running "mvn install" doesn't complain at all. It apparently successfully builds everything. If I instead first do a "mvn clean", and then "mvn install", it correctly fails on the compile errors. After the build that succeeded but should have failed, I looked back in the Maven build output, and I noted this: [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ myapp-war --- [INFO] Nothing to compile - all classes are up to date So even though I had changed the file (deliberately creating a compile error, which Eclipse told me about), it thought the classes were up to date. So, I then fixed the file again in Eclipse and did a "mvn install" from the command line. I then used an external text editor to make the same error in the same file, and then I did another "mvn install" from the command line. This correctly failed with the compile error. So, it seems like m2eclipse is doing something unexpected here. So, my next experiment was to fix the compile error and then from the shell look at the last modified time of the ".java" and ".class" files. They matched. I then waited a minute and then remade the compile error in the file and then looked at the last modified times again. They matched. The last modified time on the ".class" file was updated to match the time of the ".java" file. The one with a compile error in it, which couldn't have compiled to a class file. So it's clear that doing "mvn install" didn't fail when there were compile errors because the ".java" file wasn't newer than the ".class" file, so it didn't attempt to compile anything. Is this behavior something unique to m2eclipse, or is there something else going on here?
Back to the top