Coder Social home page Coder Social logo

reficio / p2-maven-plugin Goto Github PK

View Code? Open in Web Editor NEW
226.0 18.0 100.0 797 KB

Maven3 plugin that automates the third-party dependency management for Eclipse RCP

Home Page: http://reficio.org

Shell 0.77% Groovy 38.31% Java 60.92%
eclipse-rcp hacktoberfest java maven maven-plugin p2

p2-maven-plugin's Introduction

p2-maven-plugin Java CI with Maven

Truly mavenize your Eclipse RCP project!

Intro

Welcome to the p2-maven-plugin! This is an easy-to-use Maven3 plugin responsible for the automation of the third-party dependency management in the Eclipse RCP environment.

Why should you bother?

Are you familiar with the automated dependency management like in Maven, Gradle or any other fancy tool? You just define a project descriptor, add a bunch of dependencies and everything happens "automagically"... Piece of cake huh?!

Well, there are, however, these RCP "unfortunates" for whom it is not quite that easy... Why's that, you might think?

Firstly, Eclipse RCP is an OSGi environment which extends the Java dependency model, so you can’t simply take a "jar" file and hope that it's going to work; believe me - it will not. Secondly, there are some additional RCP conventions that have to be followed, which makes it even more complex.

But wait! Isn't Tycho supposed to solve all of these problems? Yeah, well, Tycho can do a lot, but there is definitely "something" missing... What is more, the learning curve is really steep, so it’s very easy to go off down the wrong path wasting a lot of time on simple things.

The following blog entry outlines the problem perfectly: https://bit.ly/2XhgJSQ The author presents five different approaches how to configure the build and dependency management in a Tycho / Eclipse RCP project and, in the end, she couldn’t really propose a satisfactory solution! Unfortunately, there is no "one-click" easy solution, but if you stick to some best practices and use the right tools you can relax while Maven does most of the hard work for you.

p2-maven-plugin simply tries to bridge the gap between Maven-like and RCP-like dependency management styles so that all Maven features can be seamlessly used with "No Fear!"

Read further to fully understand why dependency management with Maven and Tycho is not that easy.

Java vs. Maven vs. Eclipse RCP - dependency war

In order to add a third-party dependency to an Eclipse RCP project the dependency has to reside in a P2 update site.

