java - Difference between Eclipse Build Project and Maven Compile command -
is eclipse "build project" command same maven command "mvn compile"? both same thing?
if yes, why need "build project" in sts after running "mvn clean install" in order run application without issues? running "mvn clean install" should have compiled project. shouldn't refreshing project in sts enough run it?
if no, eclipse build different because java compiler implements java language specification build classes? following apache maven link says default compiler javax.tools.javacompiler (by way using java 1.6).
the short answer no, maven build , eclipse build not same.
basically, eclipse has own way of building things, has little maven. @ basic level, eclipse java compilation, using own java compiler (part of eclipse jdt).
a precise answer how differ hard give, situation quite complex, , depends precisely on stuff (eclipse plugins) have installed.
to close possible approximation eclipse does, resembles maven on commandline should install m2e (maven eclipse tooling).
m2e tries make eclipse ide's behavior 'emulate' closely possible maven's commandline behavior. configuring eclipse project. example, setting source folders, classpath etc. based on maven poms. works pretty if poms don't 'fancy' things (i.e. use not common maven plugins).
when use maven plugins in pom 'special' things maybe generate code, or whatever, m2e has plugin mechanism allows maven plugin authors define corresponding eclipse plugin 'teaches eclipse' how same thing.
this can hairy, because not maven plugins have corresponding eclipse plugins, , if do, not automatically installed instance of eclipse.
if haven't got plugins 'teach eclipse' of pom's plugin. m2e give error lifecyle mapping. indication m2e , maven commandline may not 'do same thing' project, , resolve somehow (e.g installing corresponding eclipse 'project configurator').
Comments
Post a Comment