Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[sapphire-dev] Sapphire + tycho build support

Hello everyone,

This is just a FYI for any users that are trying to use tycho to build their eclipse plugins that use sapphire.  Below is how I setup the customBuildCallbacks.xml so the annotations processor and sapphire ant tasks would run at the right point during the build.

Here is what I did.  In the pom.xml for any plugin that has sapphire generated models I modified the pom to fire off a ant script during the generate-sources phase and then had to modify the callback ant script to reference maven/tycho provided classpath references.  

1) In your pom.xml used snippet [1] to launch the ant script during generate-sources

2) In customBuildCallback.xml, had to make the following changes:
2a) modify the location of ant-contrib.jar for my build environment
2b) Change the <safe-apt /> task [2] to reference classpath refs provided by maven3/tycho
2c) Change the <taskdef /> element [3] for how to find the sapphire SDK ant task

3) In my plugin.xml I had to explicitly depend on these bundles [4], so that when maven/tycho generates the classpath references it will include those two jars on the classpath.  There may be a more elegant way to do encode this dependnecy in maven/pom.xml but I am not a maven expert but doing this worked.

Hope this can be of help to other sapphire+tycho users.  Konstantin, is there a wiki for sapphire project that I could add this to?


[1] <build>
     <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>1.6</version>
        <executions>
          <execution>
            <id>generate-sources</id>
            <phase>generate-sources</phase>
            <configuration>
              <target>
                <ant antfile="customBuildCallbacks.xml" inheritRefs="true" />
              </target>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>


[2] <safe-apt srcdir="src"
      destdir=".apt_generated"
      preprocessdir=".apt_generated"
      classpathref="maven.compile.classpath"
      factorypathref="maven.compile.classpath"
      compile="false"/>


[3] <taskdef 
          resource="org/eclipse/sapphire/sdk/build/antlib.xml"
          classpathref="maven.compile.classpath"/>

[4] org.eclipse.sapphire.sdk
org.eclipse.sapphire.sdk.build.processor



--
Greg Amerson (@greg_amerson)
Liferay, Inc. (#liferay)

Back to the top