Eclipse (and other providers) provide a set of public update sites, but obviously not all popular and publicly available dependencies are there (that is the problem number #1). Pretty often you would also like to add a corporate / internal dependency - and you do not have to be a genius to figure out that it is not somewhere on the web…

Since Eclipse RCP is an OSGi environment in order to add a dependency to a p2 update site the dependency has to be an OSGi bundle (that is the problem number #2).

So, let's sum up for now: all our artifacts have to be OSGi bundles, but they are not always bundles and they have to be located in a P2 site, but we do not have that site. How do we proceed then?

It is not that difficult, there is a 'bnd' tool written by Peter Kriens that can transform your jars into bundles. There is also a convenience tool provided by Eclipse RCP that can generate a P2 site (in a cumbersome and painful way though). Both tools assume that all your jars/bundles are located in a local folder - which means that you have to download them by-hand. You could use Maven to automate it a bit, but there is a significant difference in the way how Maven calculates a dependency tree and this is not always compatible with the OSGi way (that is the problem number #3). Let us elaborate on it a bit more.

In a P2 update site, there may be three versions of the same dependency, as bundles may selectively include one class from version X, and a second class from version Y (that is normal in the world of OSGi). In Maven, though, if you specify two versions of a dependency only one of them will be fetched as you don't want to have two almost identical dependencies on your classpath (Java simply cannot deal with that).

So in essence, to solve all problems mentioned above you have to do three things by-hand:

  • download all required dependencies to a folder,
  • recognize which dependencies are not OSGi bundles and bundle them using the 'bnd' tool,
  • take all your bundles and invoke a P2 tool to generate a P2 update site.

Ufff, that is a mundane, cumbersome, repeatable and stupid activity that may take you a few hours - imagine now that you have to do it multiple times…

That's where p2-maven-plugin comes into play. It solves problems #1, #2, #3 and does all the hard work for you. Isn't that just brilliant? I think it is... :)

How to use it in 2 minutes?

Using p2-maven-plugin is really simple. I have prepared a quickstart pom.xml file so that you can give it a try right away. We're going to generate a site and expose it using the jetty-maven-plugin. This example is located here: https://github.com/reficio/p2-maven-plugin/blob/master/examples/quickstart/pom.xml

p2-maven-plugin is now on maven central. You can find the latest version number here https://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.reficio%22%20AND%20a%3A%22p2-maven-plugin%22

Here's the pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001 XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.reficio.rcp</groupId>
    <artifactId>example-p2-site</artifactId>
    <packaging>pom</packaging>
    <version>1.5.1-SNAPSHOT</version>

    <build>
        <plugins>
            <plugin>
                <groupId>org.reficio</groupId>
                <artifactId>p2-maven-plugin</artifactId>
                <version>1.3.0</version>
                <executions>
                    <execution>
                        <id>default-cli</id>
                        <configuration>
                            <artifacts>
                                <!-- specify your depencies here -->
                                <!-- groupId:artifactId:version -->
                                <artifact><id>commons-io:commons-io:2.1</id></artifact>
                                <artifact><id>commons-lang:commons-lang:2.4</id></artifact>
                                <artifact><id>commons-lang:commons-lang:2.5</id></artifact>
                                <artifact><id>commons-lang:commons-lang:2.6</id></artifact>
                                <artifact><id>org.apache.commons:commons-lang3:3.1</id></artifact>
                            </artifacts>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>8.1.5.v20120716</version>
                <configuration>
                    <scanIntervalSeconds>10</scanIntervalSeconds>
                    <webAppSourceDirectory>${project.basedir}/target/repository/</webAppSourceDirectory>
                    <webApp>
                        <contextPath>/site</contextPath>
                    </webApp>
                </configuration>
            </plugin>

        </plugins>
    </build>

</project>

The artifacts may be specified using the following notation:

<groupId>:<artifactId>[:<extension>[:<classifier>]]:<version>

There are many more config options, but basically that's the thing that you need for now. in order to generate the site invoke the following command 'mvn p2:site' in the folder where the pom.xml file resides. When the process finishes your P2 site is ready!

You will see the following output:

$ mvn p2:site

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building example-p2-site 1.0.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- p2-maven-plugin:1.0.0:site (generate-p2-site) @ example-p2-site ---
[INFO] Command line:
    /bin/sh -c cd /opt/workspaces/reficio/p2-maven-plugin/src/main/resources && /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/
    Home/bin/java -jar /opt/maven-ext/org/eclipse/tycho/tycho-bundles-external/0.14.0/eclipse/plugins/
    org.eclipse.equinox.launcher_1.3.0.v20111107-1631.jar -nosplash -application org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher
    -artifactRepository file:/opt/workspaces/reficio/p2-maven-plugin/src/main/resources/target/repository -metadataRepository file:/opt/
    workspaces/reficio/p2-maven-plugin/src/main/resources/target/repository -publishArtifacts -compress -source /opt/workspaces/reficio/p2-
    maven-plugin/src/main/resources/target/source
Generating metadata for ..
Generation completed with success [0 seconds].
[INFO] Command line:
    /bin/sh -c cd /opt/workspaces/reficio/p2-maven-plugin/src/main/resources/target/repository && /System/Library/Java/JavaVirtualMachines/
    1.6.0.jdk/Contents/Home/bin/java -jar /opt/maven-ext/org/eclipse/tycho/tycho-bundles-external/0.14.0/eclipse/plugins/
    org.eclipse.equinox.launcher_1.3.0.v20111107-1631.jar -nosplash -application org.eclipse.equinox.p2.publisher.CategoryPublisher -
    categoryDefinition file:/opt/workspaces/reficio/p2-maven-plugin/src/main/resources/target/repository/category.xml -metadataRepository
    file:/opt/workspaces/reficio/p2-maven-plugin/src/main/resources/target/repository/        
Generating metadata for ..
Generation completed with success [0 seconds].
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.164s
[INFO] Finished at: Sat Jul 07 16:28:49 CEST 2012
[INFO] Final Memory: 7M/81M
[INFO] ------------------------------------------------------------------------

Your p2 site is located in the target/repository folder and looks like this:

pom.xml
target
├── repository
│   ├── artifacts.jar
│   ├── category.xml
│   ├── content.jar
│   └── plugins
│   │   ├── org.apache.commons.io_2.1.0.jar
│   │   ├── org.apache.commons.lang_2.4.0.jar
│   │   ├── org.apache.commons.lang_2.5.0.jar
│   │   ├── org.apache.commons.lang_2.6.0.jar
│   │   └── org.apache.commons.lang3_3.1.0.jar
│   │
│   └── features
│   │   └── com.example.feature_1.0.0.jar

Unfortunately, it's not the end of the story since tycho does not support local repositories (being more precise: repositories located in a local folder). The only way to work it around is to expose our newly created update site using an HTTP server. We're going to use the jetty-plugin - don't worry, the example above contains a sample jetty-plugin set-up. Just type 'mvn jetty:run' and open the following link http://localhost:8080/site. Your P2 update site will be there!

Now, simply reference your site in your target definition and play with your Eclipse RCP project like you were in the Plain Old Java Environment. Remember to enable the "Group items by category" option, otherwise you will not see any bundles.

$ mvn jetty:run

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building example-p2-site 1.0.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> jetty-maven-plugin:8.1.5.v20120716:run (default-cli) @ example-p2-site >>>
[INFO]
[INFO] <<< jetty-maven-plugin:8.1.5.v20120716:run (default-cli) @ example-p2-site <<<
[INFO]
[INFO] --- jetty-maven-plugin:8.1.5.v20120716:run (default-cli) @ example-p2-site ---
[INFO] Configuring Jetty for project: example-p2-site
[INFO] Webapp source directory = /opt/workspaces/reficio/p2-maven-plugin/examples/quickstart/target/repository
[INFO] Reload Mechanic: automatic
[INFO] Classes directory /opt/workspaces/reficio/p2-maven-plugin/examples/quickstart/target/classes does not exist
[INFO] Context path = /site
[INFO] Tmp directory = /opt/workspaces/reficio/p2-maven-plugin/examples/quickstart/target/tmp
[INFO] Web defaults = org/eclipse/jetty/webapp/webdefault.xml
[INFO] Web overrides =  none
[INFO] web.xml file = null
[INFO] Webapp directory = /opt/workspaces/reficio/p2-maven-plugin/examples/quickstart/target/repository
2012-08-20 14:20:13.473:INFO:oejs.Server:jetty-8.1.5.v20120716
2012-08-20 14:20:13.582:INFO:oejpw.PlusConfiguration:No Transaction manager found - if your webapp requires one, please configure one.
2012-08-20 14:20:13.878:INFO:oejsh.ContextHandler:started o.m.j.p.JettyWebAppContext{/site,file:/opt/workspaces/reficio/p2-maven-plugin/examples/quickstart/target/repository/},file:/opt/workspaces/reficio/p2-maven-plugin/examples/quickstart/target/repository/
2012-08-20 14:20:13.878:INFO:oejsh.ContextHandler:started o.m.j.p.JettyWebAppContext{/site,file:/opt/workspaces/reficio/p2-maven-plugin/examples/quickstart/target/repository/},file:/opt/workspaces/reficio/p2-maven-plugin/examples/quickstart/target/repository/
2012-08-20 14:20:13.878:INFO:oejsh.ContextHandler:started o.m.j.p.JettyWebAppContext{/site,file:/opt/workspaces/reficio/p2-maven-plugin/examples/quickstart/target/repository/},file:/opt/workspaces/reficio/p2-maven-plugin/examples/quickstart/target/repository/
2012-08-20 14:20:13.938:INFO:oejs.AbstractConnector:Started [email protected]:8080
[INFO] Started Jetty Server
[INFO] Starting scanner at interval of 10 seconds.

Best Practices

  • DO NOT to use the Tycho's pomDependencies->consider option as it is simply of NO good
  • DO NOT define your external dependencies in the dependencies section of the pom.xml (mvn compilation will work in the console, but it will not work in the Eclipse IDE when you import the project, since the 'Target Configuration' knows nothing about the dependencies defined there)
  • Use the MANIFEST-FIRST approach - define all your dependencies in the MANIFEST.MF files.
  • If some of your dependencies are not OSGi bundles or are not available in P2 update sites, SIMPLY define them in the p2-maven-plugin config, generate the site and make it available using jetty (or any other mechanism). Then add the URL of the exposed site to the target platform definition. In such a way you will have a consistent, manifest-first dependency management in Eclipse RCP project!
  • Whenever you have to add another external dependency, simply re-invoke "mvn p2:site" and the site will be regenerated.
  • You can automate the generation/exposition of our site using for example Jenkins and Apache2

Maven compatibility

p2-maven-plugin is compatible with Maven 3.x (we test it against 3.0.x, 3.1.x, 3.2.x)

Examples

There are many more use examples, just have a look:

Default options

This example is located here: https://github.com/reficio/p2-maven-plugin/blob/master/examples/quickstart/pom.xml

This is the simplest and the shortest setup. Only the identifiers of the dependencies have to be specified. What will be the behavior like if we use the configuration listed below?

  • specified dependencies will be fetched
  • transitive dependencies will be fetched
  • jars containing source code will NOT be fetched
  • jars that are NOT osgi bundles will be "bundled" using bnd tool; if instructions are specified, they will be APPLIED.
  • errors thrown by bnd tool are ignored
  • jars that are osgi bundles will be simply included, if instructions are specified, they will be IGNORED (see override example)
  • p2 site will be generated

How the instructions works:

  • instructions are applied only to the root artifact that you specify!
  • instructions are not applied to the TRANSITIVE dependencies!
  • transitive dependencies are never overridden (see <override> option)
  • transitive dependencies are bundled using the default instructions quoted below.
  • other instructions, such as, Bundle-SymbolicName, Bundle-Name, Bundle-Version, etc. are calculated according to the following rules: http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html
  • if you specify any instructions they will be applied only if the jar is not already an OSGi bundle - otherwise you have to use the override option - please see the /examples/override/pom.xml example

The default instructions are:

<instructions>
    <Import-Package>*;resolution:=optional</Import-Package>
    <Export-Package>*</Export-Package>
    <_fixupmessages>"Classes found in the wrong directory";is:=warning</_fixupmessages>
    <_removeheaders>Bnd-LastModified</_removeheaders>
    <_reproducible>true</_reproducible>
</instructions>

The following definition of an artifact:

<artifact>
    <id>commons-io:commons-io:2.1</id>
</artifact>

is an equivalent of the following definition:

<artifact>
    <id>commons-io:commons-io:2.1</id>
    <transitive>true</transitive>
    <source>false</source>
    <override>false</override>
    <singleton>false</singleton>
    <instructions>
        <Import-Package>*;resolution:=optional</Import-Package>
        <Export-Package>*</Export-Package>
        <_fixupmessages>"Classes found in the wrong directory";is:=warning</_fixupmessages>
        <_removeheaders>Bnd-LastModified</_removeheaders>
        <_reproducible>true</_reproducible>
    </instructions>
    <excludes/>
</artifact>

If the instruction name cannot be used as a XML tag (for example -noee), you can use the properties format:

<instructionsProperties>
    <property>
        <name>-noee</name>
        <value>true</value>
    </property>
</instructionsProperties>

Instructions in properties format take precedence over the ones in map format in case of duplicates, which means that if you defined the same instruction both in properties and map format, the value from properties will be used and the warning will be printed to log.

Source option

This example is located here: https://github.com/reficio/p2-maven-plugin/blob/master/examples/source/pom.xml

This is the configuration snippet that enables you to include the source jars and generate the source bundles for all the dependencies. <source>true</source> section has to be included to enable this option. If enabled together with the transitive option it will fetch sources of transitive dependencies as well. Furthermore, it will sanitize source bundle manifest headers, if they are not correct.

Example:

<artifact>
    <id>commons-io:commons-io:2.1</id>
    <source>true</source>
</artifact>

Transitive option

This example is located here: https://github.com/reficio/p2-maven-plugin/blob/master/examples/transitive/pom.xml

This is the configuration snippet that enables you to exclude transitive dependencies. <transitive>false</transitive> section has to be included to enable this option.

Expected behavior:

  • specified dependencies will be fetched
  • transitive dependencies will NOT be fetched

Example usage:

<artifact>
    <id>org.mockito:mockito-core:1.9.0</id>
    <transitive>false</transitive>
</artifact>

Skip BND tool errors option

This example is located here: https://github.com/reficio/p2-maven-plugin/blob/master/examples/bnd-errors/pom.xml

Because of backward compatibility, BND tool errors are ignored by default. You can break the P2 build when BND tool produces errors with the flag <ignoreBndErrors>false</ignoreBndErrors> in the <configuration> section.

Maven phase binding

This example is located here: https://github.com/reficio/p2-maven-plugin/blob/master/examples/phase/pom.xml

You can also bind the invocation of the plugin to a Maven phase. Just specify the following binding and your p2-maven-plugin will be invoked during the 'mvn compile' phase.

<execution>
    <id>generate-p2-site</id>
    <phase>compile</phase>
    <goals>
        <goal>site</goal>
    </goals>
</execution>

Override option

This example is located here: https://github.com/reficio/p2-maven-plugin/blob/master/examples/override/pom.xml

This is the configuration snippet that enables you to override the default MANIFEST.MF files in jars that are already OSGi bundles. <override>true</override> section has to be included to enable this option

To manually set the instructions please specify the <instructions> section in the configuration of the artifact. If you do not specify any instructions the MANIFEST.MF file will be overridden with the default instructions. Please see the examples/quickstart/pom.xml for more info.

Remember:

  • override flag does not apply to the transitive dependencies
  • instructions are not applied to the transitive dependencies

Expected behavior:

  • jars that are OSGi bundles will be "bundled" once more using the bnd tool overriding the default MANIFEST.MF
  • if you specify instructions for these jars they will be APPLIED (not to the transitive dependencies though)

The following example presents how to enable the override option:

<artifact>
    <id>commons-io:commons-io:2.1</id>
    <override>true</override>
</artifact>

The following example presents how to enable the override option specifying the instructions:

<artifact>
    <id>commons-io:commons-io:2.1</id>
    <override>true</override>
    <singleton>false</singleton>
    <instructions>
        <Import-Package>*;resolution:=optional</Import-Package>
        <Export-Package>*</Export-Package>
        <_fixupmessages>"Classes found in the wrong directory";is:=warning</_fixupmessages>
        <_removeheaders>Bnd-LastModified</_removeheaders>
        <_reproducible>true</_reproducible>
    </instructions>
</artifact>

This definition of an artifact should look like this:

<artifact>
    <id>commons-io:commons-io:2.1</id>
    <transitive>false</transitive>
    <override>true</override>
</artifact>

Excludes option

This example is located here: https://github.com/reficio/p2-maven-plugin/blob/master/examples/excludes/pom.xml This examples presents how to selectively exclude some of the transitive dependencies of an artifact. In order to enable this functionality the <excludes> section has to be included in the configuration of the artifact. If the fetch of the transitive dependencies is disabled through the <transitive>false</transitive> switch the <excludes> section will be ignored.

The <excludes> resolver reuses the org.sonatype.aether.util.filter.PatternExclusionsDependencyFilter that works in the following way: "PatternExclusionsDependencyFilter is a simple filter to exclude artifacts specified by patterns. The artifact pattern syntax has the following format: [groupId]:[artifactId]:[extension]:[version]. Each segment of the pattern is optional and supports 'full' and 'partial' wildcards (*). An empty pattern segment is treated as an implicit wildcard. Version can be a range in case a {@link VersionScheme} is specified."

Examples of <exclude> values:

  • <exclude>org.apache.*</exclude> matches artifacts whose group-id begins with 'org.apache.'
  • <exclude>:::*-SNAPSHOT</exclude> matches all snapshot artifacts
  • <exclude>:objenesis::</exclude> matches artifacts whose artifactId is objenesis
  • <exclude>*</exclude> matches all artifacts
  • <exclude>:::</exclude> (or <exclude>*:*:*:*</exclude>) matches all artifacts
  • <exclude></exclude> matches all artifacts

Expected behavior:

  • selected transitive dependencies will be fetched

Example usage:

<artifact>
    <id>org.mockito:mockito-core:1.9.0</id>
    <source>false</source>
    <transitive>true</transitive>
    <excludes>
        <exclude>org.objenesis:objenesis:jar:1.0</exclude>
    </excludes>
</artifact>

Singleton option

This is the configuration snippet that enables you to generate singleton bundles. <singleton>true</singleton> section has to be included to enable this option.

Expected behavior:

  • bundle will have a "singleton:=true" string added to its symbolic name
  • remember that the build may fail if the artifact is already a bundle and the singleton is set to true and the override option is skipped or set to false.

Example usage:

<artifact>
    <id>org.mockito:mockito-core:1.9.0</id>
    <singleton>true</singleton>
</artifact>

P2 Resolver

The plugin also includes the P2 resolver which means that you can include bundles residing in P2 repositories in the generated site. Have a look at the P2 example located here: https://github.com/reficio/p2-maven-plugin/blob/master/examples/p2/pom.xml

In order to have a P2 artifact resolved include its definition in the <p2> tag (not in the <artifacts> tag)

<p2>
    <artifact>
        <id>org.junit:4.11.0.v201303080030</id>
    </artifact>
</p2>

Next, add a P2 repository in the <repositories> tag (its layout has to be set to <layout>p2</layout>):

    <repositories>
        <repository>
            <id>kepler</id>
            <url>http://download.eclipse.org/tools/orbit/downloads/drops/R20130517111416/repository/</url>
            <layout>p2</layout>
        </repository>
    </repositories>

If there's more P2 repositories defined, they will be taken in the top-down manner, until the artifact resolution has been successfully executed.

As a result the the specified P2 artifact will be downloaded and included in the generated P2 site. It will not be bundled, since all P2 artifacts are alread OSGi bundles by definition.

Eclipse Features

You can also add eclipse feature bundles to maven and include them in the generated p2 repository.

  • build may fail if the maven artifact is not a valid eclipse feature jar
  • source and transitive must both be false for feature artifacts
  • plugins must be added separately, adding the feature will not add the corresponding plugins

Example usage:

<configuration>
    <artifacts>
        <artifact><id>org.apache.commons:commons-lang3:3.1</id></artifact>
    </artifacts>
    <features>
        <artifact>
            <id>org.reficio:test.feature:1.0.0</id>
            <source>false</source>
            <transitive>false</transitive>
        </artifact>
    </features>
</configuration>

Your p2 site will look like this:

pom.xml
target
├── repository
│   ├── artifacts.jar
│   ├── category.xml
│   ├── content.jar
│   └── plugins
│   │   └── org.apache.commons.lang3_3.1.0.jar
│   │
│   └── features
│       └── com.example.feature_1.0.0.jar

You can have a look at two integration test cases of this feature that are located in the src/test/integration folder:

  • feature-bundle-01-it
  • feature-bundle-02-it

Other tricks

Alternatively, you can get this plugin to generate the feature bundles for you as part of generating the p2 repository,

Example usage:

	<configuration>
		<featureDefinitions>
			<feature>
				<id>test.feature</id>
				<version>${project.version}</version>
				<label>Test Feature 2</label>
				<providerName>${project.groupId}</providerName>
				<description>${project.description}</description>
				<copyright>A copyright</copyright>
				<license>A licence</license>
				<generateSourceFeature>true</generateSourceFeature>
				<artifacts>
					<artifact>
						<id>org.reficio.rcp:test.bundle1:1.0.0</id>
						<transitive>false</transitive>
						<source>true</source>
					</artifact>
					<artifact>
						<id>org.reficio.rcp:test.bundle2:1.0.0-SNAPSHOT</id>
						<transitive>false</transitive>
						<source>true</source>
					</artifact>
				</artifacts>									
			</feature>
		</featureDefinitions>
	</configuration>

Note: Up to version 1.3 unresolvable artifacts inside <featureDefinitions> did not cause the build to fail. The problem was only logged and the artifacts were omitted from the feature. This has been corrected in version 1.4 and the build will fail in such situations.

Other features

  • p2-maven-plugin will tweak the version of a snapshot dependency replacing the SNAPSHOT string with a timestamp in the following format "yyyyMMddHHmmss" (feature #14)
  • It's possible to add a classifier to the artifact definition - supported notation: <groupId>:<artifactId>[:<extension>[:<classifier>]]:<version>; for example: <id>groupid:artifactid:jar:tests:version</id> (feature #28)

General configuration options

There are some other plugin options that you can specify in the configuration:

OptionDefault valueDescription
destinationDirectory ${project.basedir}/target/repository Folder where the generated p2 site should be copied to
categoryFileURL default category file (all plugins in one category) URL of the category.xml file which should be used for the p2 site generation
pedantic false Specifies if the bnd tool should be pedantic
compressSite true Specifies if to compress the descriptors of the generated site
forkedProcessTimeoutInSeconds 0 (infinite) Kill the p2 forked process after a certain number of seconds.
additionalArgs Specifies additional arguments to p2Launcher, for example -consoleLog -debug -verbose
skipInvalidArtifacts false Controls if the processing should be continued if bundling errors occur.
skipNotExistingArtifacts false Controls if the processing should be continued if an artifact could not be resolved.

Sample configuration snippet with the additional options:

<configuration>
    <pedantic>false</pedantic>
    <additionalArgs>-consoleLog -debug -verbose</additionalArgs>
    <compressSite>true</compressSite>
    <forkedProcessTimeoutInSeconds>0</forkedProcessTimeoutInSeconds>
</configuration>

Last but not least

Reporting bugs

Please describe the issue thoroughly. Please include a minimal pom.xml file that can be used to reproduce the problem.

Pull requests

If you submit a pull request please make sure to add an unit/integration test case that covers the feature. Pull requests without a proper test coverage may not be pulled at all. Ensure that the pull request title matches the title of the issue. The title of the pull request is used for the automated generated release notes.

Running integration tests

Invoke the following command to run the integration tests suite:

$ mvn verify -Pit

Running the spotbugs checks

Invoke the following command to run the spotbugs checks:

$ mvn verify -Pspotbugs

Releasing

Run the release.sh script (syntax: master version, release version, new master version):

$ ./release.sh 1.3.0-SNAPSHOT 1.3.0 1.4.0-SNAPSHOT

This script creates a git tag and deploys the Maven artifact to Maven Central. It requires that PGP is configured as documented on Maven's Guide to uploading artifacts to the Central Repository

Who's behind it?

Do you like the project? Star it on GitHub and follow me on Twitter! Thanks!

http://twitter.com/tombujok

Reficio™ - Reestablish your software! www.reficio.org

p2-maven-plugin's People

Contributors

a-s-nikolaichuk avatar aalmiray avatar bananeweizen avatar bitdeli-chef avatar bmarwell avatar daus-salar avatar dependabot[bot] avatar dhakehurst avatar emweber avatar evra avatar jldelarbre avatar kdoteu avatar lukejackson avatar maggu2810 avatar meai1 avatar reinsch82 avatar renovate-bot avatar renovate[bot] avatar sarod avatar sgratzl avatar sparsick avatar sratz avatar szarnyasg avatar the-alchemist avatar timtebeek avatar tombujok avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

p2-maven-plugin's Issues

Feature based Ordering

Is there a way to organzie the dependencies into Features?
So you can use this plugin to build feature-based p2-site with third party-bundles.
This would solve every of my problems managing depencies for my developer-team.

Adding Bundle Symbolic Name instruction doesn't change Source bundle name

If you do something like the following:

<artifact>
        <id>rhino:js:1.7R2</id>
        <source>true</source>
        <transitive>false</transitive>
        <instructions>
             <Bundle-SymbolicName>org.mozilla.javascript</Bundle-SymbolicName>
             <Bundle-Version>1.7.2</Bundle-Version>
         </instructions>
  </artifact> 

The bundle is updated appropriately, but the source bundle that is created, still has the old name. it gets generated as:

rhino.js.source_1.0.0.7R2

Ideally these should be generated as:
org.mozilla.javascript.source_1.7.2.jar

Allow Creation of Features and Source Features

It would be nice to also add optional source features as part of the build. Or figure some way to inject the generated source bundles so that Tycho can see this. Maybe leveraging the tycho-extras source feature plugin to create the feature.

A plugin repository unfortunately can't be mirrored with the tycho-extras mirror goal. It alwasy expects to have features to work from.

Hmmm...might not need the feature after all since the Category.xml is in place. Would still be nice though to beable to specifically specify the feature for source bundles.

Bug with POM file and depedency

I'm trying to dowload a personnal plugin from a private server. I have already configured the server id, the user and password in settings.xml.

But when I execute the mvn p2:site command i become the follwing error :

Downloading: http://yoda.haslerrail.net:8081/nexus/content/repositories/releases/com/haslerrail/schema/haslerrailschema/0.1.7/haslerrailschema-0.1.7.pom
Downloading: http://repo.reficio.org/maven/com/haslerrail/schema/haslerrailschema/0.1.7/haslerrailschema-0.1.7.pom
[WARNING] The POM for com.haslerrail.schema:haslerrailschema:jar:0.1.7 is missing, no dependency information available
[WARNING] Failed to retrieve plugin descriptor for com.haslerrail.schema:haslerrailschema:0.1.7: Plugin com.haslerrail.schema:haslerrailschema:0.1.7 or one of its dependencies could not be resolved: Failed to read artifact descriptor for com.haslerrail.schema:haslerrailschema:jar:0.1.7

Here is my POM file :

<groupId>org.reficio.rcp</groupId>
<artifactId>example-p2-site</artifactId>
<packaging>pom</packaging>
<version>1.0.0</version>

<build>

    <plugins>


        <plugin>
            <groupId>com.haslerrail.schema</groupId>
            <artifactId>haslerrailschema</artifactId>
            <version>0.1.7</version>
            <executions>
                <execution>
                    <configuration>
                        <artifacts>
                            <artifact>
                                <id>haslerrailschema:0.1.7</id>
                            </artifact>
                        </artifacts>
                    </configuration>
                </execution>
            </executions>
        </plugin>

        <plugin>

            <groupId>org.reficio</groupId>
            <artifactId>p2-maven-plugin</artifactId>
            <version>1.1.0</version>

            <executions>
                <execution>
                    <id>default-cli</id>
                    <configuration>
                        <artifacts>
                            <artifact>
                                <id>commons-logging:commons-logging:1.1.1</id>
                            </artifact>
                            <artifact>
                                <id>commons-io:commons-io:1.3.2</id>
                                <source>true</source>
                            </artifact>
                            <artifact>
                                <id>commons-lang:commons-lang:2.4</id>
                            </artifact>
                            <artifact>
                                <id>commons-lang:commons-lang:2.5</id>
                            </artifact>
                            <artifact>
                                <id>commons-lang:commons-lang:2.6</id>
                            </artifact>
                            <artifact>
                                <id>org.apache.commons:commons-lang3:3.1</id>
                            </artifact>
                        </artifacts>
                    </configuration>
                </execution>
            </executions>
        </plugin>

    </plugins>

</build>

<pluginRepositories>
    <pluginRepository>
        <!-- http://yoda.haslerrail.net:8081/nexus -->
        <id>haslerrail</id>
        <url>http://yoda.haslerrail.net:8081/nexus/content/repositories/releases/</url>
    </pluginRepository>


    <pluginRepository>
        <id>reficio</id>
        <url>http://repo.reficio.org/maven/</url>
    </pluginRepository>

</pluginRepositories>
<!-- <distributionManagement> <repository> <id>release</id> <url>http://localhost:8081/nexus/content/repositories/Tycho/</url> 
    </repository> </distributionManagement> -->

I have attached a print screen of the structure i have after this execution but i didn't have my personnal plugin in plugins repository...

project

Here is the structure of my plugin :

structure

This is so i don't understand why he say "POM is missing"...

Thank you if you can help me

having a dependency to spring-data-neo4j seems to fail

I've added org.springframework.data:spring-data-neo4j:2.3.2.RELEASE as a dependency, created the p2 site and added all the items into the target.

I get the error below:
image

Though aop allience seems to be in the repository:
image

Pb when using tycho-0.21.0 or 0.22.0

Running the plugin works well when using tycho 0.20.0, but when I try with 0.21 or 0.22, I get some errors like :

[ERROR] Failed to execute goal org.reficio:p2-maven-plugin:1.1.1:site (default-cli) on project eclipse-target-platform: Execution default-cli of goal org.reficio:p2-maven-plugin:1.1.1:site failed: org.apache.maven.plugin.MojoExecutionException: Unable to execute mojo: Execution null of goal org.eclipse.tycho.extras:tycho-p2-extras-plugin:0.18.1:publish-features-and-bundles failed: A required class was missing while executing org.eclipse.tycho.extras:tycho-p2-extras-plugin:0.18.1:publish-features-and-bundles: org/eclipse/tycho/core/osgitools/targetplatform/DefaultTargetPlatform
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.eclipse.tycho.extras:tycho-p2-extras-plugin:0.18.1
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/Users/elecharny/.m2/repository/org/eclipse/tycho/extras/tycho-p2-extras-plugin/0.18.1/tycho-p2-extras-plugin-0.18.1.jar
[ERROR] urls[1] = file:/Users/elecharny/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar
[ERROR] urls[2] = file:/Users/elecharny/.m2/repository/org/sonatype/aether/aether-util/1.7/aether-util-1.7.jar
[ERROR] urls[3] = file:/Users/elecharny/.m2/repository/org/sonatype/sisu/sisu-inject-bean/1.4.2/sisu-inject-bean-1.4.2.jar
[ERROR] urls[4] = file:/Users/elecharny/.m2/repository/org/sonatype/sisu/sisu-guice/2.1.7/sisu-guice-2.1.7-noaop.jar
[ERROR] urls[5] = file:/Users/elecharny/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.14/plexus-interpolation-1.14.jar
[ERROR] urls[6] = file:/Users/elecharny/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
[ERROR] urls[7] = file:/Users/elecharny/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[8] = file:/Users/elecharny/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.7/plexus-utils-3.0.7.jar
[ERROR] urls[9] = file:/Users/elecharny/.m2/repository/org/codehaus/plexus/plexus-archiver/2.2/plexus-archiver-2.2.jar
[ERROR] urls[10] = file:/Users/elecharny/.m2/repository/org/codehaus/plexus/plexus-io/2.0.4/plexus-io-2.0.4.jar
[ERROR] urls[11] = file:/Users/elecharny/.m2/repository/org/eclipse/tycho/sisu-equinox-launching/0.18.1/sisu-equinox-launching-0.18.1.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[project>org.apache.directory.studio:eclipse-target-platform:2.0.0-SNAPSHOT, parent: ClassRealm[maven.api, parent: null]]]

Corrupted Signed Jars

It appears that the latest build may be causing signed jars to be corrupted. Every osgi I bundle I load into a nexus repository from eclipse, and then try to use during a tycho build after being pulled into a p2 repo created by p2-maven-plugin is complaining about signing errors.

I believe if the plugin isn't already it should skip doing anything to jars that are signed. And fail if somebody tries to do an override on signed jars.

Just a big THX (no Issue)

Hello, just a quick thank you! This Plugin is the answer to all my Problems (well not all, but work related :o). Also the Documentation reads amazing! Carry on.

Issues building a p2 site for particular maven artifact

Hi all,

I am having a problem building a p2 site that contains the following artifact:
org.apache.jclouds.labs:openstack-neutron:1.8.0

Any insights would be very valuable.

Regards,
Nicholas

------ POM.XML -------


4.0.0
org.jclouds
p2-site
0.0.1-SNAPSHOT
pom

<build>
    <plugins>
        <plugin>
            <groupId>org.reficio</groupId>
            <artifactId>p2-maven-plugin</artifactId>
            <version>1.1.1-SNAPSHOT</version>
            <executions>
                <execution>
                    <id>default-cli</id>
                </execution>
            </executions>
            <configuration>
                <artifacts>
                    <artifact>
                        <id>org.apache.jclouds.labs:openstack-neutron:1.7.3</id>
                    </artifact>
                </artifacts>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jetty-maven-plugin</artifactId>
            <version>8.1.5.v20120716</version>
            <configuration>
                <scanIntervalSeconds>10</scanIntervalSeconds>
                <webAppSourceDirectory>${basedir}/target/repository/</webAppSourceDirectory>
                <webApp>
                    <contextPath>/site</contextPath>
                </webApp>
            </configuration>
        </plugin>
    </plugins>
</build>


<pluginRepositories>
    <pluginRepository>
        <id>reficio</id>
        <url>http://repo.reficio.org/maven/</url>
    </pluginRepository>
</pluginRepositories>

------------------------ Stack trace:- ----------------------------------

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building p2-site 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- p2-maven-plugin:1.1.1-SNAPSHOT:site (default-cli) @ p2-site ---
[info] Resolving artifact=[org.apache.jclouds.labs:openstack-neutron:1.8.0] transitive=[false] source=[false]
[info] [JAR] openstack-neutron-1.8.0.jar
[info] Executing Bundler:
[info] [SKIP] openstack-neutron-1.8.0.jar
[INFO] Command line:
/bin/sh -c cd /home/nickl/workspace/openstack-neutron && /usr/lib/jvm/java-6-openjdk/jre/bin/java -jar /home/nickl/.m2/repository/org/eclipse/tycho/tycho-bundles-external/0.18.1/eclipse/plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar -configuration /tmp/tycho-p2-runtime5358553969148673763.tmp/configuration -nosplash -application org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher -artifactRepository file:/home/nickl/workspace/openstack-neutron/target/repository -metadataRepository file:/home/nickl/workspace/openstack-neutron/target/repository -publishArtifacts -compress -source /home/nickl/workspace/openstack-neutron/target/source
Generating metadata for ..
Status ERROR: org.eclipse.equinox.p2.artifact.repository code=0 invalid range "${jclouds.version}": invalid version "${jclouds.version}": non-numeric "${jclouds" java.lang.IllegalArgumentException: invalid range "${jclouds.version}": invalid version "${jclouds.version}": non-numeric "${jclouds"

Product publishing ended with the following exception:
java.lang.IllegalArgumentException: invalid range "${jclouds.version}": invalid version "${jclouds.version}": non-numeric "${jclouds"
at org.osgi.framework.VersionRange.parseVersion(VersionRange.java:196)
at org.osgi.framework.VersionRange.(VersionRange.java:150)
at org.eclipse.osgi.service.resolver.VersionRange.(VersionRange.java:68)
at org.eclipse.osgi.internal.resolver.StateBuilder.getVersionRange(StateBuilder.java:805)
at org.eclipse.osgi.internal.resolver.StateBuilder.addImportPackages(StateBuilder.java:293)
at org.eclipse.osgi.internal.resolver.StateBuilder.createImportPackages(StateBuilder.java:272)
at org.eclipse.osgi.internal.resolver.StateBuilder.createBundleDescription(StateBuilder.java:117)
at org.eclipse.osgi.internal.resolver.StateObjectFactoryImpl.createBundleDescription(StateObjectFactoryImpl.java:33)
at org.eclipse.equinox.p2.publisher.eclipse.BundlesAction.createBundleDescription(BundlesAction.java:541)
at org.eclipse.equinox.p2.publisher.eclipse.BundlesAction.createBundleDescription(BundlesAction.java:577)
at org.eclipse.equinox.p2.publisher.eclipse.BundlesAction.getBundleDescriptions(BundlesAction.java:891)
at org.eclipse.equinox.p2.publisher.eclipse.BundlesAction.perform(BundlesAction.java:711)
at org.eclipse.equinox.p2.publisher.Publisher$ArtifactProcess.run(Publisher.java:207)
at org.eclipse.equinox.internal.p2.artifact.repository.simple.SimpleArtifactRepository.executeBatch(SimpleArtifactRepository.java:1344)
at org.eclipse.equinox.p2.publisher.Publisher.publish(Publisher.java:231)
at org.eclipse.equinox.p2.publisher.AbstractPublisherApplication.run(AbstractPublisherApplication.java:283)
at org.eclipse.equinox.p2.publisher.AbstractPublisherApplication.run(AbstractPublisherApplication.java:253)
at org.eclipse.equinox.p2.publisher.AbstractPublisherApplication.start(AbstractPublisherApplication.java:317)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.equinox.internal.app.AnyThreadAppLauncher.run(AnyThreadAppLauncher.java:26)
at java.lang.Thread.run(Thread.java:679)
Caused by: java.lang.IllegalArgumentException: invalid version "${jclouds.version}": non-numeric "${jclouds"
at org.osgi.framework.Version.parseInt(Version.java:170)
at org.osgi.framework.Version.(Version.java:126)
at org.osgi.framework.Version.parseVersion(Version.java:233)
at org.osgi.framework.VersionRange.parseVersion(VersionRange.java:194)
... 20 more
Caused by: java.lang.NumberFormatException: For input string: "${jclouds"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:470)
at java.lang.Integer.parseInt(Integer.java:514)
at org.osgi.framework.Version.parseInt(Version.java:168)
... 23 more

Product publisher application was executed with the following arguments:
-artifactRepository
file:/home/nickl/workspace/openstack-neutron/target/repository
-metadataRepository
file:/home/nickl/workspace/openstack-neutron/target/repository
-publishArtifacts
-compress
-source
/home/nickl/workspace/openstack-neutron/target/source
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.796 s
[INFO] Finished at: 2014-09-17T11:51:45+03:00
[INFO] Final Memory: 14M/456M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.reficio:p2-maven-plugin:1.1.1-SNAPSHOT:site (default-cli) on project p2-site: Execution default-cli of goal org.reficio:p2-maven-plugin:1.1.1-SNAPSHOT:site failed: org.apache.maven.plugin.MojoExecutionException: Unable to execute mojo: P2 publisher return code was 1 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

Plug-in does not work with tycho 0.21.0

With tycho 0.21.0, the following error is returned:

[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.reficio:p2-maven-plugin:1.1.2-SNAPSHOT:site (default-cli) on project components: Execution default-cli of goal org.reficio:p2-maven-plugin:1.1.2-SNAPSHOT:site failed: org.apache.maven.plugin.MojoExecutionException: Unable to execute mojo: Execution null of goal org
.eclipse.tycho.extras:tycho-p2-extras-plugin:0.18.1:publish-features-and-bundles failed: A required class was missing while executing org.eclipse.tycho.extras:tycho-p2-extras-plugin:0.18.1:publish-features-and-bundles: org/eclipse/tycho/core/osgitools/targetplatform/DefaultTargetPlatform
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.eclipse.tycho.extras:tycho-p2-extras-plugin:0.18.1
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/C:/Users/sg0922521/.m2/repository/org/eclipse/tycho/extras/tycho-p2-extras-plugin/0.18.1/tycho-p2-extras-plugin-0.18.1.jar
[ERROR] urls[1] = file:/C:/Users/sg0922521/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar
[ERROR] urls[2] = file:/C:/Users/sg0922521/.m2/repository/org/sonatype/aether/aether-util/1.7/aether-util-1.7.jar
[ERROR] urls[3] = file:/C:/Users/sg0922521/.m2/repository/org/sonatype/sisu/sisu-inject-bean/1.4.2/sisu-inject-bean-1.4.2.jar
[ERROR] urls[4] = file:/C:/Users/sg0922521/.m2/repository/org/sonatype/sisu/sisu-guice/2.1.7/sisu-guice-2.1.7-noaop.jar
[ERROR] urls[5] = file:/C:/Users/sg0922521/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.14/plexus-interpolation-1.14.jar
[ERROR] urls[6] = file:/C:/Users/sg0922521/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
[ERROR] urls[7] = file:/C:/Users/sg0922521/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[8] = file:/C:/Users/sg0922521/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.7/plexus-utils-3.0.7.jar
[ERROR] urls[9] = file:/C:/Users/sg0922521/.m2/repository/org/codehaus/plexus/plexus-archiver/2.2/plexus-archiver-2.2.jar
[ERROR] urls[10] = file:/C:/Users/sg0922521/.m2/repository/org/codehaus/plexus/plexus-io/2.0.4/plexus-io-2.0.4.jar
[ERROR] urls[11] = file:/C:/Users/sg0922521/.m2/repository/org/eclipse/tycho/sisu-equinox-launching/0.18.1/sisu-equinox-launching-0.18.1.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[project>com.sabre.edge.dynamo.common.nexus-p2:components:1.0.0-SNAPSHOT, parent: ClassRealm[maven.api, parent: null]]]
[ERROR]
[ERROR] -----------------------------------------------------: org.eclipse.tycho.core.osgitools.targetplatform.DefaultTargetPlatform
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

It works fine with the version 0.20.0.

Allow bundling of test-jar artifacts

I have a maven artifact that I would like to expose via p2 - I can depend on the maven artifact in other maven projects using the following dependency:

<dependency>
  <groupId>sample.groupid</groupId>
  <artifactId>sample.artifactid</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <classifier>tests</classifier>
  <scope>test</scope>
  </dependency>

It would be awesome if I could specify this as an artifact in my p2-maven-plugin usage.

Change Felix default instructions globally

It would be helpful if the default instructions for Felix could be overwritten globally.

E.g. instead of having to include the following for each artifact, it would just need to be specified once.

<transitive>false</transitive>
<instructions>
  <DynamicImport-Package>*</DynamicImport-Package>
  <Import-Package>;</Import-Package>
</instructions>

Custom instructions no taken into account

I have this config with p2-maven-plugin

my project already have a manifest, but as true is set, it should override it. The problem is instrusctions set are not taken into account. Result is : all packages are exported, all packags are imported with optional resolution. Is this a bug or is there somthing wrong with my config.

ca.infodata:readhl7::custom:2.0.7-SNAPSHOT true false true * ca.infodata.readhl7

Thanks

Can't browse p2 repo in Eclipse

Hello author,
I use this to convert our own library to p2 format and it works great with Tycho!
However, new classes introduced by our library are not visible in Eclipse causing a lot of errors. Although the p2 repo could be used in Tycho, I cannot install those bundles in "Install New Software." Any workaround?

Missing classes in released tags

Hi,

I just cloned the project, and I have some compilation failures. In HEAD, as in 1.1.1, there are missing classes :
import org.reficio.p2.resolver.eclipse.impl.DefaultEclipseResolver;
import org.reficio.p2.resolver.maven.impl.AetherResolver;

are required by the P2Mojo class, but are not present in the code base.

70% of my builds fail during final cleanupEnvironment

70% of the p2:site builds fail during the final cleanup
usually I have some 2-5 successful builds followed by 5-10 failing builds

Unlocker tool shows no handles and processes that hold on to that files/folders

OS is Win7
Java is 7u9x64
Maven is 3.0.3

builds are done from Jenkins respectively via Eclipse run-config

Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-cli of goal org.reficio:p2-maven-plugin:1.0.0-SNAPSHOT:site failed: java.io.IOException: Unable to delete file: E:\jenkins-ci\jobs\p2-repo\workspace\target\source\plugins\org.apache.felix.scr.annotations-1.7.0.jar
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:110)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 27 more
Caused by: java.lang.RuntimeException: java.io.IOException: Unable to delete file: E:\jenkins-ci\jobs\p2-repo\workspace\target\source\plugins\org.apache.felix.scr.annotations-1.7.0.jar
at org.reficio.p2.P2Mojo.execute(P2Mojo.java:202)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
... 28 more
Caused by: java.io.IOException: Unable to delete file: E:\jenkins-ci\jobs\p2-repo\workspace\target\source\plugins\org.apache.felix.scr.annotations-1.7.0.jar
at org.apache.commons.io.FileUtils.forceDelete(FileUtils.java:1919)
at org.apache.commons.io.FileUtils.cleanDirectory(FileUtils.java:1399)
at org.apache.commons.io.FileUtils.deleteDirectory(FileUtils.java:1331)
at org.apache.commons.io.FileUtils.forceDelete(FileUtils.java:1910)
at org.apache.commons.io.FileUtils.cleanDirectory(FileUtils.java:1399)
at org.apache.commons.io.FileUtils.deleteDirectory(FileUtils.java:1331)
at org.reficio.p2.P2Mojo.cleanupEnvironment(P2Mojo.java:294)
at org.reficio.p2.P2Mojo.execute(P2Mojo.java:200)
... 29 more

