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/Pack200"

(Hoe to set up your eclipse-repository to consume them ?)
m (Fix typo)
(3 intermediate revisions by one other user not shown)
Line 42: Line 42:
 
</source>
 
</source>
  
For each artifact, it will create the .pack.gz jar as well as the regualar jar.
+
For each artifact, it will create the .pack.gz jar as well as the regular jar.
  
This does not apply on a full repository. eclipse-repository can only consume existing pack200'ed artifacts, not generate some.
+
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 and Signing ==
Line 53: Line 53:
 
# pack200b:pack
 
# pack200b:pack
 
# Alter p2 metadata
 
# Alter p2 metadata
 +
 +
It is better to plugin those changes in the ''package'' phase, so the bundles that are signed are the ones that will be used by Surefire.
  
 
== Set eclipse-repository to include packed artifacts ==
 
== Set eclipse-repository to include packed artifacts ==
Line 71: Line 73:
 
Note that deprecated ''eclipse-update-site'' doesn't consider packed artifacts.
 
Note that deprecated ''eclipse-update-site'' doesn't consider packed artifacts.
  
== Pitfalls ==
+
== Others ==
  
 
=== Sources and pack200 ===
 
=== Sources and pack200 ===
  
The pack200 plugins are not aware of the source bundles, and then it's currently impossible to have packed source bundles https://bugs.eclipse.org/bugs/show_bug.cgi?id=396861
+
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.  
  
 
[[Category:Tycho|Pack200]]
 
[[Category:Tycho|Pack200]]

Revision as of 13:27, 11 April 2018

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 regular 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

It is better to plugin those changes in the package phase, so the bundles that are signed are the ones that will be used by Surefire.

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.

Back to the top