When you are using maven together with Eclipse things does not work as I think you believe from reading your question :-)
The maven compiler plugin always runs on in the compile phase of a maven build. If you are using Intellij IDEA or NetBeans then the IDE runs maven as it would be run on the command line and let maven do the build (well IDEA can actually do its own build, but that is not relevant for this). Eclipse however always compiles more or less as you type. I have been using maven with Eclipse for a long time, and to me it seems like it runs selected maven phases for code generation, etc, but does the compilation itself. With a maven project Eclipse puts its class files in the maven target folder. I might be wrong about eclipse doing the compilation, but that is the feeling I’ve got from using Eclipse with maven. If someone can provide more exact details what happens when Eclipse builds a maven project that would be really interesting. I think that the problem with the maven integration in Eclipse is that Eclipse is centered around that it compiles constantly as you type in the editor. When you have finished some code that is compilable Eclipse will compile it without you having to do anything. This collides with ”traditional” build tools like maven. Tommy Svensson > 23 aug 2015 kl. 15:59 skrev Sreyan Chakravarty <sreyan.mail...@gmail.com>: > > OK I am new to Maven and I am using it within Eclipse for a simple > Hibernate project. > > What I want to know what is the use of the maven compiler plugin. In > Eclipse regardless of whether my project is a Maven project or not I just > > - Type my code > - And select "Run As Java Application" > > And my code runs. I do not see Maven using the compiler plugin as I would > see it if I were building it from the command line. > > So does Maven internally and automatically use the Maven compile plugin to > generate .class files ? Because my .class files are magically kept exactly > where they are suppose to be ie. in the /target folder. > > Also is the maven compile command just useful for command line building ? > Or is there an use for the plugin in Eclipse projects also ? > > Regards > Sreyan Chakravarty --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org