Add bundles with the same artifactId and versionId (but not thr same groupId)

Hi,

I'm trying to build a p2 site with the following configuration :

com.company.resources.xxXX:dictionary:0.0.2 com.company.resources.yyYY:dictionary:0.0.2 com.company.resources.zzZZ:dictionary:0.0.1

There is no issue with the "com.company.resources.zzZZ:dictionary" (because the version is 0.0.1). But the "com.company.resources.xxXXdictionary" is ignored by the "com.company.resources.yyYY:dictionary" (because the same version)

Thanks
Anthony

Zip Exception while building site

here's a link to the pom.xml : https://gist.github.com/kgirard/5339516

Here's the exception:

[ERROR] Failed to execute goal org.reficio:p2-maven-plugin:1.0.0:site (default-cli) on project test-p2-site: Execution default-cli of goal org.reficio:p2-maven-plugin:1.0.0:site failed: java.lang.RuntimeException: java.util.zip.ZipException: error reading zip file -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.reficio:p2-maven-plugin:1.0.0:site (default-cli) on project test-p2-site: Execution default-cli of goal org.reficio:p2-maven-plugin:1.0.0:site failed: java.lang.RuntimeException: java.util.zip.ZipException: error reading zip file
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:225)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-cli of goal org.reficio:p2-maven-plugin:1.0.0:site failed: java.lang.RuntimeException: java.util.zip.ZipException: error reading zip file
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:110)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.util.zip.ZipException: error reading zip file
at org.reficio.p2.P2Mojo.execute(P2Mojo.java:202)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
... 20 more
Caused by: java.lang.RuntimeException: java.util.zip.ZipException: error reading zip file
at org.reficio.p2.utils.BundleWrapper.unsignJar(BundleWrapper.java:169)
at org.reficio.p2.utils.BundleWrapper.handleVanillaJarWrap(BundleWrapper.java:122)
at org.reficio.p2.utils.BundleWrapper.doWrap(BundleWrapper.java:103)
at org.reficio.p2.utils.BundleWrapper.wrap(BundleWrapper.java:96)
at org.reficio.p2.utils.BundleWrapper.wrapArtifacts(BundleWrapper.java:76)
at org.reficio.p2.utils.BundleWrapper.execute(BundleWrapper.java:68)
at org.reficio.p2.P2Mojo.executeBndWrapper(P2Mojo.java:244)
at org.reficio.p2.P2Mojo.execute(P2Mojo.java:197)
... 21 more
Caused by: java.util.zip.ZipException: error reading zip file
at java.util.zip.ZipFile.read(Native Method)
at java.util.zip.ZipFile.access$1200(ZipFile.java:31)
at java.util.zip.ZipFile$ZipFileInputStream.read(ZipFile.java:460)
at java.util.zip.ZipFile$1.fill(ZipFile.java:243)
at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:141)
at java.io.FilterInputStream.read(FilterInputStream.java:90)
at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1383)
at org.apache.commons.io.IOUtils.copy(IOUtils.java:1357)
at org.reficio.p2.utils.BundleWrapper.unsignJar(BundleWrapper.java:155)
... 28 more

