Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Clean/Rebuild workspace on startup
Clean/Rebuild workspace on startup [message #1763541] Wed, 17 May 2017 08:35 Go to next message
Felix Dorner is currently offline Felix DornerFriend
Messages: 265
Registered: December 2015
Senior Member
Hi,

Is there a way to run eclipse so that it cleans/rebuilds the entire workspace right after startup?
Re: Clean/Rebuild workspace on startup [message #1763630 is a reply to message #1763541] Thu, 18 May 2017 07:51 Go to previous messageGo to next message
Felix Dorner is currently offline Felix DornerFriend
Messages: 265
Registered: December 2015
Senior Member
And if not, is there a way to restart eclipse programatically with some sort of 'continue' hook so I can execute a clean programmatically after the restart I triggered before?
Re: Clean/Rebuild workspace on startup [message #1763706 is a reply to message #1763630] Thu, 18 May 2017 18:58 Go to previous messageGo to next message
Brian de Alwis is currently offline Brian de AlwisFriend
Messages: 757
Registered: January 2012
Senior Member

Setting Preferences > General > Startup and Shutdown > Refresh workspace on startup[/em] should do the trick.

Brian.


Eclipse Platform committer. Ask me about Eclipse support, training, and consulting.
Re: Clean/Rebuild workspace on startup [message #1764360 is a reply to message #1763706] Mon, 29 May 2017 08:00 Go to previous messageGo to next message
Felix Dorner is currently offline Felix DornerFriend
Messages: 265
Registered: December 2015
Senior Member
I'm not sure in which case this will trigger a rebuild of the entire workspace. My usecase is switching the groovy eclipse compiler version, which requires a restart & clean build after the compiler is switched.
Re: Clean/Rebuild workspace on startup [message #1764438 is a reply to message #1764360] Mon, 29 May 2017 17:28 Go to previous message
Brian de Alwis is currently offline Brian de AlwisFriend
Messages: 757
Registered: January 2012
Senior Member

You could create your own plugin that provides an extension to the `org.eclipse.ui.startup` extension point. On startup, it would do something like the following (untested):
final IWorkspace workspace = ResourcesPlugin.getWorkspace();
Job cleanJob = new Job() {
  public IStatus run(IProgressMonitor monitor) {
    try {
       workspace.build(IncrementalProjectBuilder.CLEAN_BUILD, monitor);
       return Status.OK_STATUS;
    } catch(CoreException ex) {
      return ex.getStatus();
    }
  }
};
cleanJob.setRule(workspace);
cleanJob.schedule();



Eclipse Platform committer. Ask me about Eclipse support, training, and consulting.
Previous Topic:Decorating section of form fields
Next Topic:IncrementalProjectBuilder + IResourceChangeEvent
Goto Forum:
  


Current Time: Mon Jun 25 19:52:43 GMT 2018

Powered by FUDForum. Page generated in 0.02384 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top