Skip to content

Sterile Import into Eclipse

Raviv Rachmiel edited this page May 5, 2017 · 9 revisions

Initially (May 2016) entitled "how to (really really) import and develop Spartan Refactoring", this page is a how-to guide for making a Sterile Import into Eclipse: downloading and importing into Eclipse.

clean importing this project into eclipse. For plain maven import, see the instructions in the project’s GitHub page. (Hint: Running mvn package from within the spartan-refactoring/SpartanRefactoring directory succeeds).

Sterilization

Remove any traces of Eclipse and reinstall it:

  • Delete Eclipse’s installation directory (such as “ sudo rm –rf /opt/eclipse”) *Delete the “.eclipse” directory from your home directory
  • Remove/rename the “workspace” directory
  • Download and install “Eclipse IDE for Java developers” from eclipse.org

The following script found in the root under name "sterile-eclipse.sh", is a full proof way of running a sterilized version of eclipse

#!/bin/bash
set -o xtrace
touch ~/.m2 && 
mv ~/.m2 "/tmp/`date`.p2" && 
touch ~/.p2 && 
mv ~/.p2 "/tmp/`date`.m2" && touch ~/.eclipse &&  mv ~/.eclipse "/tmp/`date`.eclipse" &&
touch ~/workspace &&  mv ~/workspace "/tmp/`date`.workspace" &&
cd ~/Downloads && touch eclipse && mv eclipse  "/tmp/`date`.eclipse" 
shopt -s extglob 
tar xfz eclipse-$1-*.tar.gz
eclipse/eclipse -clean -consoleLog -data ~/workspace

Essential Plugins

Do not begin the next steps until this step is complete.


In Eclipse, go to “Help->Install new software” and install everything in the categories:

  • “Eclipse Platform”,
  • “Eclipse Platform SDK”,
  • “Eclipse Plugin Development Tools”. Wait until everything has been installed and restart the IDE (this should take 5-6 minutes).

Download SpartanRefactoring

Clone the project’s repository to your computer:

git clone [email protected]:SpartanRefactoring/Spartanizer.git

Import from Eclipse as Gradle Project

  1. You may be required to download the updated version of the Eclipse gradle plugin: Help -> Install new software -> add -> Name=Gradle, Location=http://download.eclipse.org/buildship/updates/e46/releases/2.x then: Help -> Installation details -> left click "Buildship: eclipse plugins for Gradle" -> Update

  2. In Eclipse, go to “File->Import->Existing Gradle Project” and choose the Main directory (not the parent directory“spartan-refactoring”!

  3. Let Eclipse download and import all the required dependencies (including Eclipse Tycho). This may take a few minutes if done for the first time (Maven caches packages in the ~/.m2/repository). Restart Eclipse if necessary.

Import from Eclipse as Maven Project - not needed if used gradle already

  1. In Eclipse, go to “File->Import->Existing Maven Project” and choose the SpartanRefactoring directory (not the parent directory“spartan-refactoring”! Ensure that specifies il.org.spartan.refactoring” in the installation window, without .parent).

  2. Let Eclipse download and import all the required dependencies (including Eclipse Tycho). This may take a few minutes if done for the first time (Maven caches packages in the ~/.m2/repository). Restart Eclipse if necessary.

Did you forget anything?

If done properly until now, there should be an open project in Eclipse called il.org.spartan.refactoring.

No erros should appear, especially not import errors. If there are import errors, make sure that the "essential plugins" stage was carried out correctly and that all the dependencies were successfully installed.

Run configuration

Create the run configuration:

  1. Go to “Run→Run configurations...”

  2. Select “Eclipse Application” and click on the little “New” icon button above it to create a new configuration, which will be called “New_configuration” or something similar. Click on the newly created configuration.

  • In the “Main” tab: Under the “Program to Run” box, make sure that “Run a product: org.eclipse.platform.ide” is selected
  • In the “Plug-ins” tab: Select “Launch with: plug-ins selected below only” Click “Deselect All”, then click on “Add Required Plug-ins” to the right of the main list.
  • Manually select the plug-ins “il.org.spartan.refactoring” and “org.eclipse.ui.ide.application” (Optional) In the “Common” tab: Select both the “Debug” and “Run” checkboxes under “Display in favorites menu
  • Rename the configuration (for your own convenience),
  • then hit “Apply” and “Close” Run the plug-in using the newly created run configuration!

If this is still not working, go back to the run configuration, go to the “Plug-ins” tab and select “Launch with: All workspace and enabled target plug-ins”. This is less recommended, but has a higher chance of working.

Clone this wiki locally