Trouble bundling fontawesomefx...

Hello,

The first dependancy I imported (controlsFX 8.0.6) worked as a charm, but the second one (fontawesomeFX 8.0.10) gives me the following message :

image

The jar is available in my local repository and shows up in my p2 localhost server, but I can't make it available : when trying to pick up the jar in my target definition, the plugin doesn't seem to be there :

image

Restarting Luna or the Jetty Server, reloading the site, nothing helps...

Any ideas on how to fix this ... ?

Thanks in advance, regards,

Thomas

Plugin repository problem - docs & artifact

Hi,

I just tried my setup on a freshly baked virtual machine and I found two problems:

  1. I guess in the docs it should be
        <pluginRepositories>
        <pluginRepository>
            <id>reficio</id>
            <url>http://repo.reficio.org/maven/</url>
        </pluginRepository>
    </pluginRepositories>

rather than just a repository, no?

  1. If I build the plugin myself - all works just fine, but if I use the one from the repository:

[krikava@kathmandu:test]$ mvn p2:site
[INFO] Scanning for projects...
Downloading: http://repo.reficio.org/maven/org/reficio/p2-maven-plugin/1.0.0-SNAPSHOT/maven-metadata.xml
Downloaded: http://repo.reficio.org/maven/org/reficio/p2-maven-plugin/1.0.0-SNAPSHOT/maven-metadata.xml (2 KB at 0.5 KB/sec)
Downloading: http://repo.reficio.org/maven/org/reficio/p2-maven-plugin/1.0.0-SNAPSHOT/p2-maven-plugin-1.0.0-20120914.112142-15.pom
Downloaded: http://repo.reficio.org/maven/org/reficio/p2-maven-plugin/1.0.0-SNAPSHOT/p2-maven-plugin-1.0.0-20120914.112142-15.pom (20 KB at 26.3 KB/sec)
Downloading: http://repo.reficio.org/maven/org/reficio/p2-maven-plugin/1.0.0-SNAPSHOT/p2-maven-plugin-1.0.0-20120914.112142-15.jar
Downloaded: http://repo.reficio.org/maven/org/reficio/p2-maven-plugin/1.0.0-SNAPSHOT/p2-maven-plugin-1.0.0-20120914.112142-15.jar (48 KB at 76.9 KB/sec)
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building example-p2-site 1.0.0
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- p2-maven-plugin:1.0.0-SNAPSHOT:site (default-cli) @ example-p2-site ---
[CLOVER] FATAL ERROR: Clover could not be initialised. Are you sure you have Clover in the runtime classpath? (class java.lang.NoClassDefFoundError:com_cenqua_clover/CloverVersionInfo)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.873s
[INFO] Finished at: Thu Sep 27 15:03:52 CEST 2012
[INFO] Final Memory: 5M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.reficio:p2-maven-plugin:1.0.0-SNAPSHOT:site (default-cli) on project example-p2-site: A required class was missing during configuration of mojo org.reficio:p2-maven-plugin:1.0.0-SNAPSHOT:site: com_cenqua_clover/CoverageRecorder
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.reficio:p2-maven-plugin:1.0.0-SNAPSHOT
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/Users/krikava/.m2/repository/org/reficio/p2-maven-plugin/1.0.0-SNAPSHOT/p2-maven-plugin-1.0.0-SNAPSHOT.jar
[ERROR] urls[1] = file:/Users/krikava/.m2/repository/commons-io/commons-io/2.1/commons-io-2.1.jar
[ERROR] urls[2] = file:/Users/krikava/.m2/repository/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar
[ERROR] urls[3] = file:/Users/krikava/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar
[ERROR] urls[4] = file:/Users/krikava/.m2/repository/biz/aQute/bnd/0.0.384/bnd-0.0.384.jar
[ERROR] urls[5] = file:/Users/krikava/.m2/repository/org/apache/commons/commons-exec/1.1/commons-exec-1.1.jar
[ERROR] urls[6] = file:/Users/krikava/.m2/repository/org/twdata/maven/mojo-executor/2.0/mojo-executor-2.0.jar
[ERROR] urls[7] = file:/Users/krikava/.m2/repository/org/sonatype/aether/aether-util/1.7/aether-util-1.7.jar
[ERROR] urls[8] = file:/Users/krikava/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.14/plexus-interpolation-1.14.jar
[ERROR] urls[9] = file:/Users/krikava/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar
[ERROR] urls[10] = file:/Users/krikava/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
[ERROR] urls[11] = file:/Users/krikava/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[12] = file:/Users/krikava/.m2/repository/org/codehaus/plexus/plexus-utils/1.5.1/plexus-utils-1.5.1.jar
[ERROR] urls[13] = file:/Users/krikava/.m2/repository/org/sonatype/sisu/sisu-inject-bean/1.4.2/sisu-inject-bean-1.4.2.jar
[ERROR] urls[14] = file:/Users/krikava/.m2/repository/org/sonatype/sisu/sisu-guice/2.1.7/sisu-guice-2.1.7-noaop.jar
[ERROR] urls[15] = file:/Users/krikava/.m2/repository/org/apache/felix/maven-bundle-plugin/2.3.6/maven-bundle-plugin-2.3.6.jar
[ERROR] urls[16] = file:/Users/krikava/.m2/repository/biz/aQute/bndlib/1.50.0/bndlib-1.50.0.jar
[ERROR] urls[17] = file:/Users/krikava/.m2/repository/org/apache/felix/org.apache.felix.bundlerepository/1.6.6/org.apache.felix.bundlerepository-1.6.6.jar
[ERROR] urls[18] = file:/Users/krikava/.m2/repository/org/easymock/easymock/2.4/easymock-2.4.jar
[ERROR] urls[19] = file:/Users/krikava/.m2/repository/org/apache/maven/maven-archiver/2.4.1/maven-archiver-2.4.1.jar
[ERROR] urls[20] = file:/Users/krikava/.m2/repository/org/codehaus/plexus/plexus-archiver/1.0/plexus-archiver-1.0.jar
[ERROR] urls[21] = file:/Users/krikava/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar
[ERROR] urls[22] = file:/Users/krikava/.m2/repository/org/codehaus/plexus/plexus-io/1.0/plexus-io-1.0.jar
[ERROR] urls[23] = file:/Users/krikava/.m2/repository/org/apache/maven/shared/maven-dependency-tree/1.2/maven-dependency-tree-1.2.jar
[ERROR] urls[24] = file:/Users/krikava/.m2/repository/org/eclipse/tycho/extras/tycho-p2-extras-plugin/0.14.0/tycho-p2-extras-plugin-0.14.0.jar
[ERROR] urls[25] = file:/Users/krikava/.m2/repository/org/eclipse/tycho/tycho-p2-facade/0.14.0/tycho-p2-facade-0.14.0.jar
[ERROR] urls[26] = file:/Users/krikava/.m2/repository/org/eclipse/tycho/org.eclipse.osgi/3.8.0.v20120123-1419/org.eclipse.osgi-3.8.0.v20120123-1419.jar
[ERROR] urls[27] = file:/Users/krikava/.m2/repository/org/eclipse/tycho/tycho-core/0.14.0/tycho-core-0.14.0.jar
[ERROR] urls[28] = file:/Users/krikava/.m2/repository/org/eclipse/tycho/tycho-metadata-model/0.14.0/tycho-metadata-model-0.14.0.jar
[ERROR] urls[29] = file:/Users/krikava/.m2/repository/de/pdark/decentxml/1.3/decentxml-1.3.jar
[ERROR] urls[30] = file:/Users/krikava/.m2/repository/org/eclipse/tycho/tycho-embedder-api/0.14.0/tycho-embedder-api-0.14.0.jar
[ERROR] urls[31] = file:/Users/krikava/.m2/repository/org/eclipse/tycho/org.eclipse.tycho.embedder.shared/0.14.0/org.eclipse.tycho.embedder.shared-0.14.0.jar
[ERROR] urls[32] = file:/Users/krikava/.m2/repository/org/eclipse/tycho/org.eclipse.tycho.core.shared/0.14.0/org.eclipse.tycho.core.shared-0.14.0.jar
[ERROR] urls[33] = file:/Users/krikava/.m2/repository/org/eclipse/tycho/sisu-equinox-embedder/0.14.0/sisu-equinox-embedder-0.14.0.jar
[ERROR] urls[34] = file:/Users/krikava/.m2/repository/org/eclipse/tycho/org.eclipse.tycho.p2.resolver.shared/0.14.0/org.eclipse.tycho.p2.resolver.shared-0.14.0.jar
[ERROR] urls[35] = file:/Users/krikava/.m2/repository/org/eclipse/tycho/org.eclipse.tycho.p2.tools.shared/0.14.0/org.eclipse.tycho.p2.tools.shared-0.14.0.jar
[ERROR] urls[36] = file:/Users/krikava/.m2/repository/org/eclipse/tycho/sisu-equinox-launching/0.14.0/sisu-equinox-launching-0.14.0.jar
[ERROR] urls[37] = file:/Users/krikava/.m2/repository/org/eclipse/tycho/sisu-equinox-api/0.14.0/sisu-equinox-api-0.14.0.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
[ERROR] 
[ERROR] -----------------------------------------------------
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginConfigurationException

