Is Eclipse "Build Project" command same as the Maven command "mvn compile"? Do both basically do the same thing?
If Yes, then why do I need to do a "Build Project" in STS after running "mvn clean install" in order to run the application without any issues? Running "mvn clean install" should have already compiled the project. Shouldn't Refreshing the project in STS be enough to run it?
If No, then is Eclipse build different because the Java compiler implements the Java Language Specification to build the classes? But the following Apache Maven link says that the default compiler is javax.tools.JavaCompiler (By the way I am using Java 1.6).
解决方案
I think I may have found an answer to my question. Firstly I'd like to say that I do have the M2E (Maven plugin for Eclipse) installed in my STS. I spoke to a colleague of mine and he agreed that they are both the same thing (Build Project and the "mvn compile"). Refreshing the Project in STS after running a "mvn clean install" should be sufficient to run your Project. However there are times when he runs into exceptions during execution with just a Refresh. Only then does he perform a Refresh, "Build Project" and then Run. He says it's probably a bug that STS sometimes requires a Build.
With the M2Eclipse plugin you can run your "mvn clean install" command directly from your Eclipse in two ways:
1. Right click on your Maven Project> Run As> [Select your maven command]
2. Right click on your pom.xml in your Maven Project> Run As> [Select your maven command]
I still prefer running the maven commands through command line though. :)