Jump to: navigation, search

Tycho/Pack200

Purpose and Generalities

Pack200 is a compression dedicated to Jar files that is recommended to use in eclipse p2 repositories. More details are available at http://docs.oracle.com/javase/1.5.0/docs/guide/deployment/deployment-guide/pack200.html and Pack200

Pack200 only

Add plugin execution pack200b:pack on your eclipse-plugin and eclipse-test-plugin to enable pack200 for them. In order to get your bundles generate their pack200'ed artifacts as well as regular jar, just add this to your pom:

<plugin>
	<groupId>org.eclipse.tycho.extras</groupId>
	<artifactId>tycho-pack200b-plugin</artifactId>
	<version>${tychoExtrasVersion}</version>
	<executions>
		<execution>
			<id>pack200-pack</id>
			<goals>
				<goal>pack</goal>
			</goals>
		</execution>
	</executions>
</plugin>
<!-- Then, alter p2-metadata to make the .pack.gz
artifact visible from other modules -->
<plugin>
	<groupId>org.eclipse.tycho</groupId>
	<artifactId>tycho-p2-plugin</artifactId>
	<version>${tychoVersion}</version>
	<executions>
		<execution>
			<id>p2-metadata</id>
			<goals>
				<goal>p2-metadata</goal>
			</goals>
			<phase>package</phase>
		</execution>
	</executions>
	<configuration>
		<defaultP2Metadata>false</defaultP2Metadata>
	</configuration>
</plugin>

For each artifact, it will create the .pack.gz jar as well as the regualar jar.

This does not apply on eclipse-plugin and eclipse-test-plugin packaging type since it creates the related pack200'ed bundles. It does not apply on features or repositories. however eclipse-repository can be onfigured to consume and embed pack200'ed artifacts, not generate some.

Pack200 and Signing

Pack200 is most commonly used together with jar singing and requires separate "normalization" phase . Because there are at least two ways to sign jars and because maven does not allow interleaving mojos from the same plugin with mojos from different plugins within the same build phase, it was necessary to split pack200 normalize and pack functionality between two separate maven plugins. The relevant part of build lifecycle looks like this:

  1. pack200a:normalize
  2. sign
  3. pack200b:pack
  4. Alter p2 metadata

Set eclipse-repository to include packed artifacts

eclipse-repository packaging type will automatically include packed artifacts (as well as regular jars) if they are available in the target-platform. To make target-platform, and then eclipse-repository, using .pack.gz stuff, you simply have to set the includePackedArtifacts parameter to true in your target-platform-configuration-plugin.

<plugin>
	<groupId>org.eclipse.tycho</groupId>
	<artifactId>target-platform-configuration</artifactId>
	<version>${tychoVersion}</version>
	<configuration>
		<includePackedArtifacts>true</includePackedArtifacts>
	</configuration>
</plugin>

Note that deprecated eclipse-update-site doesn't consider packed artifacts.

Others

Sources and pack200

pack200 is only a compression for .class files, so it does not make sense to ship pack200'ed source bundles. The pack200 plugins are not aware of the source bundles, and then it's impossible (but useless) to have packed source bundles.