Much ado about scripting, Linux & Eclipse: card subject to change


HOWTO: Build Plugin & Feature Projects, Then Run Their Unit Tests w/ Tycho :: GEF Example

Note that the instructions below are for Linux (or MacOSX). On Windows, your YMMV, but the process is the same.

1. Check out the entire source tree of your project from CVS, SVN, or Git into ~/build.

2. If needed, move plugins, features & test plugins into:


(Test features should go into features/ folder too.)

3. Install scala from

4. Fetch genpom.scala and parent-pom.xml; save in ~/build or equivalent.

5. Tweak parent-pom.xml to suit your needs or use as-is.

6. Run this to generate pom.xml files for plugins, features, and tests:

cd ~/build/plugins/; scala ../genpom.scala
cd ~/build/features/; scala ../genpom.scala
cd ~/build/tests/; scala ../genpom.scala

7. Download Maven 3 from

8. Install Maven 3

sudo su; cd /opt; tar xvzf apache-maven-3.0-alpha-7-bin.tar.gz
ln -s apache-maven-3.0-alpha-7 maven3

9. For convenience, alias mvn3 to the new maven:

alias mvn3='/opt/maven3/bin/mvn 2>&1 clean install | tee buildlog.latest.txt'

10. Build the plugins, features, and finally tests:

cd ~/build/plugins/; mvn3
cd ~/build/features/; mvn3
cd ~/build/tests/; mvn3
Look in ~/build/plugins/org.eclipse.*/target/ for generated jars.
Look in ~/.m2/repository/org/eclipse/* for published jars.
To automate steps 6 and 10, you can run this script in the ~/build/ folder:
for f in plugins/ features/ tests/; do \
  cd $f; scala ../genpom.scala; \
  /opt/maven3/bin/mvn 2>&1 clean install | tee buildlog.latest.txt; \
  cd ..; \

(The above blog is also posted here.)


Eugene Kuleshov said...

Instead of the last script you should be able to use Maven's feature, like:

mvn -r clean install

or with includes

mvn -r -Dmaven.reactor.includes=maven-eclipse-plugin/pom.xml,maven-idea-plugin/pom.xml
clean install

What's left is to wrap that Scala script into a Maven plugin, so you could reuse it directly too.

nickb said...

Even better, I've rewritten the scala script as an Ant script (genpom.xml) so that I can use Ant to bootstrap maven3, gen the pom files, and run maven recursively (build.xml). I'll post more details when I have these scripts sufficiently refactored & tested for use outside JBoss Tools.