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.
By default, as of the 2019-09 release, Eclipse will use up to 1024MB of memory. This seems to be sufficient for most of what we do.
In some older versions, the default may be as little as 512MB of memory, which 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 macOS, control-click on the executable, select Show Package Contents and then go to either Contents/MacOS/eclipse.ini
or Contents/Eclipse/eclipse.ini
.
You must install the following plugins. The easiest way is to use the Marketplace (Help -> Eclipse Marketplace):
https://dl.bintray.com/testng-team/testng-eclipse-release/
as a repository and installing from there.https://checkstyle.org/eclipse-cs/
as a repository and installing from there.Required Configuration
The following configuration, set via the Preferences window, is required when working with Shibboleth.
The follow configuration is default in the 'Mars' release of eclipse (4.5) but should be checked.
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.
Report non visible references: ticked
Report deprecated references: unticked
Missing Javadoc tags: Warning (but Error might be a better idea)
... as visible as: Private
Ignore in overriding and implementing methods: ticked
Ignore method type parameters: unticked (perhaps a mistake)
Missing Javadoc comments: Ignore
The follow configuration is default from the 'Mars' release of eclipse (4.5) but can be checked.
For development with the IdP V3 and V4 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.
parent/resources/eclipse/user_catalog.xml
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.
File -> Import
then Maven -> Existing Maven Projects
Root Directory
*-parent
directory, located as a child directory of the project directory created in step 1, as the Root Directory
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.
Java generally allows for debugging by connecting to a process and by asking a process to connect to the debugger. With respect to Jetty, the former did not work for Scott, but the latter did work.
First, create a Java Debug... configuration for one of the projects and set Connection Type to "Standard (Socket Listen)". You can select the port and connection limit as required.
To start Jetty in a typical way from the command line and ask it to connect to Eclipse on port 8888:
$ java -agentlib:jdwp=transport=dt_socket,address=localhost:8888 -jar /opt/jetty/jetty-9.4/start.jar |
This stopped on breakpoints and seemed to behave in the expected ways. Obviously it could be tricky if the project code state doesn't match what's inside Jetty.