Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Refresh eclipse from the command line

Question

I want to refresh eclipse from the command line. How can I do this?

Context

Typically I run builds like this:

$ myCompaniesSpecialBuildScript.sh

This does some project setup that is needed for Eclipse to display a project without compilation errors.

This means that whenever I run a build my steps are:

  • $ myCompaniesSpecialBuildScript.sh
  • Inside eclipse:

    • Select the project I am working on -> Right click and select Refresh, OR
    • From the top menu: Project -> Clean... -> Clean all

Ideally, rather than doing this I would much rather run this from the command line:

$ myCompaniesSpecialBuildScript.sh && myScriptToRefreshEclipse.sh

I am looking into how to make myScriptToRefreshEclipse.sh.

Progress

This is what I have found so far:

  • IResource.refresh - Allows resources to be refreshed.
  • There is also ant task that can be used, that wraps IResource.refresh

It seems like both of these things need to run inside Eclipse's JVM. Is there a way to get this from the command line?

like image 994
sixtyfootersdude Avatar asked May 28 '15 15:05

sixtyfootersdude


People also ask

Does Eclipse have a command line?

A fully working command-line Terminal inside Eclipse. Just press Ctrl+Alt+T to open a local command prompt (Terminal).

How do I refresh Eclipse on Mac?

When a new file is created in Eclipse you might need to refresh the Eclipse project to see the new file. This refresh process can take place automatically. To set auto-refresh, go to window → preferences → general → workspace and check the "Refresh using native hooks or polling" check-box.


2 Answers

In your workspace Preferences, enable General > Workspace > Refresh using native hooks or polling. That should cause Eclipse to automatically refresh the workspace resources when it is started the first time after they've been modified.

like image 82
E-Riz Avatar answered Oct 16 '22 18:10

E-Riz


Although not a direct answer to the question, I believe the best integration with Eclipse can be achieved by running even the shell script from within Eclipse: Create an External Tool Configuration filling in the path to your script file, and then visit the "Refresh" tab to select which parts of the workspace should be refreshed after running the script.

like image 22
Stephan Herrmann Avatar answered Oct 16 '22 16:10

Stephan Herrmann