with following pom:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001 XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>org.reficio.rcp</groupId>
  <artifactId>example-p2-site</artifactId>
  <packaging>pom</packaging>
  <version>1.0.0</version>

  <build>
    <plugins>
      <plugin>
        <groupId>org.reficio</groupId>
        <artifactId>p2-maven-plugin</artifactId>
        <version>1.0.0-SNAPSHOT</version>
        <executions>
          <execution>
            <id>default-cli</id>
            <configuration>
              <artifacts>
                <!-- specify your depencies here -->
                <!-- groupId:artifactId:version -->
                <artifact><id>commons-io:commons-io:2.1</id></artifact>
              </artifacts>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <pluginRepositories>
    <pluginRepository>
      <id>reficio</id>
      <url>http://repo.reficio.org/maven/</url>
    </pluginRepository>
  </pluginRepositories>

</project>

I guess it has something to do with you latest clover configuration no?

Thanks
Filip

Snapshot version (feature #14)

Your plugin is very great ! Thank You.

It will be nice if the version of the snapshot plugins can be defined via a new parameter. For example:

 <instructions>
    <useTimestamp>false</useTimestamp>
 </instructions>

So, the user can decide if the JAR file name must contains the time stamp or not. When true (default) the 'SNAPSHOT' will be replaced by the time stamp and when false leave as is.

Best regard

Bibi

Optional timestamp postfix for bundles

I would like to have an option which allows to add a timestamp postfix for the resulting bundle name. As I see it this option should be part of the artifact definition.

The background to this is that -SNAPSHOT artifacts typically retain the same version which means that the bundles also retain the same name. This leads to problems when trying to update the p2 jars cache in eclipse if you add the p2 repository to your running target platform to satisfy dependencies in eclipse projects.

No "root" for artifacts with meta versions

If you have an artifact with a meta version like 0.0.1-SNAPSHOT the artifact's version depends on the state of the artifact and will have the meta version expanded e.g. 0.0.1-20130314.094238-17.

Therefore "id.equals(resolvedId)" (P2Artifact.java, line 91) is false although the given artifact is root. During the further procedure this leads to the problem that the instructions are not set (BundleWrapper.java, line 223).

From my point of view "id.equals(resolvedId)" is not correct, there should be some kind of matching.

Closing in on the ultimate Eclipse/Maven integration.

Hi Reficio,

I tried out your plugin just now and worked great.

(The need in my case, which is probably what many people run into: My non-OSGI, JAR is not in orbit p2 repo! Aaaaaaaaagh what now? )

  • So, after doing self-management. (Yes, import a jar in a bundle etc..) ... and hating it.
  • Reading about POM first dependencies. (I didn't even try this ....).
  • Contemplating an own Nexus server, which I understand can serv P2 and non P2. (Which would go hand-in-hand with the previous bullet).

So my question is this, now I have a local repo, but it's not in my tp. I can of course upload it, but
that's a manual action...So I wonder, what's the end game. Would tycho evolve in a direction where some how regular maven jars can be added to a TP ? I should ask on the tycho list though....

Thanks for this plugin!

NPE while building the site

I'm getting a NPE sometimes when building my site. It only happens when certain combinations of artifacts are included in the site.

Execution default-cli of goal org.reficio:p2-maven-plugin:1.0.0:site failed: java.lang.NullPointerException
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:225)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-cli of goal org.reficio:p2-maven-plugin:1.0.0:site failed: java.lang.NullPointerException
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:110)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
Caused by: java.lang.RuntimeException: java.lang.NullPointerException
at org.reficio.p2.P2Mojo.execute(P2Mojo.java:202)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
... 20 more
Caused by: java.lang.NullPointerException
at org.reficio.p2.utils.BundleWrapper.unsignJar(BundleWrapper.java:157)
at org.reficio.p2.utils.BundleWrapper.handleVanillaJarWrap(BundleWrapper.java:122)
at org.reficio.p2.utils.BundleWrapper.doWrap(BundleWrapper.java:103)
at org.reficio.p2.utils.BundleWrapper.wrap(BundleWrapper.java:96)
at org.reficio.p2.utils.BundleWrapper.wrapArtifacts(BundleWrapper.java:76)
at org.reficio.p2.utils.BundleWrapper.execute(BundleWrapper.java:68)
at org.reficio.p2.P2Mojo.executeBndWrapper(P2Mojo.java:244)
at org.reficio.p2.P2Mojo.execute(P2Mojo.java:197)
... 21 more

