Trigger Eclipse is cleared via command line or automatically at specified time

Is it possible to force running Eclipse to clean and rebuild from the command line in Linux or startup time?

I have a workspace with hundreds of Maven projects that need to be cleaned up after being overwritten after an automatic file change. File change occurs every night, triggered by a cronjob, which starts svn update

and then mvn clean

andmvn install

at the end. Eclipse itself sees these original changes and automatically rebuilds (native interceptors) to stay up to date. But for unknown reasons, it is not fully restored. Many errors and warnings. These errors only go away if I clear the entire Eclipse workspace, which then results in an automatic rebuild in Eclipse. This rebuilding takes a long time (> 1 hour). I don't want to spend this time every day. So I'm looking for an automatic way to force a full cleanup and restore my running eclipse workspace during the night.

I cannot restart the eclipse during the night.

One idea is to clean up Eclipse from the outside (but how?) So that it can notice the change on its own. Eclipse can automatically rebuild.

+3


source to share


1 answer


As far as I know, there is no predefined way to run this from the outside. Therefore, I'm going to suggest a strategy that can achieve what you need. This touches on a lot of advanced topics, so I'm going to provide some pointers to get you started, because the details would be too much for this format. This will probably make a great blog post. So let's go:

  • Write a plugin for your Eclipse.
  • This plugin can open an MXBean using a Clear and Rebuild operation. Use the JDK tool jconsole

    to check the availability of the operation.
  • This operation, in turn, performs clean and complete rebuild commands. You can use Eclipse Plug-in Spy to find a suitable command and / or clean the Eclipse source code .
  • Next, you need to create a custom JMX client that invokes this MXBean operation from the outside. This is basically a stripped down version of jconsole's JMX capabilities and can be a simple Java command line for your cron jobs. It should connect to your local Eclipse instance and invoke the operation that you defined earlier. To find a suitable instance to connect to, your Eclipse plugin can write the port of the MXBean server instance to a file that your JMX client looks for when it starts.


EDIT: In addition to the clean and rebuild commands, you will need to request a full workspace update beforehand.

+3


source







All Articles