Versions Compared

Key

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

Table of Contents
minLevel2

Project Development in Eclipse

...

You can download an installation bundle from the Eclipse downloads site.

There are many different Eclipse configurations provided here, and you will most likely want the Eclipse IDE for Java Developers, which provides a Java IDE and built-in support for Maven.

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

It This will create a directory called eclipse, and you should run eclipse/eclipse to 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 actual paths will, of course, depend on where you have installed Eclipse on your system.

Configuring Plugins

Subversive

...

Then click on the Finish button and the project should now show up in the Package Explorer within the Java View.

Source Code Formatting

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

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

Navigate to Java Code Style > Formatter to edit the settings for this project.

Check the box marked Enable project specific settings and then click the New button.

Name the profile e.g. "My Java Settings" and select "Java Conventions" from the drop-down menu. 

This configuration will appear something like the following now.

Image Added

Then click OK to edit the settings.

You will now edit the specific formatting settings which will be used for Java projects.

There are only a few changes which will be made to the defaults.

Under Tab policy, select "Spaces only".

For Tab size, put 4 instead of 8.

Now your window should look something like this.

Image Added

Next click Apply and then OK.

Info
titleFormatting Source Code

You can apply the formatting on Java files a few different ways.  From the Package Explorer, you can select one or more files, and then right click and select Source > Format.

Within an editor window, you can format an entire file by right clicking and selecting Source > Format.  This will also work on a section of selected code.

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.

 

Building a Maven Project

It is useful to create a custom build configuration for executing Maven on the project.

...