开发者

How do Java and Maven builders work together in eclipse?

do I understand correctly, that Java builder recompiles sources on scr path to the output path, which usually happens after each "ctrl + s" if automatic building is activated or via "ctrl + b" or throws validation errors from javac.

As to Maven2Bulder. I just cloned m2e-core git repository and there is the corresponding class org.eclipse.m2e.core.internal.builder.MavenBuilder, which is quite complicated stuff.

<projectDescription>
    <name>modeshape-example-repositories</name>
    <comment></comment>
    <projects>
    </projects>
    <buildSpec>
        <buildCommand>
            <name>org.eclipse.jdt.core.javabuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
        <buildCommand>
            <name>org.eclipse.m2e.core.maven2Builder</name>
            <arguments>
            </arguments>
        </buildCommand>
    </buildSpec>
    <natures>
        <nature>org.eclipse.m2e.core.maven2Nature</nature>
        <nature>org.eclipse.jdt.core.javanature</nature>
    </natures>
</projectDescription>

I thought it gets pom.xml, m2eclipse variables about repo location and settings.xml or some 开发者_开发技巧profile information and goal/target of the current Run configuration and it just runs mvn with this pieces of information, but it does much much more and it can produce unexpected behavior.

Btw, is it only used when a developer actually Run As > some maven goal ... ?


The main purpose of the Maven builder is to ensure the correctness of your POM file and pull down the dependencies that you need. It will go out and check for new dependencies if you save your POM file, and it will report errors when it cannot find dependencies.

Additionally, the maven builder will run a maven build up to the goal that you have set in Preferences -> Maven->Goal to run after updating project configuration after you do a Project->Clean... on your project from eclipse or make changes to the POM file and save it from within eclipse.

The Java Builder is still in charge of building the project and reporting compiler errors in the Problems view, for providing the input for the built in jUnit runner in eclipse, etc.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