.. _configure_eclipse: ****************************************** Configure Eclipse for Developing Sunflower ****************************************** :Author: Jim Klo .. contents:: Table of Contents Recommended Prerequisites for Macintosh OS X ============================================ Homebrew -------- Installation X Code and Homebrew are recommended for all. 1. Go to App Store and download and install X Code. 2. Launch X Code and install the Command Line tools. 3. Install Homebrew: http://brew.sh/ .. code-block:: bash ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" Get Java 8 ========== Needed to enable JavaFX tooling in Eclipse. You should be using Java JDK 1.8.0 update 45. Get Java 8 for Macintosh OS X ----------------------------- Open App Store, click on "updates" and install any OS X related items (one of the recent updates completely removes Java). Then go and download Java 8 JDK and install: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html Get Java 8 for Windows ---------------------- Download the latest JDK8 from http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html and install. OK to use 64-bit version, and OK to accept default install location. At a command prompt, test that the install went OK by entering ``javac -version``. You should see something like: ``javac 1.8.0_45`` If javac can't be found, you probably need to update or add a ``JAVA_HOME`` or ``PATH`` environment variable. Get Maven ========= Maven can be installed by downloading the appropriate package from here: http://maven.apache.org/download.cgi and following the installation instructions. Macintosh users with Homebrew can use the ``brew`` command instead. Get Maven for Macintosh OS X using Homebrew ------------------------------------------- You can always follow the Official Instructions for installing Maven, however, installation via brew simplifies the steps. 1. Open Terminal.app and enter .. code-block:: bash brew install maven 2. You might be prompted to perform the following: .. code-block:: bash brew link maven Get Maven for Other Platforms ----------------------------- Download and follow the installation instructions here: http://maven.apache.org/download.cgi for installing maven. Check Maven Installation ======================== Once installed open Terminal.app, Command.exe, or a shell and type: .. code-block:: bash mvn --version The output should look similar to this: .. code-block:: bash $ mvn --version Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T09:29:23-08:00) Maven home: /usr/local/Cellar/maven/3.2.5/libexec Java version: 1.8.0_45, vendor: Oracle Corporation Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre Default locale: en_US, platform encoding: UTF-8 OS name: "mac os x", version: "10.10.3", arch: "x86_64", family: "mac" If it does not have the right version of Java, add or modify a file in your Home directory named '.mavenrc' and add the following line: .. code-block:: bash export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home Rerun the previous ``mvn --version`` command and it should use the correct Java Version. Your Home directory for different platforms can be found in the table below: +----------------+-----------------------------+-------------------+ | Platform | Location | Example | +================+=============================+===================+ | Macintosh OS X | ``/Users/`` | ``/Users/jklo`` | +----------------+-----------------------------+-------------------+ | Windows | ``\Users\`` | ``C:\Users\jklo`` | +----------------+-----------------------------+-------------------+ | Linux | ``/home/`` | ``/home/jklo`` | +----------------+-----------------------------+-------------------+ Install Git client (GIT) ======================== You can use your choice of Git client. Some popular clients are: +-------------+-----------------------+--------------------------------+ | Platform | Application | Download | +=============+=======================+================================+ | Git | macOS, Windows, Linux | https://git-scm.com/downloads | +-------------+-----------------------+--------------------------------+ | SourceTree | macOS, Windows | https://www.sourcetreeapp.com/ | +-------------+-----------------------+--------------------------------+ Macintosh users may install an up-to-date command line version with Homebrew: .. code-block:: bash brew install git .. note:: As the Sunflower source code has migrated to Git, you will only need Subversion to access legacy ontologies. **Install Subversion client (SVN)** Use can use your choice of Subversion client. Please note that version of your client needs to match the version of your subversion workspace. Some popular clients are: +-------------+----------------+---------------------------------------+ | Platform | Application | Download | +=============+================+=======================================+ | svnX | Macintosh OS X | http://code.google.com/p/svnx/ | +-------------+----------------+---------------------------------------+ | TortoiseSVN | Windows | http://tortoisesvn.net/downloads.html | +-------------+----------------+---------------------------------------+ You will need to make JavaHL available: http://subclipse.tigris.org/wiki/JavaHL (this also installs the command-line client - same command as listed below). You can also install the command line client as well. Macintosh OS X ships with an older version, you may install an up-to-date version with Homebrew: .. code-block:: bash brew install --universal --java subversion For other platforms: Download or find your installer here: http://subversion.apache.org/packages.html Get the Sunflower Source ======================== Find a location on your disk with no spaces in the path, recommended is to create a folder named ``source`` in your home directoy and then change directory to that location: .. code-block:: bash mkdir ~/source cd ~/source Sunflower is split into multiple Git repositories as various modules are shared across different projects and customers. .. csv-table:: :header-rows: 1 :class: rotated-repos Git Repository, |ds| Docs |sd|, |ds| Foundation |sd|, |ds| Foundation Tasks |sd|, |ds| Studio CE |sd|, |ds| Studio Tasks |sd| sunflower-docs |br| https://scm.sri.com/scm/git/ROR/sunflower-docs, |*|, , , , sunflower-foundation |br| https://scm.sri.com/scm/git/ROR/sunflower-foundation, , |*|, |*|, |*|, |*| sunflower-foundation-tasks |br| https://scm.sri.com/scm/git/ROR/sunflower-foundation-tasks, , , |*|, , sunflower-studio |br| https://scm.sri.com/scm/git/ROR/sunflower-studio, , , , |*|, |*| .. |*| image:: img/check-mark-3-16.png .. |ds| raw:: html
.. |sd| raw:: html
.. |br| raw:: html
To clone the required source to your workstation using git, you can utilize the following command: .. code-block:: bash git clone https://@ Noting that you should replace ```` with your own SVN username. For example to clone ``sunflower-studio``: .. code-block:: bash git clone https://e12345@scm.sri.com/scm/git/ROR/sunflower-studio Repeat this for each repository you need to clone. .. note:: As Sunflower Source code has migrated to Git, the following remain for accessing legacy ontologies. These steps are not required. Find a location on your disk with no spaces in the path, recommended is to create a folder named ``svn`` in your home directory: .. code-block:: bash mkdir ~/svn Then checkout the source from Subversion. Note that you should replace ```` with your own SVN username. .. code-block:: bash cd ~/svn svn checkout https://@scm.sri.com/scm/svn/ROR/RAVE/trunk RAVE The checkout is quite large and will take a bit of time. Build Sunflower with Maven ========================== Since the Eclipse build depends upon Maven, we should ensure that we can build with Maven before working with Eclipse. First you need to login to SRI's `Artifactory Pro`_ with your LDAP username and password to generate an *encrypted password*. To do this, follow the instructions in the :ref:`Artifactory Credentials ` section and then return here with your encrypted password. .. _Artifactory Pro: https://artifactory.sri.com/ Next you need to configure maven to use the Sunflower Local Artifactory. Create or edit the file ``~/.m2/settings.xml``. If you don't have a ``.m2`` folder in your Home directory, you can safely create an empty .m2 directory within to copy the setting file into. The XML block below represents a complete maven settings file. Be sure to replace ``[artifactory login]`` and ``[artifactory encrypted password]`` with your Artifactory user login and *encrypted password* respectively. .. code-block:: xml :linenos: :emphasize-lines: 6-10,13-28,31 sunflower [artifactory login] [artifactory encrypted password] artifactory sunflower sunflower-local https://artifactory.sri.com/artifactory/sunflower-local true true artifactory If you have an existing ``~/.m2/settings.xml`` you can copy the ```` from lines 6 - 10 and the ```` from lines 13 - 37 into your existing file. Ensure that the ```` from lines 7 and 16 match. Also be sure activate the ``profile`` by adding it to ```` as shown on line 40. Save and close the ``~/.m2/settings.xml`` file once the configuration is complete. We can now build Sunflower Studio CE. .. code-block:: bash cd ../sunflower-bootstrap mvn verify -DskipTests -DbuildType=core Once complete the binary build locations are located: +------------------------+----------------------------------------------------------------------------+ | Distribution | Artifact Path | +========================+============================================================================+ | Sunflower Studio Tasks | ``src-root/sunflower-sri/com.sri.sunflower.distrib.tasks/target/products`` | +------------------------+----------------------------------------------------------------------------+ | Sunflower Studio CE | ``src-root/sunflower-open/com.sri.sunflower.distrib.core/target/products`` | +------------------------+----------------------------------------------------------------------------+ * The ZIP files in each ``products`` folder contains the platform specific distribution as indicated in it's filename. * Each ``products`` folder contains a subfolder that contains an tree of unzipped folders containing the built binaries. Get Eclipse SDK and Configure Target Platform ============================================= Install Eclipse SDK ------------------- 1. Download Eclipse SDK from here: http://www.eclipse.org/downloads/packages/eclipse-rcp-and-rap-developers/neon2 2. Launch Eclipse SDK, create a new workspace when prompted to select one. This should be a different location than where you checked out the Sunflower source. .. figure:: figs/Workspace_Launcher.png Select where your workspace will be location. 3. Open the Install New Sofware... dialogue: .. figure:: figs/Help_and_Menubar.png Select **Help** > **Install New Software..** 4. When the dialogue is open, do NOT type anything into the *Work with:* field, just the click **Add...** .. figure:: figs/Install_2.png Install software dialogue. 5. Add the following update site: +-------+----------------------------------------------------------------------------+ | Name | Update Site URL | +=======+============================================================================+ | XText | http://download.eclipse.org/modeling/tmf/xtext/updates/composite/releases/ | +-------+----------------------------------------------------------------------------+ .. figure:: figs/Add_Repository_1.png Enter the Name and Location of XText and it's update site URL. .. note:: There's no software that will be installed during this step. The next step requires XText as a dependency and will download only the necessary parts it needs. 6. Repeat adding a second update site: +-------------+-------------------------------------------------------------------+ | Name | Update Site URL | +=============+===================================================================+ | e(fx)clipse | http://download.eclipse.org/efxclipse/updates-released/2.4.0/site | +-------------+-------------------------------------------------------------------+ .. figure:: figs/Add_Repository.png Enter the Name and Location of e(fx)clipse and it's update site URL. 7. Under **e(fx)clipse - install**, select **e(fx)clipse - IDE**, then click **Next >**, **Next >**. Then select "I accept the terms of the license agreements" and click **Finish**. .. figure:: figs/Install_1.png Select **e(fx)clipse - IDE** and click **Next >**. .. figure:: figs/Install_Details_1.png Click **Next >**. .. figure:: figs/Install.png Select **I accept the terms of the license agreements** and click **Finish**. 8. Restart Eclipse when prompted. 9. Select **File** > **Import...** .. figure:: figs/File_and_Menubar.png Select **Import..** from the **File** menu. 10. In the **Import Wizard** dialogue, select **General** > **Existing Projects into Workspace**, then click **Next >**. .. figure:: figs/Import_existing_projects.png Select **Existing Projects into Workspace**, then click **Next >**. 11. On the next page of the **Import Wizard**, click **Browse...** to **Select root directory**, and select the sunflower-studio folder you previously checked out from Git. Then check the option **Search for nested projects**. You should see a list of pre-existing projects. Uncheck the *com.sri.bundledependency* and *com.sri.sunflower.dependencyeditor* projects. Click **Finish** to import the projects. .. figure:: figs/Import_existing_sunflower_studio.png Set the root directory of where you checked out sunflower-studio from Git and then check **Search for nested projects**. .. note:: After the import is complete, it is normal for several of the projects to be in an error state. This will be corrected by subsequent steps. You may disregard these errors for now. 12. Now we need to set the Target Platform. Open Eclipse **Preferences** (the location of this menu item varies across platforms), and enter *"Target"* into the search box. Select **Target Platform**, then select **Sunflower Neon**, then click **Apply**. .. figure:: figs/Preferences_edit_target_platform.png Select **Target Platform**, then select **Sunflower Neon**, then click **Apply**. 13. Check **Sunflower Neon** and it should indicate it is "(Active)". Click **OK**. 14. Select **Project** > **Clean...**. Then select **Clean all projects** and click *OK*. 15. This should resolve all project errors, and you are ready to start using Eclipse to develop. Tips ==== * If you want to increase Eclipse memory edit eclipse.ini and set -Xmx4096m (on a Mac: right-click on the app - show package contents - Contents - MacOS to find that file)