Add pre bundled jars with different symbolic name

I tried to include bundles to the configuration. The only instruction is another symbolic name. Because the manifest is already filled, BND throws an error.

Is there a way to implement this, or do I have to add a bnd prevent instruction?

Support jar/war packages

It would be great to bundle dependencies which are defined with classes to include the [...]-classes.jar from a war dependency.

Plugin not compatible with maven 3.1

Explanation: https://cwiki.apache.org/confluence/display/MAVEN/AetherClassNotFound

Log from Jenkins:

[WARNING] Error injecting: org.reficio.p2.P2Mojo
java.lang.NoClassDefFoundError: Lorg/sonatype/aether/RepositorySystem;
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:2387)
at java.lang.Class.getDeclaredFields(Class.java:1796)
at com.google.inject.spi.InjectionPoint.getInjectionPoints(InjectionPoint.java:661)
at com.google.inject.spi.InjectionPoint.forInstanceMethodsAndFields(InjectionPoint.java:366)
at com.google.inject.internal.ConstructorBindingImpl.getInternalDependencies(ConstructorBindingImpl.java:165)
at com.google.inject.internal.InjectorImpl.getInternalDependencies(InjectorImpl.java:609)
at com.google.inject.internal.InjectorImpl.cleanup(InjectorImpl.java:565)
at com.google.inject.internal.InjectorImpl.initializeJitBinding(InjectorImpl.java:551)
at com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:865)
at com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:790)
at com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:278)
at com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:210)
at com.google.inject.internal.InjectorImpl.getProviderOrThrow(InjectorImpl.java:986)
at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:1019)
at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:982)
at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1032)
at org.eclipse.sisu.reflect.AbstractDeferredClass.get(AbstractDeferredClass.java:44)
at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:86)
at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:55)
at com.google.inject.internal.ProviderInternalFactory$1.call(ProviderInternalFactory.java:70)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:100)
at org.eclipse.sisu.plexus.lifecycles.PlexusLifecycleManager.onProvision(PlexusLifecycleManager.java:134)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:109)
at com.google.inject.internal.ProvisionListenerStackCallback.provision(ProvisionListenerStackCallback.java:55)
at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:68)
at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:47)
at com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:997)
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1047)
at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:993)
at com.google.inject.Scopes$1$1.get(Scopes.java:59)
at org.eclipse.sisu.locators.LazyBeanEntry.getValue(LazyBeanEntry.java:82)
at org.eclipse.sisu.plexus.locators.LazyPlexusBean.getValue(LazyPlexusBean.java:52)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:259)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:251)
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:459)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:97)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:318)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:153)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:414)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:357)
Caused by: java.lang.ClassNotFoundException: org.sonatype.aether.RepositorySystem
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
... 57 more

