Skip to content

Building Maven Batch Compiler

Kris De Volder edited this page Jul 15, 2014 · 27 revisions

This page details how to build and deploy the groovy-eclipse maven batch compiler. The old version of this information is here

The Projects

The interesting components are in the /extras folder. There are several projects located here:

  • groovy-eclipse-compiler : the compiler plugin itself (an m2e project).
  • groovy-eclipse-batch-builder : a set of ant scripts and configuration files used to build the groovy-eclipse-batch artifact. This artifact is an amalgamation of all jars required for compiling Groovy and Java code in Eclipse, including ecj (the Eclipse compiler for Java), the non-UI components of Groovy-Eclipse, the Groovy jars, and various required Eclipse bundles.
  • groovy-eclipse-maven-tests : a sample project that uses the compiler plugin (an m2eclipse project).
  • groovy-eclipse-compiler-tests : integration tests for the groovy-eclipse-compiler
  • groovy-eclipse-quickstart : Archetype project for groovy-eclipse-compiler. Not maintained. org.codehaus.groovy.m2eclipse : an Eclipse plugin that provides integration between Groovy-Eclipse and m2eclipse (the Maven tooling for Eclipse).
  • Feature-org.codehaus.groovy.m2eclipse : an Eclipse feature that is required for building and releasing the org.codehaus.groovy.m2eclipse plugin.

Maven Settings

To deploy groovy-eclipse-compiler and groovy-eclipse-batch to maven central or the codehaus snapshots area you will need write access to the maven repos on codehaus. Guillaume should be able to help you there. Use your codehaus credentials to fill in the template below and place a copy of it into ~/.m2/settings.xml.

<!-- This is a sample settings.xml file for publishing maven artifacts to the codehaus maven repos -->
<!-- This should go in your ~/.m2 directory -->
<settings xmlns="http://maven.apache.org/POM/4.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
                  http://maven.apache.org/xsd/settings-1.0.0.xsd">
 <servers>
  <server>
    <id>codehaus.org</id>
    <username>USER_NAME</username>
    <password>PASSWORD</password>
  </server>
  <server>
    <id>codehaus-nexus-snapshots</id>
    <username>USER_NAME</username>
    <password>PASSWORD</password>
  </server>
  <server>
    <id>codehaus-nexus-staging</id>
    <username>USER_NAME</username>
    <password>PASSWORD</password>
  </server>
 </servers>
</settings>

Setting up an Eclipse Workspace

The build process relies on having a Eclipse workspace setup in which you successfully compiled Greclipse. The build will collect and jar-up compiled .class files from your workspace. See the project README.md for instructions on getting a workspace setup.

When you have your Greclipse workspace setup. Import these additional projects from the extras folder. Import at least these 3 projects as 'existing projects' into your workspace:

  • groovy-eclipse-compiler
  • groovy-eclipse-batch-builder
  • groovy-eclipse-compiler-tests

If you don't have m2e installed the groovy-eclipse-compiler project will have errors (because of missing dependencies). You can install m2e, or ignore these errors since we will build groovy-eclipse-compiler using commandline maven.

Version Numbers

Version numbers for both artifacts use a -01, -02, etc as a suffix. This is because groovy-eclipse-compiler versions track groovy-eclipse releases, but sometimes off-cycle releases are required. Similarly, groovy-eclipse-batch follows Groovy compiler releases.

New Groovy Version

When a new Groovy version comes out, first the Groovy Eclipse Compiler itself has to be updated. The process for doing this is documented [here](Updating the groovy in groovy eclipse). We assume this has already been done.

Now, to change the Groovy version in the batch compiler artifact, the easiest way is to use text search to find references to the old version number (e.g. 2.3.3) and replace them with the new one (e.g. 2.3.4).

These places need changing:

  • groovy-eclipse-batch-builder/build.properties (1 reference)
  • groovy-eclipse-compiler-test: (2 references)

Building, Testing and Deploying

Preparation

Open groovy-eclipse-batch-builder/build.properties follow the comments and change any values as needed. Make sure to point to a fresh copy of Eclipse that is the same version as the one you used to setup your workspace. This is not strictly necessary, but is safer.

Double check your Groovy Eclipse workspace. Perform a clean build. There should be no errors.

Check groovy-eclipse-batch-builder/build.xml. It has two references to jdt-patch/eXX folder. Make sure the eXX matches your version of Eclipse and that it is the folder containing the org.eclipse.jdt.core project you have imported into your workspace. This is crucial to make sure you will be packaging the bundle you actually compiled rather than something old and possibly broken.

Check version numbers for groovy-eclipse-compiler and groovy-eclipse-batch. Make sure they are SNAPSHOT versions or RELEASE versions as appropriate for your intended build.

Build and test Locally

You can use the extras/build-all.sh script. It will build both the groovy-eclipse-compiler and groovy-eclipse-batch, install both to maven local repo and then run a few tests using the locally deployed artifacts.

If the tests pass, inspect the output in extras/groovy-eclipse-compiler-tests/target. Double check that you are in fact running the tests with the intended new version of groovy.

Deploy Snapshot or Stage a Release

Now run the extras/deploy.sh script. It performs similar steps to the local test, but this time artifacts will be deployed and the deployed artifacts are used for testing.

If this is a SNAPSHOT build then you are done. The artifacts are now available for people to use from the codehaus snapshots repo.

If this is a RELEASE then the artifacts are in the codehaus staging area, follow these instructions to close and release the staging repo to release them to maven central.

Clone this wiki locally