The short answer is the maven-compiler-plugin is not used inside Eclipse for projects that use M2Eclipse. Maven has an internal API that lets you calculate the build plan and inside Eclipse we selectively execute certain parts of the build plan. We need to worry about the generation of resources and sources, and the processing of those resources and sources. But we delegate entirely to JDT inside Eclipse for full incremental compilation. We focus on what’s required to edit anything and quickly launch or test. We also don’t particularly care about anything with respect to installing, packaging or deploying. M2Eclipse has gone to great lengths to integrate with the Eclipse workspace and as such trying to use the maven-compiler-plugin would make this untenable and highly inefficient. Also note that IDEA has also started using JDT for incremental compilation.
> On Aug 23, 2015, at 1:26 PM, Tommy Svensson <[email protected]> wrote: > > 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 <[email protected]>: >> >> 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: [email protected] > For additional commands, e-mail: [email protected] > Thanks, Jason ---------------------------------------------------------- Jason van Zyl Founder, Takari and Apache Maven http://twitter.com/jvanzyl http://twitter.com/takari_io --------------------------------------------------------- We know what we are, but know not what we may be. -- Shakespeare --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
