Skip to content

Building Maven Batch Compiler

Kris De Volder edited this page Jul 10, 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 is a bit clunky. It 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.

Import at lease 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

Historically, 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 will assume now this has already been done.

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). Do this manually rather than with replace all and take care not to replace accidental matches.

These places need changing:

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

Building and Test with Maven Local

Preparation

Open `groovy-eclipse-batch-builder/build.properties' follow the comments and change any values as needed. It is a good idea to also make sure to use the latest version of eclipse.

Double check Groovy Eclipse workspace. Perform a clean build. Should be no errors.

Check groovy-eclipse-batch-creation/build.xml. It has two references to jdt-patch/eXX. Make sure the eXX matches your version of eclipse as well as the org.eclipse.jdt.core plugin you have imported into your workspace. Make sure you will be packaging the bundle you actually compiled!

Check version mumbers 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 aritfacts are now available for people to use from the codehaus snapshots repo.

If this is a RELEASE then you need to ... (to be continued).

Clone this wiki locally