Page tree
Skip to end of metadata
Go to start of metadata

Eclipse Configuration

Here is how the Shibboleth developers set up their Eclipse environment. These instructions were last updated for 2012's Eclipse Juno, but apply in large part to later releases. We recommend the Eclipse IDE for Java Developers distributions.

Max Memory

By default, Eclipse will use up to 512MB of memory. This is probably too low if you have a lot of large projects open at once. To adjust this, edit your eclipse.ini file and adjust the -Xmx###m setting appropriately (768 or 1024 is good). On Windows and on most Linux distributions the eclipse.ini file is located in the same directory as the eclipse executable. On OS X control-click on the executable and select Show Package Contents and then go to Contents/MacOS/eclipse.ini.

On a Mac, it's also a good idea to add "-Djava.awt.headless=true" to the eclipse.ini file to avoid a known bug.  If you don't do this, Eclipse can hang on startup if you shut it down while in the synchronisation perspective.

In the Eclipse Neon release (2016), the default heap size is already set to 1024MB.

Plugins

You must install the following plugins. The easiest way is to use the Marketplace (Help -> Eclipse Marketplace):

  • Subversive - SVN Team Provider
  • TestNG for Eclipse
  • Checkstyle Plug-in

Once you restart Eclipse (or in some cases the first time you perform a Subversion operation) you'll be asked which Subversive SVN connector to use. You should pick the SVNKit implementation (1.7.x or 1.8.x) corresponding to the Subversion workspace data format you wish to use. This would normally correspond to the version of Subversion you will be using on the command line. It is unrelated to the version of Subversion used on the server side.

The Subversion 1.7 and 1.8 clients use different working copy formats, and can neither read nor write working copies from other versions. The Subversion 1.8 client can however upgrade an existing working copy to the 1.8 format. If you switch client versions within Eclipse (under Team -> SVN -> SVN Connector) and restart Eclipse, the upgrade option will be presented automatically.

Mac note: the version of Subversion shipped with Mac OS X (via the Xcode command-line tools) depends on the versions of both Mac OS X and Xcode, and whether you have used the MacPorts system or similar to acquire a Subversion client.

If you are running Mac OS X 10.9.x and have installed the command-line tools from Xcode version 5.0 (both current as of 2014-03-20) then this will provide a Subversion 1.7.x client. The MacPorts system installs a Subversion 1.8.x client.

If you find that you have an earlier version of Subversion, you should install the command-line tools from Xcode or use MacPorts to install a more recent client.

Required Configuration

The following configuration, set via the Preferences window, is required when working with Shibboleth.

  • General -> Editors -> Text Editors -> Insert spaces for tabs -> check
  • Team -> SVN -> Properties Configuration -> Set text MIME type for all non-binary files -> uncheck
  • Team -> SVN -> Properties Configuration -> Import -> SVN auto-property file (use "Restore Defaults" first unless the list is empty, to avoid duplicates)
  • XML -> XML Files -> Editor -> Line Width -> 120
  • XML -> XML Files -> Editor -> Indent Using Spaces -> selected
  • XML -> XML Files -> Editor -> Indentation Size -> 4

The follow configuration is default in the 'Mars' release of eclipse (4.5) but should be checked.

  • General -> Editors -> Text Editors -> Show line numbers -> check 
  • Java -> Code Style -> Add '@Override' annotation for new overriding methods -> check (Note: requirement reversed at developers meeting 2013-12-20) 

Recommend Configuration

It is recommended that you set the following Eclipse Preferences to the given value. This is not required but the following options are all there for various reasons: help in debugging, code formatting/style, better IDE performance, etc.

  • General -> Show heap status -> check
  • General -> Startup and Shutdown -> Confirm exit when closing last window -> uncheck
  • General -> Startup and Shutdown -> Plug-ins activated on startup -> Mylyn .* -> uncheck
  • Java -> Editor -> Folding -> Comments -> check
  • Java -> Editor -> Folding -> Inner Types -> check
  • Maven -> Download Artifact Sources -> check
  • Maven -> Download Artifact JavaDoc -> check
  • Maven -> User Interface -> Open XML page in the POM editor by default -> check
  • Team -> SVN -> Console -> Show console automatically -> On output -> select
  • Team -> SVN -> Label Decorations -> Text Decorations -> File: -> remove '{revision}'
  • Team -> SVN -> Label Decorations -> Text Decorations -> Folder: -> remove '{revision}'
  • Team -> SVN -> Label Decorations -> Text Decorations -> Project: -> remove '{revision} [{location_label}{root_prefix}: {first_branchOrTag_child}]'

The follow configuration is default in the 'Mars' release of eclipse (4.5) but can be checked.

  • General -> Appearance -> Enabled animations -> uncheck
  • General -> Editors -> Structured Text Editors -> Enable Folding -> check
  • Install/Update -> Automatic Updates -> Automatically find new updates and notify me -> check
  • Maven -> Download repository index updates on startup -> uncheck

If you live outside the US, you may be disconcerted by the date format used by the Subversion client, for example in history listings.  Fix that this way:

  • Team -> SVN -> View Settings tab -> Date Formats -> Something other than "Short date", e.g., Custom plus "yyyy-MM-dd HH:mm" or "dd-MMM-yyyy HH:mm".

For development with the V3 code, it is also recommended to add this XML Catalog into the Eclipse configuration.  Do this after you have added and imported the V3 projects.

  • File -> Import ->  XML -> XML Catalog.
  • Select the file java-parent-project/resources/eclipse/user_catalog.xml

Importing Projects

In order to work with a project in Eclipse you need to get it from Source Control System and get it in to Eclipse. Here's the general steps.

  1. Check out the project trunk/branch from the Subversion or Git repository.
    Note: you should perform this checkout from the command line
  2. In Eclipse, select File -> Import then Maven -> Existing Maven Projects
    1. If the project is a monolithic project, select the directory created in step 1 as the Root Directory
    2. If the project is a multi-module project, select the *-parent directory, located as a child directory of the project directory created in step 1, as the Root Directory
  3. Press the Okay button and wait while Eclipse builds everything, updates its caches, has a cup of tea and whatever else takes it so long.

Note: this configuration includes the Shibboleth project's standard Apache 2 license header. Code contributed to the Shibboleth project must contain this header. However, if you are not planning to contribute the code you'll probably want to change this. To do so, go to your project's properties and in Java Code Style -> Code Templates adjust Comments -> File to whatever you want it to be.

  • No labels