Saturday, July 16, 2011

Configuring Eclipse Tycho Maven Plugin to use Target Definition File and Publishing Target Platform Bundles to Update Site

I answered an Eclipse Tycho Maven Plugin question on StackOverfow and I think I should repeat it here (for my own purpose, hehe.. I am forgetful :-)

I should expand this to have better coverage of Tycho workflow but usually I'll get lazy so here it is pretty much verbatim.

Create a Target Definition file (.target) and put it inside a Maven project, see here for example target: https://github.com/eclipsesource/com.eclipsesource.tycho.aspectj.demo/blob/master/platform/indigo.target

You need to attach the .target file to the artifact, using the build helper:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>build-helper-maven-plugin</artifactId>
    <version>1.3</version>
    <executions>
        <execution>
            <id>attach-artifacts</id>
            <phase>package</phase>
            <goals>
                <goal>attach-artifact</goal>
            </goals>
            <configuration>
                <artifacts>
                    <artifact>
                        <file>indigo.target</file>
                        <type>target</type>
                        <classifier>indigo</classifier>
                    </artifact>
                </artifacts>
            </configuration>
        </execution>
    </executions>
</plugin>

(from https://github.com/eclipsesource/com.eclipsesource.tycho.aspectj.demo/blob/master/platform/pom.xml )

Then, in the parent POM or the plug-in projects that use that target definition file, you need to configure the "target" of target-platform-configuration Maven plugin, for example:

<plugin>
    <groupId>org.eclipse.tycho</groupId>
    <artifactId>target-platform-configuration</artifactId>
    <version>${tycho-version}</version>
    <configuration>
        <resolver>p2</resolver>
        <ignoreTychoRepositories>true</ignoreTychoRepositories>
        <target>
            <artifact>
                <groupId>com.eclipsesource.sandbox.weaving.demo</groupId>
                <artifactId>com.eclipsesource.sandbox.weaving.demo.platform</artifactId>
                <version>0.1.0-SNAPSHOT</version>
                <classifier>indigo</classifier>
            </artifact>
        </target>
        <environments>
            <environment>
                <os>${build.os}</os>
                <ws>${build.ws}</ws>
                <arch>${build.arch}</arch>
            </environment>
        </environments>
    </configuration>
</plugin>

(taken from https://github.com/eclipsesource/com.eclipsesource.tycho.aspectj.demo/blob/master/releng/pom.xml )

Then your project(s) should build very nicely using Tycho. :-) If your .target references remote p2 repositories and not already in the p2 bundle pool, the necessary artifacts will be downloaded automatically.

Good luck!

Known Issue:

[WARNING] Target location type: Profile is not supported 

As of Tycho 0.12.0, It means the "Eclipse Installation" target source type cannot be used with Tycho (yet?), along with "Directory" and "Features".

Solution: Use the "Update Site" target source.

If you don't have yet an update site, here's to generate an update site from an Eclipse installation (or from any folder containing bundles, for that matter):

/opt/eclipse_rcp/eclipse -consolelog -nosplash -verbose \
  -application org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher \
  -metadataRepository file:/home/ceefour/p2/bonita/ \
  -artifactRepository file:/home/ceefour/p2/bonita/ \
  -source /home/ceefour/BOS-5.5.1/studio/ \
  -publishArtifacts

Note:

  • change /opt/eclipse_rcp to your own Eclipse SDK installation
  • metadataRepository and artifactRepository is the folder where the new update site will be created
  • source is --you guessed it-- the folder/installation containing the original bundles

To learn more about Eclipse platform programming, I highly recommend Eclipse Rich Client Platform (2nd Edition)

11 comments:

  1. i enjoy your writing ,its so readable ,pleasurable and easy to read .. thx .


    Buy RS Gold
    Buy RS Gold

    ReplyDelete
  2. With existing enhancements in laptop or computer and micro-tech, this truth isn't as well considerably off later on.

    ReplyDelete
  3. By contrast, a mere seventeen p.c office mac 2011 product key of Home windows seven reviewers hated it sufficient to award it a one-finger salute. And Windows eight was correct smack inside the center of all windows 7 enterprise activation key those two, with 29 p.c of reviewers offering it just 1 star.

    ReplyDelete
  4. You may not have to supplement WOW grinding for one or two levels in order to move cheap rs gold onto the next zones early on, although most of the later parts deal mostly with areas to grind in www.arm2teeth.com.

    ReplyDelete
  5. They can transfer rs gold important documents for the leaders of Human, Dwarf and Gnome in Stormwind City and Ironforge buy rs gold.

    ReplyDelete
  6. With modern, pre-drawn shapes, intelligent templates, and sample drawings, Microsoft Visio 2010 Download offers a wide variety of options to meet your diagramming needs for IT, business, process management, and more.
    Microsoft Project 2010 Download has several scheduling enhancements to improve your control over your schedule. You can also create initial task lists in Microsoft Excel or Word and paste them into Project without having to reformat them.

    ReplyDelete
  7. Buy GW2 Gold Very first: indiscriminate "practice" is pointless.We lost count the amount of tan players with 4k games I've seen D3 Gold, as i could get to Gemstone inside 50 online games.

    ReplyDelete
  8. The reply seems to be made of high quality materials, and its creators guarantee that it will be "great for the runescape 2007 gold sale holidays, with a design fard n, music taken directly from the game dubsted gun and a laser sight." On the other hand, this edition Collectors will also include a figure of 20 centimeters in memory of Johnny Gat, Saints considered the best ever. But the madness does not end here. And is that the guys at Volition have also included in the pack the mythical buy 07 rs gold "red button" able to unleash the final judgment in a matter of seconds.

    ReplyDelete
  9. I should expand this to have better coverage of Tycho workflow but usually I'll get lazy so here it is pretty much verbatim.WOW Gold
    Billig WOW Gold

    ReplyDelete
  10. Thanks a lot for this awesome post, friend. It truly resonates with me, maybe you also like 4rsgold.com

    ReplyDelete
  11. Regarding GameMS, they provide the cheapest MUT coins. . Most importantly, they also provide discount codes to save users more money and how to get discount codes.

    ReplyDelete