Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Sapphire Modeling Tycho build support

Revision as of 11:56, 7 June 2011 by Gregory.amerson.liferay.com (Talk | contribs) (New page: For any users that are trying to use tycho to build their eclipse plugins that use sapphire's model annotations, you will be required to configure tycho to generate the model classes as pa...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

For any users that are trying to use tycho to build their eclipse plugins that use sapphire's model annotations, you will be required to configure tycho to generate the model classes as part of the maven build. In the sample Sapphire plugins this is done with a customBuildCallbacks.xml which is a facility for PDE build. Tycho doesn't support this ability out of the box but it can be easily configured by making some changes to your pom.xml and a edited version of the customBuildCallbacks.xml sample.

In the pom.xml for any plugin that has sapphire generated models you need to have the pom run an ant script during the generate-sources phase. To do this requires both changes to pom.xml and also changes to the customBuildCallbacks.xml provided in the sapphire samples.

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

Back to the top