Using Eclipse for development of the Fortress language tools

It works. You need some plugins. It sometimes helps to build with ant from a terminal window, and then to refresh within Eclipse.

Installing Eclipse

The current version of Eclipse can be found on the  Eclipse website.

Supported Eclipse Versions

Eclipse 3.4.1, 3.4.2, and 3.5M6 have been recently used for Fortress development, and all work about the same.

Increase memory in eclipse.ini

Find and edit eclipse.ini, which might be located someplace like this:

eclipse-3.4.2/Eclipse.app/Contents/MacOS/eclipse.ini

The vmargs parameter as shipped uses these heap settings:

-Xms40m
-Xmx256m

It needs to specify a larger heap and more stack:

-Xms256m
-Xmx768m
-Xss16m

Plugins

In Eclipse 3.5 ("Galileo") you get plugins by choosing "Help -> Install New Software...". This will take you to this dialog: Picture of Eclipse plugin install/select pane

You paste in the URL for the Eclipse plugin download, then you hit "Enter" (the key). (Don't hit the "Add" button, that leads somewhere else.)

Subversion:

http://subclipse.tigris.org/update_1.6.x

Scala, use version 2.7.6. If things act funny, version mismatches are a possible cause.

http://www.scala-lang.org/scala-eclipse-plugin

Mercurial, if you want it:

http://www.vectrace.com/eclipse-update/

ASM tools (get ASM, not bytecode outline, jonas or exo).

http://download.forge.objectweb.org/eclipse-update/

Get Bytecode outliner from here:

http://andrei.gmxhome.de/eclipse/

Be sure to get the right version. Whatever comes by default from the Objectweb update site, is not the right version, at least not at the moment.

TO GET ECLIPSE SET RIGHT with Scala and all the generated files, first (in a terminal window in the root directory of the workspace) ant clean compile. Then in Eclipse, select the project, right (or ctrl-) click and choose "Refresh". THEN, in Eclipse, choose "Project -> Clean..." and be sure the Fortress project is included in what is getting cleaned. This assumes you have "Build Automatically" selected (same menu), if you do not, request a build. This sequence of steps has been observed to work at least once, and maybe it will work for you.

Sometimes Eclipse gets stuck building, in which case, Force Quit or kill -9, ant clean compile, and try again.  Filing bugs against for this behavior against Eclipse is probably not a useful way to spend your time; if you do,  be sure to get a thread dump; you will need to put it into a file, and attach it AFTER doing the initial bug filing. You'll also be asked for plugin information sooner or later, so you might as well include that in your initial bug report. How this is revealed depends upon your version of Eclipse, but in 3.5, it can be found in "Eclipse -> About Eclipse SDK", click "Installation Details", and select text from some or all of the tabs ("Configuration" looks particularly interesting).

Using Eclipse for Fortress Itself

There is an Eclipse plugin for Fortress code; the plugin project is hosted  here. It's still quite primitive, but does syntax highlighting, which can be quite useful.

Use the "Software Updates" menu item (underthe "Help" menu) to install the Fortress plugin. To do this, select the "Available Software" tab, click "Add Site", and paste in the URL

http://fortress-development-tools.googlecode.com/svn/trunk/at.jku.ssw.fortress.site/site.xml

A new entry should appear in the list of available plugins. Click its checkbox, and then click "install".

Configuring Eclipse

Eclipse seems to be happiest if you don't set the environment variables discussed in the README file. In particular, running ant normally (rather than with the ./ant script) seems to work better. There is no need to set FORTRESS_HOME, since the scripts figure this out for themselves. Setting JAVA_HOME is OK.

When configuring eclipse for programming Fortress, there a number of Preferences and settings that should be adjusted.

In Eclipse Preferences

  • Turn on the setting to replace tabs by spaces
  • Turn on the setting to save before build
  • In General > Workspace set "Text file encoding" to UTF-8

In Run > External Tools > External Tool Configurations (also available here:

Finding the tool configuration dialog)

  • Add a "Run Fortress" configuration, which should look like this:

Configure External Tools (1)

  • In the "Common" tab, set the Console to use UTF-8 encoding.

  • Add a "Test Fortress" configuration by duplicating the "Run Fortress" one, and changing "run" to "run -test" in the arguments box

Path magic

According to ProjectFortress/ant, "to run tests using Ant within Eclipse, you will need to add junit.jar to build.xml > Run As > Ant Build... > Classpath > User Entries > Add JARs..." This means mouse over ProjectFortress/build.xml in the Project Explorer, select Run As..." from the context menu, and proceed as indicated.

Eclipse uses the Java "class path" to tell it how to display the file hierarchy in the "Resource" view. This is deep magic. Rather than trying to understand how it works, just use the .classpath that comes with the checkout.

What Else?

Please add to this page as you find things that I've forgotten

Attachments