Skip to content

Building with Eclipse

puredanger edited this page Aug 2, 2011 · 6 revisions

To work on the sparql-api code in Eclipse:

Method 1

  • install the M2Eclipse plugin
  • import the top-level pom into Eclipse via "Import : Maven : From existing project". The top-level project defines a multi-module Maven project so this will create several separate sub-projects in Eclipse and automatically setup the dependencies between them.
  • in the sherpa-protocol project configure the target/generated-sources/avro directory to be a source directory.

Method 2

  • Open a command prompt in the top-level sparql-api directory and execute "mvn eclipse:eclipse". This will generate an Eclipse .project file in each module, and automatically set up the dependencies between them.
  • In Eclipse, import the projects via "Import : General : Existing projects into workspace".
  • In the preferences dialog, define the M2_REPO classpath variable via "Java : Build Path : Classpath Variables" to point to your local Maven repository.

Eclipse formatter

At the root of the project is an export of Eclipse formatter settings. Please use this when formatting any code so that formatting is consistent and we keep the bulk of the whitespace changes out of the diffs.

To import:

  • Open Eclipse / Preferences
  • Go to Java / Code Style / Formatter
  • Click the Import... button
  • Select the eclipse-formatter-profile.xml file at the root of the spark project
  • Click Ok

Stupid m2e connector problems

Somewhere around m2e 0.13 (and occurring for m2e 1.0 that comes with Eclipse 3.7 Indigo), m2e started using an "m2e plugin connector" for every plugin in your pom that is tied to an "interesting" phase of the lifecycle. The plugin connector is a bridge between the Eclipse builder and the Maven lifecycle such that if a Maven plugin generates new sources or does other things of interest to the Eclipse builder, the Eclipse builder can be aware of those changes.

Our poms have several such plugins tied to "interesting" lifecycle phases. Importing spark and sherpa in Eclipse 3.7 will note that a plugin connector must be resolved for avro-maven-plugin, clojure-maven-plugin, and exec-maven-plugin. Of course, plugin connectors do not exist for these plugins which generates lots of build problems.

To address these problems, we instructed m2e to "ignore" these plugins in the poms for sherpa-protocol and sherpa-clojure:

  • sherpa-protocol
    • maven-exec-plugin - used to generate avpr from avdl
    • avro-maven-plugin - used to generate Java source from the avpr
  • sherpa-clojure
    • clojure-maven-plugin - used to compile Clojure code

Other info:

  • Instructions on how to instruct m2e to ignore specific plugins. This is stupid because it requires you to modify your pom (which works perfectly fine outside Eclipse or in Eclipse 3.5/3.6) to satisfy the new m2e version.
  • Useful Stack Overflow thread

Clone this wiki locally