Adding Builders to Project in Eclipse and Incremental-ness

后端 未结 2 531
被撕碎了的回忆
被撕碎了的回忆 2020-12-20 18:56

I have a Java project, with the standard Java Builder selected as it\'s sole builder. Also, the build is configured to build automatically.

What I would like to

相关标签:
2条回答
  • 2020-12-20 19:33

    The ant builder, or any other builder for that matter, have several methods for building a project. When a build occurs in the Eclipse, the build(int kind, Map<String, String> args, IProgressMonitor monitor) method of all the active builders is called, but, there are different kinds of build, that any builder checks for in the build method. The kinds of build are:

    FULL_BUILD
    AUTO_BUILD
    INCREMENTAL_BUILD
    CLEAN_BUILD
    

    Here is an example syntax of build:

    protected IProject[] build(int kind, Map<String, String> args, IProgressMonitor monitor) throws CoreException {
        if (kind == FULL_BUILD) {
            fullBuild(monitor);
        } else {
            IResourceDelta delta = getDelta(getProject());
            if (delta == null) {
                fullBuild(monitor);
            } else {
                incrementalBuild(delta, monitor);
            }
        }
        return null;
    }
    

    As you can see, a builder can decide to react to a certain kind of build, and even act differently for different build kinds, so, my guess is, the ant builder is implemented so that it only reacts to full build, and not incremental build.

    0 讨论(0)
  • 2020-12-20 19:44

    Did you configure your Ant builder to run during an "auto" build? To do so, select the properties of the builder, go to the Targets page and use Set Targets for Auto Build.

    I have an Ant builder that is running in my Eclipse project on all kinds of builds (so also on saving edited source files), and I don't remember changing anything else.

    0 讨论(0)
提交回复
热议问题