Skip to content

Frequently asked questions

howlger edited this page Mar 31, 2024 · 9 revisions

How to disable P2 mirrors?

Solution:

Often times eclipse.org redirects P2 repository requests to a another P2 mirror repository. This mirror might be broken, unavailable or mirroring might not be desired.

To disable the usage of P2 mirrors and force all downloads to go directly to the specified server specify the following maven command line parameter.

-Dtycho.disableP2Mirrors=true

It is also possible to set this property in a user/global settings.xml file. Here is settings.xml snippet:

<profiles>
   ...
   <profile>
     <id>p2</id>
     <properties>
       <tycho.disableP2Mirrors>true</tycho.disableP2Mirrors>
     </properties>
   </profile>
 </profiles>
 
 <activeProfiles>
   ...
   <activeProfile>p2</activeProfile>
 </activeProfiles>

Whether to use proxy or not is environment-specific configuration and as such does not belong in a pom.xml in the source tree.

Where is the documentation for the Tycho plug-ins?

Solution:

The Maven generated documentation is available at:

https://tycho.eclipseprojects.io/doc/latest/

How to use a different compiler version or a compiler like javac?

Solution:

Tycho always ships with latest Eclipse Compiler release by default. If you want you can always use an older (or never) release of Eclipse Compiler with this configuration:

<plugin>
  <groupId>org.eclipse.tycho</groupId>
  <artifactId>tycho-compiler-plugin</artifactId>
  <version>${tycho-version}</version>
  <dependencies>
    <dependency>
      <groupId>org.eclipse.jdt</groupId>
      <artifactId>ecj</artifactId>
      <version><!-- Your version here --></version>
    </dependency>
  </dependencies>
</plugin>

For example you can find all released versions here: https://mvnrepository.com/artifact/org.eclipse.jdt/ecj

Snapshot releases can be found here: https://repo.eclipse.org/content/repositories/eclipse-snapshots/org/eclipse/jdt/ecj

Using javac as compiler

As an alternative you can use javac as the compiler backend with Tycho:

<plugin>
	<groupId>org.eclipse.tycho</groupId>
	<artifactId>tycho-compiler-plugin</artifactId>
	<version>${tycho.version}</version>
	<configuration>
		<compilerId>javac</compilerId>
	</configuration>
</plugin>

How to convert an old-style update site (with a site.xml file) into a p2 update site?

Solution:

Old-style update sites (containing a site.xml file) can not be resolved in a Tycho build (causing the error message The p2 repository at ... contains partial IUs (see above) from an old style update site which cannot be used for dependency resolution). To convert an old-style update site into a p2 repository, do one of the following:

  • Mirror (remote or local) old-style update site as p2 update site:

    <properties>
    
        <!-- use Tycho 3.0.5, as mirroring of old-style update sites is no longer supported since 4.0.0 -->
        <tycho-version>3.0.5</tycho-version>
    
    </properties>
    <build>
        <plugins>
            <plugin>
                <groupId>org.eclipse.tycho.extras</groupId>
                <artifactId>tycho-p2-extras-plugin</artifactId>
                <version>${tycho-version}</version>
                <executions>
    
                    <!-- step 1: mirror old-style update site(s) (containing partial IUs) -->
                    <execution>
                        <id>mirror-update-sites</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>mirror</goal>
                        </goals>
                        <configuration>
    
                            <!-- sources: what to mirror and convert -->
                            <source>
                                <repository>
                                    <url>https://zipeditor.sourceforge.net/update</url>
                                </repository>
                                <!-- more update sites... -->
                            </source>
    
                            <!-- optional: only the following install units -->
                            <ius>
                                <iu>
                                    <id>zipeditor.feature.group</id>
                                </iu>
                                <!-- more install units... -->
                            </ius>
    
                            <!-- optional: only latest version -->
                            <latestVersionOnly>true</latestVersionOnly>
    
                            <!-- output directory: target/reopsitory/ (${project.build.directory}/repository)
                                 or specify the output directory as follows (needs also be adapted in step 2 and 3):
                            <destination>${project.basedir}/out</destination>
                            -->
    
                        </configuration>
                    </execution>
    
                    <!-- step 2: see below (via maven-antrun-plugin) -->
    
                    <!-- step 3: recreate the full p2 metadata for the mirrored artifacts -->
                    <execution>
                        <id>generate-full-metadata</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>publish-features-and-bundles</goal>
                        </goals>
                        <configuration>
                            <sourceLocation>${project.build.directory}/repository</sourceLocation>
                            <metadataRepositoryLocation>${project.build.directory}/repository</metadataRepositoryLocation>
                            <artifactRepositoryLocation>${project.build.directory}/repository</artifactRepositoryLocation>
                        </configuration>
                    </execution>
    
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>3.1.0</version>
                <executions>
    
                    <!-- step 2: strip all p2 metadata (as it contains partial IUs) -->
                    <execution>
                        <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>
  • Convert local 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>
                        <id>generate-full-metadata</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>publish-features-and-bundles</goal>
                        </goals>
                        <configuration>
    
                            <!-- input repository: -->
                            <sourceLocation>${project.basedir}/in</sourceLocation>
    
                            <!-- output repository: target/repository/
                                 or specify the output directory as follows: -->
                            <metadataRepositoryLocation>${project.basedir}/out</metadataRepositoryLocation>
                            <artifactRepositoryLocation>${project.basedir}/out</artifactRepositoryLocation>
    
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>