If you want to use JDT from the command line you can look at the Takari Lifecycle[1] which does have an option to use JDT on the command line (in an up-to-date and modern way vs the plexus-compiler-plugin). The people who work on the Takari Lifecycle are also the people who work on M2Eclipse and we have done a lot of work to make them integrate well. Beyond incremental compilation there is also a mode which enforces the explicit listing of compile time dependencies (akin to the dependencies:analyze used and undeclared mode but built in by utilizing JDT). Our compiler mechanism will also honour OSGi bundle manifests and if a dependency is not explicitly listed as being available it will result in a compilation failure. In short it is a more strict compilation model that prevents your dependencies from getting out of control.
I assume at some point in the future IDEA will use JDT by default as it’s just a more natural fit for the IDE and working incrementally and having finer grained control over your dependencies given JDT's lineage and association with OSGi. I’m not a fan of OSGi in general, but OSGi has some good ideas with respect to keeping the dependencies of your project under control. [1]: http://takari.io/book/40-lifecycle.html#compiler-configuration > On Aug 24, 2015, at 1:49 PM, Tommy Svensson <[email protected]> wrote: > > Thanks for the explanation! > >> Also note that IDEA has also started using JDT for incremental compilation. > > I didn’t know that. It doesn't look like it is being used for maven builds > however. > > /Tommy > >> 24 aug 2015 kl. 14:02 skrev Jason van Zyl <[email protected]>: >> >> 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] >> > > > --------------------------------------------------------------------- > 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 --------------------------------------------------------- happiness is like a butterfly: the more you chase it, the more it will elude you, but if you turn your attention to other things, it will come and sit softly on your shoulder ... -- Thoreau --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
