Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

An Integrated Development Environment (IDE) should be used to develop source code.  Eclipse is a good choice, as it is free, widely used, and well supported.

You will also want to install the m2eclipse plugin for Maven support and Subversive which provides a Subversion client interface.

Before You Start

Before you start to setup Eclipse, you should follow the instructions at Installing HPS Java to install locally the HPS Java trunk, which contains the various modules that will be loaded as projects.

...

There are many different Eclipse configurations provided here, and you will most likely probably want the Eclipse IDE for Java Developers, which provides a Java IDE and built-in support for Maven.  (The link is specifically for the Luna release.)

To install itthe IDE, simply download the correct file for your operating system by following the links, and then use unzip or tar to unpack it into a local directory.

This will create You should see a directory called eclipse, and you should run and the script at eclipse/eclipse to will start the application.

This program can also be setup as an application shortcut in your window manager, which on my Linux system looks something like this.

...

The Subversive Plugin provides a graphical Subversion client within Eclipse, implementing commands like commit, update, etc.

To install Subversive, follow these steps.

  1. In Eclipse, open Help > Install New Software.
  2. Under work with put the Work with field, paste in the appropriate URL for your release, e.g. for Luna this would be is the following.

    No Format
    http://download.eclipse.org/releases/luna
  3. Find Once Eclipse is done loading the available plugin list, find the Collaboration item under the Name column, expand it, and select check the checkbox box for Subversive Team Provider.
  4. Click Next two times twice.
  5. Accept the license terms, and finally click on Finish to install the plugin.
  6. Restart Eclipse.

When you go to use this plugin, a window will appear with the title Install Connectors.

...

In order to pick the right connector which provides the Subversion client, you will need to find figure out what version you already have installed on the command line.

...

Warning
titleSubversion Versions

Subversion client versions clients are unfortunately not forward or backward compatible between minor releases.  In other words, you cannot checkout a project using a 1.6 client and then switch to using a 1.7 or 1.8 client.  For this reason, it is strongly recommended that the Subversive Connector you install matches the version which is installed already on your system.

...

To create a new project in Eclipse, you can select File > New > Java Project from the main menu.  This will start a wizard for creating the new project.

We will create a project for the users module where miscellaneous user analysis code is located in HPS Java.

In the New Java Project window, you need to do the following.

...

Info
titleUsing a Single Project for HPS Java

The same instructions can be used to import the entire HPS Java trunk as a Java Project as well.  Instead of the directory of a single module, simply use the base directory of your local trunk directory under Location in the project wizard.  Then you should be able to work with all of the modules in one Eclipse project.

 

Building a Maven Project

...

Setup the new configuration to look like this.

In order to use this configuration, automatic builds must should be turned off, which can be done from the menus by deselecting Project > Build Automatically from the application menu.

To execute this build configuration, select the project in the Package Explorer or Project Explorer by left clicking on it, and then go to Run > Run Configurations, click on your Maven configuration, and then finally click the Run button there.

The build log should show up in the console window as the project compiles.

Info
titleResolving Dependencies in Eclipse

Should Eclipse be unable to resolve a project's dependencies, try right-clicking on the project in the "Project Explorer" pane icon and selecting Maven > Update Project OR from the menu or hitting Alt + F5 while the project is selected.  This should force Eclipse to update its index of jar files against your local Maven repository of jar files, and hopefully this will make all the red errors in your editor go away.

...

The HPS collaboration uses a standard Java code formatting convention for Java based on the the Java Code Conventions.

To set this up for your projects, right click on a project in Eclipse, then select Properties.

...

Warning
titleTabs are Evil

As a general rule, tabs should never be used in any files within the SVN.  Mixing tabs and spaces creates a formatting mess.  And tabs may appear differently depending on how someone has their editor configured (e.g. tab indentation could be 4 or 8 spaces).  For these reasons, we stick to a rule of spaces only in all source code.

Editor Configuration

You should also setup some of the other editors in Eclipse to use spaces instead of tabs.

This is done through the menu under Window > Preferences.

For text editors, go to General > Editors > Text Editors > Insert spaces for tabs and check it.

For XML files, go to XML > XML Files > Editor and select Indent using spaces and set Indentation size to 4.

There are other places where this can be configured as well, for various types of editors.  This link provides useful answers on where all these settings are located and how they can be configured to use spaces only.