Eclipse source bundle manifest does not reference original bundle

Eclipse source bundle does not reference original bundle. Instead it references the source bundle as original bundle.

Current

 Eclipse-SourceBundle: my.custom.bundle.source 

Expected

 Eclipse-SourceBundle: my.custom.bundle

According to eclipse documentation http://help.eclipse.org/kepler/index.jsp?topic=%2Forg.eclipse.pde.doc.user%2Ftasks%2Fpde_individual_source.htm

Eclipse-SourceBundle: ;version=;roots:="root1, root2"
The bundle-id and version indicate the bundle that the included source code corresponds to

Build failed after upgrading tycho from 0.18.1 to 0.21.0

[ERROR] Failed to execute goal org.reficio:p2-maven-plugin:1.1.1:site (default-cli) on project egbdp.client.target.platform: Execution default-cli of goal org.reficio:p2-maven-plugin:1.1.1:site failed: org.apache.maven.plugin.MojoExecutionException: Unable to execute mojo: Execution null of goal org.eclipse.tycho.extras:tycho-p2-extras-plugin:0.18.1:publish-features-and-bundles failed: A required class was missing while executing org.eclipse.tycho.extras:tycho-p2-extras-plugin:0.18.1:publish-features-and-bundles: org/eclipse/tycho/core/osgitools/targetplatform/DefaultTargetPlatform
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.eclipse.tycho.extras:tycho-p2-extras-plugin:0.18.1
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy

