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

2010-04-16

HOWTO: Build a XulRunner 1.9.1.2 Update Site with Tycho 0.8 + Maven 3

0. Install Maven 3 by downloading then unpacking the tar.gz:

cd /tmp; \
wget http://mirror.csclub.uwaterloo.ca/apache/maven/binaries/apache-maven-3.0-alpha-7-bin.tar.gz; \
tar xvzf apache-maven-3.0-alpha-7-bin.tar.gz; \
chmod 755 apache-maven-3.0-alpha-7/bin/mvn; \
alias mvn3='/tmp/apache-maven-3.0-alpha-7/bin/mvn'

1. Check out sources:

cd /tmp; \
svn co http://anonsvn.jboss.org/repos/jbosstools/branches/modular_build/xulrunner/; \
wget http://anonsvn.jboss.org/repos/jbosstools/branches/modular_build/parent-pom.xml

2. Run build:

cd xulrunner; mvn3 -fae clean install

3. You will get a p2 repo / update site in the target folder of the site project, from which you can install XulRunner or XPCOM into your Eclipse.

cd site/org.mozilla.xulrunner.site/target/site

Note that the parent-pom.xml used above can in fact be much simpler. You only need the following:
<?xml version="1.0" encoding="UTF-8"?>
<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.jboss.tools</groupId>
  <artifactId>org.jboss.tools.parent.pom</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>JBoss Tools Parent</name>
  <packaging>pom</packaging>
  <properties>
    <tychoVersion>0.8.0</tychoVersion>
  </properties>
  <build>
    <plugins>
      <plugin>
        <groupId>org.sonatype.tycho</groupId>
        <artifactId>tycho-maven-plugin</artifactId>
        <version>${tychoVersion}</version>
        <extensions>true</extensions>
      </plugin>

      <plugin>
        <groupId>org.sonatype.tycho</groupId>
        <artifactId>target-platform-configuration</artifactId>
        <version>${tychoVersion}</version>
        <configuration>
          <resolver>p2</resolver>
          <environments>
            <environment>
              <os>macosx</os>
              <ws>cocoa</ws>
              <arch>x86</arch>
            </environment>
            <environment>
              <os>macosx</os>
              <ws>carbon</ws>
              <arch>x86</arch>
            </environment>
            <environment>
              <os>win32</os>
              <ws>win32</ws>
              <arch>x86</arch>
            </environment>
            <environment>
              <os>linux</os>
              <ws>gtk</ws>
              <arch>x86</arch>
            </environment>
            <environment>
              <os>linux</os>
              <ws>gtk</ws>
              <arch>x86_64</arch>
            </environment>
          </environments>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

2 comments:

John said...

Wow. If tycho reduces the need to learn 'PDE build' I'm thankful. I never found the motivation to grok 'PDE build'. I have no doubt that once the learning curve is overcome, PDE build seems simple. For me, ramping up with PDE build is alot like getting out of bed on a cold winter's morning without coffee to feed the pet sasquatch.

I've implemented only a few ideas in plugins and so have had too few encounters with PDE build. I am always starting from square zero with PDE build and not retaining valuable knowledge from one use to the next. As a result, my ideas froze.

Hooray for sonatype and eclipse teams that have worked toward the goal to maven-ize plugin builds.

nickb said...

With Tycho you only need to know PDE/UI, not PDE/Build. You're still responsible for having valid feature.xml and MANIFEST.MF files (assuming you want to have pom.xml files reuse that information), but there's no more black magic needed to make the build work when it all compiles fine in the UI.

Note, however, that Tycho is WAY more restrictive/anal about resolution of dependencies than is PDE/UI (or PDE/Build). So, what works in the workspace may throw errors with Tycho because Tycho is going to expose more problems.

IMHO, this is a good thing, but YMMV.