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

Difference between revisions of "Tycho/Additional Tools"

(tycho-eclipserun-plugin)
(replaced && by && for IU expression, it needs proper XML escaping)
 
(16 intermediate revisions by 6 users not shown)
Line 1: Line 1:
 
The Tycho project provides additional tools that may be useful when working with Tycho.
 
The Tycho project provides additional tools that may be useful when working with Tycho.
  
== tycho-p2-extras-plugin ==
+
=tycho-p2-extras-plugin=
  
The <tt>mirror</tt> goal of the <tt>tycho-p2-extras-plugin</tt> copies installable units (plus their corresponding artifacts) from one or more p2 repositories into the build directory. This goal is available since version 0.13.0.
+
== <tt>mirror</tt> goal ==
  
Example usage:
+
The <tt>mirror</tt> goal of the <tt>tycho-p2-extras-plugin</tt> copies installable units (plus their corresponding artifacts) from one or more p2 repositories to a p2 repository in the file system. The goal has almost the same parameters as the [http://help.eclipse.org/helios/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Fguide%2Fp2_repositorytasks.htm p2.mirror ant task].
  
Mirror the org.eclipse.rcp feature from the Indigo p2 repository to target/repository.
+
Also see the [http://eclipse.org/tycho/sitedocs-extras/tycho-p2-extras-plugin/mirror-mojo.html p2 mirror goal reference documentation] .
 +
 
 +
Example usage: Mirror the org.eclipse.rcp feature from the Indigo p2 repository to target/repository.
 
Filter the platform-specific fragments to only include linux/gtk/x86_64 os/ws/arch.
 
Filter the platform-specific fragments to only include linux/gtk/x86_64 os/ws/arch.
 
<pre>
 
<pre>
 
<build>
 
<build>
<plugins>
+
    <plugins>
<plugin>
+
        <plugin>
<groupId>org.eclipse.tycho.extras</groupId>
+
            <groupId>org.eclipse.tycho.extras</groupId>
<artifactId>tycho-p2-extras-plugin</artifactId>
+
            <artifactId>tycho-p2-extras-plugin</artifactId>
<version>${tycho-version}</version>
+
            <version>${tycho-version}</version>
<executions>
+
            <executions>
<execution>
+
                <execution>
<phase>prepare-package</phase>
+
                    <phase>prepare-package</phase>
<goals>
+
                    <goals>
<goal>mirror</goal>
+
                        <goal>mirror</goal>
</goals>
+
                    </goals>
</execution>
+
                </execution>
</executions>
+
            </executions>
<configuration>
+
            <configuration>
<source>
+
                <source>
<!-- source repositori(es) to mirror from -->
+
                    <!-- source repositories to mirror from -->
<repository>
+
                    <repository>
<url>http://download.eclipse.org/releases/indigo/</url>
+
                        <url>http://download.eclipse.org/releases/indigo/</url>
<layout>p2</layout>
+
                        <layout>p2</layout>
<!-- sypported layouts are "p2-metadata", "p2-artifacts", and "p2" (for joint repositories) -->
+
                        <!-- supported layouts are "p2-metadata", "p2-artifacts", and "p2" (for joint repositories; default) -->
</repository>
+
                    </repository>
</source>
+
                </source>
  
<!-- starting from here all configuration parameters are optional -->
+
                <!-- starting from here all configuration parameters are optional -->
                                <!-- they are only shown here with default values for documentation purpose -->
+
                <!-- they are only shown here with default values for documentation purpose -->
  
<!-- List of IUs to mirror. If omitted, allIUs will be mirrored. -->
+
                <!-- List of IUs to mirror. If omitted, allIUs will be mirrored. -->
<!-- Omitted IU version element means latest version of the IU -->
+
                <!-- Omitted IU version element means latest version of the IU -->
<ius>
+
                <ius>
<iu>
+
                    <iu>
<id>org.eclipse.rcp.feature.group</id>
+
                        <id>org.eclipse.rcp.feature.group</id>
</iu>
+
                    </iu>
</ius>
+
                    <!-- since tycho-extras 0.17.0, IUs can also be selected using p2 match queries  -->
<!-- The destination directory to mirror to. -->
+
                    <!-- http://wiki.eclipse.org/Query_Language_for_p2 -->
<destination>${project.build.directory}/repository</destination>
+
                    <iu>
<!-- Whether only strict dependencies should be followed. -->
+
                        <query>
<!-- "strict" means perfect version match -->
+
                          <expression>id == $0 &amp;&amp; version == $1</expression>
<followStrictOnly>false</followStrictOnly>
+
                          <parameters>org.eclipse.tycho.sampleid,1.0.0</parameters>
<!-- Whether or not to follow optional requirements. -->
+
                        </query>
<includeOptional>true</includeOptional>
+
                    </iu>
<!-- Whether or not to follow non-greedy requirements. -->
+
                </ius>
<includeNonGreedy>true</includeNonGreedy>
+
                <!-- The destination directory to mirror to. -->
<!-- filter properties. E.g. filter only one platform -->
+
                <destination>${project.build.directory}/repository</destination>
<filter>
+
                <!-- Whether only strict dependencies should be followed. -->
<osgi.os>linux</osgi.os>
+
                <!-- "strict" means perfect version match -->
<osgi.ws>gtk</osgi.ws>
+
                <followStrictOnly>false</followStrictOnly>
<osgi.arch>x86_64</osgi.arch>
+
                <!-- Whether or not to follow optional requirements. -->
</filter>
+
                <includeOptional>true</includeOptional>
<!-- Whether to filter the resulting set of IUs to only -->
+
                <!-- Whether or not to follow non-greedy requirements. -->
<!-- include the latest version of each IU -->
+
                <includeNonGreedy>true</includeNonGreedy>
<latestVersionOnly>false</latestVersionOnly>
+
                <!-- Filter properties. E.g. filter only one platform -->
<!-- don't mirror artifacts, only metadata -->
+
                <filter>
<mirrorMetadataOnly>false</mirrorMetadataOnly>
+
                    <osgi.os>linux</osgi.os>
<!-- whether to compress the target repo -->
+
                    <osgi.ws>gtk</osgi.ws>
<compress>true</compress>
+
                    <osgi.arch>x86_64</osgi.arch>
<!-- whether to append to the target repo content -->
+
                </filter>
<append>true</append>
+
                <!-- Whether to filter the resulting set of IUs to only -->
</configuration>
+
                <!-- include the latest version of each IU -->
</plugin>
+
                <latestVersionOnly>false</latestVersionOnly>
</plugins>
+
                <!-- don't mirror artifacts, only metadata -->
 +
                <mirrorMetadataOnly>false</mirrorMetadataOnly>
 +
                <!-- whether to compress the content.xml/artifacts.xml -->
 +
                <compress>true</compress>
 +
                <!-- whether to append to the target repository content -->
 +
                <append>true</append>
 +
                <!-- whether to mirror pack200 artifacts also. Available since tycho-extras 0.17.0 -->
 +
                <includePacked>true</includePacked>
 +
            </configuration>
 +
        </plugin>
 +
    </plugins>
 
</build>
 
</build>
 
</pre>
 
</pre>
  
The mojo has the same parameters as the [http://help.eclipse.org/helios/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Fguide%2Fp2_repositorytasks.htm p2.mirror ant task]
+
Example usage: Copy the plug-ins and features from the current build into an existing, central update site:
  
== tycho-eclipserun-plugin ==
+
<pre>
 +
<build>
 +
    <plugins>
 +
        <plugin>
 +
            <groupId>org.eclipse.tycho.extras</groupId>
 +
            <artifactId>tycho-p2-extras-plugin</artifactId>
 +
            <executions>
 +
                <execution>
 +
                    <id>copy-to-central-site</id>
 +
                    <phase>install</phase>
 +
                    <goals>
 +
                        <goal>mirror</goal>
 +
                    </goals>
 +
                    <configuration>
 +
                        <source>
 +
                            <repository>
 +
                                <url>${project.baseUri}/target/repository</url>
 +
                            </repository>
 +
                        </source>
 +
                        <append>true</append>
 +
                        <destination>/path/to/central/site</destination>
 +
                    </configuration>
 +
                </execution>
 +
            </executions>
 +
        </plugin>
 +
    </plugins>
 +
</build>
 +
</pre>
 +
 
 +
== <tt>publish-features-and-bundles</tt> goal ==
 +
 
 +
The <tt>publish-features-and-bundles</tt> goal of the <tt>tycho-p2-extras-plugin</tt> can be used to add p2 metadata to features and bundles built with other, non-p2-enabled build systems, so that the artifacts can be used in a Tycho build.
 +
 
 +
Example usage: Generate full p2 metadata for artifacts from an old-style update site.
 +
<pre>
 +
<build>
 +
    <plugins>
 +
        <plugin>
 +
            <groupId>org.eclipse.tycho.extras</groupId>
 +
            <artifactId>tycho-p2-extras-plugin</artifactId>
 +
            <version>${tycho-version}</version>
 +
            <executions>
 +
                <execution>
 +
                    <!-- step 1: mirror old-style update site -->
 +
                    <id>mirror-update-sites</id>
 +
                    <phase>process-resources</phase>
 +
                    <goals>
 +
                        <goal>mirror</goal>
 +
                    </goals>
 +
                    <configuration>
 +
                        <source>
 +
                            <repository>
 +
                                <url>http://example.org/old-style-update-site/</url>
 +
                            </repository>
 +
                            <!-- more update sites... -->
 +
                        </source>
 +
                        <destination>${project.build.directory}/repository</destination>
 +
                    </configuration>
 +
                </execution>
 +
                <execution>
 +
                    <!-- step 3: generate the full p2 metadata for the mirrored artifacts -->
 +
                    <id>generate-full-metadata</id>
 +
                    <phase>compile</phase>
 +
                    <goals>
 +
                        <goal>publish-features-and-bundles</goal>
 +
                    </goals>
 +
                    <configuration>
 +
                        <sourceLocation>${project.build.directory}/repository</sourceLocation>
 +
                    </configuration>
 +
                </execution>
 +
            </executions>
 +
        </plugin>
 +
        <plugin>
 +
            <groupId>org.apache.maven.plugins</groupId>
 +
            <artifactId>maven-antrun-plugin</artifactId>
 +
            <version>1.7</version>
 +
            <executions>
 +
                <execution>
 +
                    <!-- step 2: strip the p2 metadata that contains the "partial IUs" that which be used for dependency resolution in Tycho -->
 +
                    <id>remove-incomplete-metadata</id>
 +
                    <phase>process-resources</phase>
 +
                    <goals>
 +
                        <goal>run</goal>
 +
                    </goals>
 +
                    <configuration>
 +
                        <target>
 +
                            <delete file="${project.build.directory}/repository/content.jar" />
 +
                            <delete file="${project.build.directory}/repository/artifacts.jar" />
 +
                        </target>
 +
                    </configuration>
 +
                </execution>
 +
            </executions>
 +
        </plugin>
 +
    </plugins>
 +
</build>
 +
</pre>
 +
 
 +
=tycho-eclipserun-plugin=
  
 
This plugin allows to run an Eclipse application from Maven. This plugin is available since version 0.14.0. One use of this plugin is building the documentation index using Eclipse's antRunner and the help.buildHelpIndex Ant task.
 
This plugin allows to run an Eclipse application from Maven. This plugin is available since version 0.14.0. One use of this plugin is building the documentation index using Eclipse's antRunner and the help.buildHelpIndex Ant task.
Line 82: Line 191:
 
Without Tycho, this would typically be done by having an Ant file with the help.buildHelpIndex task. For example, in customBuildCallbacks.xml:
 
Without Tycho, this would typically be done by having an Ant file with the help.buildHelpIndex task. For example, in customBuildCallbacks.xml:
  
<pre>
+
<source lang="xml">
 
<project name="Build specific targets and properties" default="noDefault">
 
<project name="Build specific targets and properties" default="noDefault">
<target name="post.build.jars">
+
    <target name="post.build.jars">
<antcall target="build.index"/>
+
        <antcall target="build.index"/>
</target>
+
    </target>
  
<target name="build.index" description="Builds search index for the plug-in: org.eclipse.someplugin.doc.user." if="eclipse.running">
+
    <target name="build.index" description="Builds search index for the plug-in: org.eclipse.someplugin.doc.user." if="eclipse.running">
<help.buildHelpIndex manifest="plugin.xml" destination="."/>
+
        <help.buildHelpIndex manifest="plugin.xml" destination="."/>
</target>
+
    </target>
 
</project>
 
</project>
</pre>
+
</source>
  
 
tycho-eclipserun-plugin can be used to run Eclipse's antRunner and reuse that Ant file.  
 
tycho-eclipserun-plugin can be used to run Eclipse's antRunner and reuse that Ant file.  
Line 98: Line 207:
 
org.eclipse.someplugin.doc.user/pom.xml:
 
org.eclipse.someplugin.doc.user/pom.xml:
  
<pre>
+
<source lang="xml">
 
<build>
 
<build>
<plugins>
+
    <plugins>
...
+
        ...
<plugin>
+
        <plugin>
<groupId>org.eclipse.tycho.extras</groupId>
+
            <groupId>org.eclipse.tycho.extras</groupId>
<artifactId>tycho-eclipserun-plugin</artifactId>
+
            <artifactId>tycho-eclipserun-plugin</artifactId>
<version>${tycho-version}</version>
+
            <version>${tycho-version}</version>
<configuration>
+
            <configuration>
<appArgLine>-application org.eclipse.ant.core.antRunner -buildfile customBuildCallbacks.xml build.index</appArgLine>
+
                <appArgLine>-application org.eclipse.ant.core.antRunner -buildfile customBuildCallbacks.xml build.index</appArgLine>
<dependencies>
+
                <dependencies>
<dependency>
+
                    <dependency>
  <artifactId>org.apache.ant</artifactId>
+
                        <artifactId>org.apache.ant</artifactId>
  <type>eclipse-plugin</type>
+
                        <type>eclipse-plugin</type>
</dependency>
+
                    </dependency>
<dependency>
+
                    <dependency>
  <artifactId>org.eclipse.help.base</artifactId>
+
                        <artifactId>org.eclipse.help.base</artifactId>
  <type>eclipse-plugin</type>
+
                        <type>eclipse-plugin</type>
</dependency>
+
                    </dependency>
</dependencies>
+
                </dependencies>
</configuration>
+
            </configuration>
<executions>
+
            <executions>
<execution>
+
                <execution>
<goals>
+
                    <goals>
<goal>eclipse-run</goal>
+
                        <goal>eclipse-run</goal>
</goals>
+
                    </goals>
<phase>compile</phase>
+
                    <phase>compile</phase>
</execution>
+
                </execution>
</executions>
+
            </executions>
</plugin>
+
        </plugin>
</plugins>
+
    </plugins>
 
</build>
 
</build>
 
+
</source>
</pre>
+
  
 
For other scenarios, it might be necessary to change the elements in <dependencies>. Also, note that the JVM arguments can be changed with the <argLine> paremeter.
 
For other scenarios, it might be necessary to change the elements in <dependencies>. Also, note that the JVM arguments can be changed with the <argLine> paremeter.
 
A version of the plugin compatible with Tycho 0.13 is available at [http://code.google.com/a/eclipselabs.org/p/tycho-eclipserun-plugin/ Eclipse Labs].
 
A version of the plugin compatible with Tycho 0.13 is available at [http://code.google.com/a/eclipselabs.org/p/tycho-eclipserun-plugin/ Eclipse Labs].
 +
 +
 +
For example if you would like to install eclipse using this plugin you could try something like:
 +
 +
<source lang="xml">
 +
<properties>
 +
    <tycho-extras-version>0.14.0</tycho-extras-version>
 +
    <tycho-version>0.14.1</tycho-version>
 +
    <features>org.eclipse.sdk.ide,org.eclipse.platform,org.eclipse.jdt,org.eclipse.m2e.feature.feature.group,org.eclipse.m2e.logback.feature.feature.group
 +
    </features>
 +
    <sites>${eclipse.mirror.url}/releases/indigo,${eclipse.mirror.url}/technology/m2e/releases,${eclipse.mirror.url}/eclipse/updates/3.7
 +
    </sites>
 +
</properties>
 +
 +
<build>
 +
    <plugins>
 +
        <plugin>
 +
            <groupId>org.eclipse.tycho.extras</groupId>
 +
            <artifactId>tycho-eclipserun-plugin</artifactId>
 +
            <version>${tycho-extras-version}</version>
 +
            <configuration>
 +
                <argLine>-Declipse.p2.mirrors=false</argLine>
 +
                <appArgLine>-consoleLog -application org.eclipse.equinox.p2.director -nosplash -destination ${build.destination} -repository ${sites} -installIUs ${features}</appArgLine>
 +
                <dependencies>
 +
                    <dependency>
 +
                        <artifactId>org.eclipse.equinox.p2.transport.ecf</artifactId>
 +
                        <type>eclipse-plugin</type>
 +
                    </dependency>
 +
                    <dependency>
 +
                        <artifactId>org.eclipse.equinox.p2.repository</artifactId>
 +
                        <type>eclipse-plugin</type>
 +
                    </dependency>
 +
                    <dependency>
 +
                        <artifactId>org.eclipse.equinox.p2.touchpoint.natives</artifactId>
 +
                        <type>eclipse-plugin</type>
 +
                    </dependency>
 +
                    <dependency>
 +
                        <artifactId>org.eclipse.equinox.p2.touchpoint.eclipse</artifactId>
 +
                        <type>eclipse-plugin</type>
 +
                    </dependency>
 +
                    <dependency>
 +
                        <artifactId>org.eclipse.equinox.p2.artifact.repository
 +
                        </artifactId>
 +
                        <type>eclipse-plugin</type>
 +
                    </dependency>
 +
                    <dependency>
 +
                        <artifactId>org.eclipse.equinox.p2.director.app</artifactId>
 +
                        <type>eclipse-plugin</type>
 +
                    </dependency>
 +
                    <dependency>
 +
                        <artifactId>org.eclipse.equinox.ds</artifactId>
 +
                        <type>eclipse-plugin</type>
 +
                    </dependency>
 +
    <dependency>
 +
<artifactId>org.eclipse.core.net</artifactId>
 +
<type>eclipse-plugin</type>
 +
    </dependency>
 +
                </dependencies>
 +
            </configuration>
 +
            <executions>
 +
                <execution>
 +
                    <goals>
 +
                        <goal>eclipse-run</goal>
 +
                    </goals>
 +
                    <phase>compile</phase>
 +
                </execution>
 +
            </executions>
 +
        </plugin>
 +
    </plugins>
 +
</build>
 +
</source>
 +
 +
==tycho-eclipserun-plugin behind a proxy==
 +
 +
If you're behind corporate firewall and you're forced to use proxy you have to configure p2 director to use your proxy.
 +
Here's the answer from [http://dev.eclipse.org/mhonarc/lists/tycho-user/msg03343.html tycho-eclipserun-plugin behind a proxy - solved] by Martin Lippert:
 +
 +
<source lang="xml">
 +
<plugin>
 +
<groupId>org.apache.maven.plugins</groupId>
 +
<artifactId>maven-antrun-plugin</artifactId>
 +
<version>1.7</version>
 +
<executions>
 +
<execution>
 +
<id>configure-proxies-for-eclipserun</id>
 +
<phase>generate-resources</phase>
 +
<configuration>
 +
<target>
 +
<touch file="${project.build.directory}/work/configuration/.settings/org.eclipse.core.net.prefs" mkdirs="true" />
 +
 +
<propertyfile file="${project.build.directory}/work/configuration/.settings/org.eclipse.core.net.prefs">
 +
<entry key="eclipse.preferences.version" value="1" />
 +
<entry key="nonProxiedHosts" value="${http.nonProxyHosts}" />
 +
<entry key="org.eclipse.core.net.hasMigrated" value="true" />
 +
<entry key="proxyData/HTTP/hasAuth" value="false" />
 +
<entry key="proxyData/HTTP/host" value="${http.proxyHost}" />
 +
<entry key="proxyData/HTTP/port" value="${http.proxyPort}" />
 +
<entry key="systemProxiesEnabled" value="false" />
 +
</propertyfile>
 +
</target>
 +
</configuration>
 +
<goals>
 +
<goal>run</goal>
 +
</goals>
 +
</execution>
 +
</executions>
 +
</plugin>
 +
</source>
  
 
[[Category:Tycho|Additional Tools]]
 
[[Category:Tycho|Additional Tools]]

Latest revision as of 08:15, 6 June 2014

The Tycho project provides additional tools that may be useful when working with Tycho.

tycho-p2-extras-plugin

mirror goal

The mirror goal of the tycho-p2-extras-plugin copies installable units (plus their corresponding artifacts) from one or more p2 repositories to a p2 repository in the file system. The goal has almost the same parameters as the p2.mirror ant task.

Also see the p2 mirror goal reference documentation .

Example usage: Mirror the org.eclipse.rcp feature from the Indigo p2 repository to target/repository. Filter the platform-specific fragments to only include linux/gtk/x86_64 os/ws/arch.

<build>
    <plugins>
        <plugin>
            <groupId>org.eclipse.tycho.extras</groupId>
            <artifactId>tycho-p2-extras-plugin</artifactId>
            <version>${tycho-version}</version>
            <executions>
                <execution>
                    <phase>prepare-package</phase>
                    <goals>
                        <goal>mirror</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <source>
                    <!-- source repositories to mirror from -->
                    <repository>
                        <url>http://download.eclipse.org/releases/indigo/</url>
                        <layout>p2</layout>
                        <!-- supported layouts are "p2-metadata", "p2-artifacts", and "p2" (for joint repositories; default) -->
                    </repository>
                </source>

                <!-- starting from here all configuration parameters are optional -->
                <!-- they are only shown here with default values for documentation purpose -->

                <!-- List of IUs to mirror. If omitted, allIUs will be mirrored. -->
                <!-- Omitted IU version element means latest version of the IU -->
                <ius>
                    <iu>
                        <id>org.eclipse.rcp.feature.group</id>
                    </iu>
                    <!-- since tycho-extras 0.17.0, IUs can also be selected using p2 match queries  -->
                    <!-- http://wiki.eclipse.org/Query_Language_for_p2 -->
                    <iu>
                        <query>
                           <expression>id == $0 && version == $1</expression>
                           <parameters>org.eclipse.tycho.sampleid,1.0.0</parameters>
                        </query>
                    </iu>
                </ius>
                <!-- The destination directory to mirror to. -->
                <destination>${project.build.directory}/repository</destination>
                <!-- Whether only strict dependencies should be followed. -->
                <!-- "strict" means perfect version match -->
                <followStrictOnly>false</followStrictOnly>
                <!-- Whether or not to follow optional requirements. -->
                <includeOptional>true</includeOptional>
                <!-- Whether or not to follow non-greedy requirements. -->
                <includeNonGreedy>true</includeNonGreedy>
                <!-- Filter properties. E.g. filter only one platform -->
                <filter>
                    <osgi.os>linux</osgi.os>
                    <osgi.ws>gtk</osgi.ws>
                    <osgi.arch>x86_64</osgi.arch>
                </filter>
                <!-- Whether to filter the resulting set of IUs to only -->
                <!-- include the latest version of each IU -->
                <latestVersionOnly>false</latestVersionOnly>
                <!-- don't mirror artifacts, only metadata -->
                <mirrorMetadataOnly>false</mirrorMetadataOnly>
                <!-- whether to compress the content.xml/artifacts.xml -->
                <compress>true</compress>
                <!-- whether to append to the target repository content -->
                <append>true</append>
                <!-- whether to mirror pack200 artifacts also. Available since tycho-extras 0.17.0 -->
                <includePacked>true</includePacked>
            </configuration>
        </plugin>
    </plugins>
</build>

Example usage: Copy the plug-ins and features from the current build into an existing, central update site:

<build>
    <plugins>
        <plugin>
            <groupId>org.eclipse.tycho.extras</groupId>
            <artifactId>tycho-p2-extras-plugin</artifactId>
            <executions>
                <execution>
                    <id>copy-to-central-site</id>
                    <phase>install</phase>
                    <goals>
                        <goal>mirror</goal>
                    </goals>
                    <configuration>
                        <source>
                            <repository>
                                <url>${project.baseUri}/target/repository</url>
                            </repository>
                        </source>
                        <append>true</append>
                        <destination>/path/to/central/site</destination>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

publish-features-and-bundles goal

The publish-features-and-bundles goal of the tycho-p2-extras-plugin can be used to add p2 metadata to features and bundles built with other, non-p2-enabled build systems, so that the artifacts can be used in a Tycho build.

Example usage: Generate full p2 metadata for artifacts from an old-style update site.

<build>
    <plugins>
        <plugin>
            <groupId>org.eclipse.tycho.extras</groupId>
            <artifactId>tycho-p2-extras-plugin</artifactId>
            <version>${tycho-version}</version>
            <executions>
                <execution>
                    <!-- step 1: mirror old-style update site -->
                    <id>mirror-update-sites</id>
                    <phase>process-resources</phase>
                    <goals>
                        <goal>mirror</goal>
                    </goals>
                    <configuration>
                        <source>
                            <repository>
                                <url>http://example.org/old-style-update-site/</url>
                            </repository>
                            <!-- more update sites... -->
                        </source>
                        <destination>${project.build.directory}/repository</destination>
                    </configuration>
                </execution>
                <execution>
                    <!-- step 3: generate the full p2 metadata for the mirrored artifacts -->
                    <id>generate-full-metadata</id>
                    <phase>compile</phase>
                    <goals>
                        <goal>publish-features-and-bundles</goal>
                    </goals>
                    <configuration>
                        <sourceLocation>${project.build.directory}/repository</sourceLocation>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <version>1.7</version>
            <executions>
                <execution>
                    <!-- step 2: strip the p2 metadata that contains the "partial IUs" that which be used for dependency resolution in Tycho -->
                    <id>remove-incomplete-metadata</id>
                    <phase>process-resources</phase>
                    <goals>
                        <goal>run</goal>
                    </goals>
                    <configuration>
                        <target>
                            <delete file="${project.build.directory}/repository/content.jar" />
                            <delete file="${project.build.directory}/repository/artifacts.jar" />
                        </target>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

tycho-eclipserun-plugin

This plugin allows to run an Eclipse application from Maven. This plugin is available since version 0.14.0. One use of this plugin is building the documentation index using Eclipse's antRunner and the help.buildHelpIndex Ant task.

Without Tycho, this would typically be done by having an Ant file with the help.buildHelpIndex task. For example, in customBuildCallbacks.xml:

<project name="Build specific targets and properties" default="noDefault">
    <target name="post.build.jars">
        <antcall target="build.index"/>
    </target>
 
    <target name="build.index" description="Builds search index for the plug-in: org.eclipse.someplugin.doc.user." if="eclipse.running">
        <help.buildHelpIndex manifest="plugin.xml" destination="."/>
    </target>
</project>

tycho-eclipserun-plugin can be used to run Eclipse's antRunner and reuse that Ant file.

org.eclipse.someplugin.doc.user/pom.xml:

<build>
    <plugins>
        ...
        <plugin>
            <groupId>org.eclipse.tycho.extras</groupId>
            <artifactId>tycho-eclipserun-plugin</artifactId>
            <version>${tycho-version}</version>
            <configuration>
                <appArgLine>-application org.eclipse.ant.core.antRunner -buildfile customBuildCallbacks.xml build.index</appArgLine>
                <dependencies>
                    <dependency>
                        <artifactId>org.apache.ant</artifactId>
                        <type>eclipse-plugin</type>
                    </dependency>
                    <dependency>
                        <artifactId>org.eclipse.help.base</artifactId>
                        <type>eclipse-plugin</type>
                    </dependency>
                </dependencies>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>eclipse-run</goal>
                    </goals>
                    <phase>compile</phase>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

For other scenarios, it might be necessary to change the elements in <dependencies>. Also, note that the JVM arguments can be changed with the <argLine> paremeter. A version of the plugin compatible with Tycho 0.13 is available at Eclipse Labs.


For example if you would like to install eclipse using this plugin you could try something like:

<properties>
    <tycho-extras-version>0.14.0</tycho-extras-version>
    <tycho-version>0.14.1</tycho-version>
    <features>org.eclipse.sdk.ide,org.eclipse.platform,org.eclipse.jdt,org.eclipse.m2e.feature.feature.group,org.eclipse.m2e.logback.feature.feature.group
    </features>
    <sites>${eclipse.mirror.url}/releases/indigo,${eclipse.mirror.url}/technology/m2e/releases,${eclipse.mirror.url}/eclipse/updates/3.7
    </sites>
</properties>
 
<build>
    <plugins>
        <plugin>
            <groupId>org.eclipse.tycho.extras</groupId>
            <artifactId>tycho-eclipserun-plugin</artifactId>
            <version>${tycho-extras-version}</version>
            <configuration>
                <argLine>-Declipse.p2.mirrors=false</argLine>
                <appArgLine>-consoleLog -application org.eclipse.equinox.p2.director -nosplash -destination ${build.destination} -repository ${sites} -installIUs ${features}</appArgLine>
                <dependencies>
                    <dependency>
                        <artifactId>org.eclipse.equinox.p2.transport.ecf</artifactId>
                        <type>eclipse-plugin</type>
                    </dependency>
                    <dependency>
                        <artifactId>org.eclipse.equinox.p2.repository</artifactId>
                        <type>eclipse-plugin</type>
                    </dependency>
                    <dependency>
                        <artifactId>org.eclipse.equinox.p2.touchpoint.natives</artifactId>
                        <type>eclipse-plugin</type>
                    </dependency>
                    <dependency>
                        <artifactId>org.eclipse.equinox.p2.touchpoint.eclipse</artifactId>
                        <type>eclipse-plugin</type>
                    </dependency>
                    <dependency>
                        <artifactId>org.eclipse.equinox.p2.artifact.repository
                        </artifactId>
                        <type>eclipse-plugin</type>
                    </dependency>
                    <dependency>
                        <artifactId>org.eclipse.equinox.p2.director.app</artifactId>
                        <type>eclipse-plugin</type>
                    </dependency>
                    <dependency>
                        <artifactId>org.eclipse.equinox.ds</artifactId>
                        <type>eclipse-plugin</type>
                    </dependency>
		    <dependency>
			<artifactId>org.eclipse.core.net</artifactId>
			<type>eclipse-plugin</type>
		    </dependency>
                </dependencies>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>eclipse-run</goal>
                    </goals>
                    <phase>compile</phase>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

tycho-eclipserun-plugin behind a proxy

If you're behind corporate firewall and you're forced to use proxy you have to configure p2 director to use your proxy. Here's the answer from tycho-eclipserun-plugin behind a proxy - solved by Martin Lippert:

<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-antrun-plugin</artifactId>
	<version>1.7</version>
	<executions>
		<execution>
			<id>configure-proxies-for-eclipserun</id>
			<phase>generate-resources</phase>
			<configuration>
				<target>
					<touch file="${project.build.directory}/work/configuration/.settings/org.eclipse.core.net.prefs" mkdirs="true" />
 
					<propertyfile file="${project.build.directory}/work/configuration/.settings/org.eclipse.core.net.prefs">
						<entry key="eclipse.preferences.version" value="1" />
						<entry key="nonProxiedHosts" value="${http.nonProxyHosts}" />
						<entry key="org.eclipse.core.net.hasMigrated" value="true" />
						<entry key="proxyData/HTTP/hasAuth" value="false" />
						<entry key="proxyData/HTTP/host" value="${http.proxyHost}" />
						<entry key="proxyData/HTTP/port" value="${http.proxyPort}" />
						<entry key="systemProxiesEnabled" value="false" />
					</propertyfile>
				</target>
			</configuration>
			<goals>
				<goal>run</goal>
			</goals>
		</execution>
	</executions>
</plugin>

Back to the top