0

Eclipse "build automatically" is supposed to trigger a build when a resource has changed. In my Eclipse-RCP app I have a project with a custom Nature and my Builder. The builder gets invoked as expected (both with or without "build automatically"), except for one problem: when Eclipse starts with "build automatically" on, the project is not built; same if the project is closed and opened.

How does Eclipse build manager decides if a "new" project needs a build?

leonbloy
  • 73,180
  • 20
  • 142
  • 190

1 Answers1

1

Are you using the IncrementalProjectBuilder?

If yes, then eclipse does not decide what gets built. It simply invokes your implementation of the build(...) method with the kind of build it is (Automatic, Full, Clean or Incremental). It is up to your builder to decide what to do, from then on, using the IDelta from the getDelta() method.

When eclipse starts, if no resources were changed while eclipse was off, then it will not trigger a build.

Caius Brindescu
  • 607
  • 4
  • 13
  • I see. My problem was that my builder has some things in memory, that are not persisted, so an initial rebuild is always necessary. I need to think how to proceed.. – leonbloy May 27 '14 at 21:46
  • One way of solving the problem is to activate your plugin at startup (using the IStartup interface and extension point: http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fextension-points%2Forg_eclipse_ui_startup.html). This way, you could call your builder automatically at startup. – Caius Brindescu May 27 '14 at 21:50
  • For that you could add an IResourceListener to listen for project open/close events. – Caius Brindescu May 28 '14 at 03:53
  • Come to think of it, you could use a "lazy build" system. Whenever you want to use the things in memory, if they are `null` or something similar, trigger a build. That way, you don't have to wrangle with all the corner cases that eclipse throws at you. Just a thought. – Caius Brindescu May 28 '14 at 04:21