Add local plug-in

I have some plug-ins that was made at our company...is there a way to add local these plug-ins to the pom?

Support source bundles

Hi,

I was wondering if you plan to include source bundle support [1] any time soon? I think your plugin complements quite well tycho (for the non M2E users like me), however without source bundles I cannot use it and I have to fallback to quite obscure [2] way of defining target platform.

/cheers
Filip

[1] http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.pde.doc.user%2Ftasks%2Fpde_individual_source.htm
[2] http://dev.eclipse.org/mhonarc/lists/tycho-user/msg03080.html

Incomplete project in master

I have a bug with Eclipse-BuddyPolicy instruction so i did checkout the project from master branch. But the project has compile error caused by missing classes and packages.

org.reficio.p2.resolver.impl.facade package is missing.
org.reficio.p2.resolver.impl.AetherResolver is missing.

Unable to parse configuration of mojo org.reficio:p2-maven-plugin:1.0.3-SNAPSHOT:site: Error loading class 'org.reficio.p2.Artifact'

Hi,

First, thank you for this great project.
Second,

I tried the quickstart pom that i modified to fit my needs. I all went fine on my local computer. But it fail if i run it inside bamboo on another computer. It maybe my maven version or something else.

Fai

Caused by: org.apache.maven.plugin.PluginConfigurationException: Unable to parse configuration of mojo org.reficio:p2-maven-plugin:1.0.3-SNAPSHOT:site: Error loading class 'org.reficio.p2.Artifact'
Caused by: org.codehaus.plexus.component.configurator.ComponentConfigurationException: Error loading class 'org.reficio.p2.Artifact'
Caused by: java.lang.ClassNotFoundException: org.reficio.p2.Artifact

with this configuration

        <plugin>
            <groupId>org.reficio</groupId>
            <artifactId>p2-maven-plugin</artifactId>
            <version>1.0.3-SNAPSHOT</version>
            <executions>
                <execution>
                    <id>default-cli</id>
                    <configuration>
                        <artifacts>
                            <!-- specify your depencies here -->
                            <!-- groupId:artifactId:version -->
                            <artifact>
                                <id>ca.infodata:util1.restful:1.0.0</id>
                            </artifact>
                            <artifact>
                                <id>ca.infodata:util1.common:1.0.0</id>
                            </artifact>
                            <artifact>
                                <id>ca.infodata:util1.group:1.0.0</id>
                            </artifact>
                            <artifact>
                                <id>ca.infodata:util1.encryption:1.0.0</id>
                            </artifact>
                            <artifact>
                                <id>ca.infodata:apple.finder.search:1.0.0</id>
                            </artifact>
                            <artifact>
                                <id>ca.infodata:ofys.data.middle.dataobjects_client:0.0.1-SNAPSHOT</id>
                            </artifact>
                            <artifact>
                                <id>com.sun.jersey:jersey-client:1.17.1</id>
                                <transitive>true</transitive>
                            </artifact>
                            <artifact>
                                <id>net.java.dev.jna:jna:3.3.0</id>
                            </artifact>
                            <artifact>
                                <id>net.java.dev.jna:jna::platform:3.3.0</id>
                            </artifact>
                            <artifact>
                                <id>org.mb.listeners:listeners:1.0.0</id>
                            </artifact>
                            <artifact>
                                <id>ca.infodata:stats2.minimalog.client:1.0.0</id>
                            </artifact>
                            <artifact>
                                <id>jfree:jfreechart:1.0.13</id>
                            </artifact>
                            <artifact>
                                <id>jfree:jfreechart-swt:1.0.9</id>
                            </artifact>
                            <artifact>
                                <id>org.glassfish:javax.jms:3.1.1</id>
                            </artifact>

                            <artifact>
                                <id>com.miglayout:miglayout-swt:4.2</id>
                            </artifact>
                            <artifact>
                                <id>commons-collections:commons-collections:3.2.1</id>
                            </artifact>
                            <artifact>
                                <id>commons-codec:commons-codec:1.6</id>
                            </artifact>
                            <artifact>
                                <id>commons-io:commons-io:2.3</id>
                            </artifact>
                            <artifact>
                                <id>commons-lang:commons-lang:2.5</id>
                            </artifact>
                            <artifact>
                                <id>org.apache.commons:commons-lang3:3.1</id>
                            </artifact>

                            <artifact>
                                <id>ca.infodata:readhl7:1.0.0</id>
                            </artifact>
                            <artifact>
                                <id>com.google.code.gson:gson:2.2.4</id>
                            </artifact>
                            <artifact>
                                <id>javassist:javassist:3.12.1.GA</id>
                            </artifact>
                            <artifact>
                                <id>org.bouncycastle:bcmail-jdk16:1.46</id>
                            </artifact>
                            <artifact>
                                <id>org.bouncycastle:bcprov-jdk16:1.46</id>
                            </artifact>
                            <artifact>
                                <id>log4j:log4j:1.2.17</id>
                            </artifact>
                            <artifact>
                                <id>org.swinglabs:pdf-renderer:1.0.5</id>
                            </artifact>
                            <artifact>
                                <id>com.googlecode.jatl:jatl:0.2.2</id>
                            </artifact>
                            <artifact>
                                <id>xmlrpc:xmlrpc:2.0.1</id>
                            </artifact>
                            <artifact>
                                <id>com.lowagie:itext:2.1.7</id>
                            </artifact>
                            <artifact>
                                <id>org.apache.pdfbox:pdfbox:1.8.2</id>
                            </artifact>
                        </artifacts>
                    </configuration>
                </execution>
            </executions>
        </plugin>

Is this configuration ok ?
Is the problem elsewhere ?
Is is a bug ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.