Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6149081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:23:33+00:00 2026-05-23T19:23:33+00:00

I’d like to use dependencies from a remote Eclipse p2 repository in a regular

  • 0

I’d like to use dependencies from a remote Eclipse p2 repository in a “regular” Maven 3 build (e.g. JAR or WAR packaging) – all without converting the p2 repo to a local Maven repo (which is what osgi-to-maven2 and m4e seem to do).

Ideally, I’d just use http://maven.eclipse.org/nexus/, but that doesn’t (yet?) contain many bundles.

Using Maven’s systemPath doesn’t count!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T19:23:34+00:00Added an answer on May 23, 2026 at 7:23 pm

    Looks like I’m answering another of my own questions..

    First of all, you can use Tycho to add a dependency on a bundle from a P2 repository:

    • Configure the build to use tycho-maven-plugin.
    • Specify a P2 repository.
    • Set packaging to “eclipse-plugin”.
    • Create a manifest for your build and use Require-Bundle to state the dependency (e.g. org.eclipse.xsd). Also set Bundle-Version to the same version we used for our build in pom.xml.

    Let’s give that a try:

    $ mvn dependency:tree
    [INFO] com.example:org.eclipse.xsd:eclipse-plugin:0.0.1
    [INFO] +- p2.eclipse-plugin:org.eclipse.xsd:jar:2.6.0.v20100914-1218:system
    [INFO] ...
    [INFO] \- p2.eclipse-plugin:org.eclipse.core.filesystem:jar:1.3.1.R36x_v20100727-0745:system
    

    Our dependency has sucessfully been resolved from the P2 repository. Unfortunately, we’re not done yet. The dependency has been added with system scope, which means that the artifacts won’t be included if we create a webapp that depends on our build. To work around that, we’ll first unpack all classes contained in the dependency to some directory, and then re-package that directory as a jar and use it as the final artifact of our build.

    For the first part (unpacking), we add the maven-dependency-plugin to our build and configure it to run its unpack-dependencies goal during the package phase. For the second part (re-packaging), we add the maven-assembly-plugin to our build and configure it to run its single goal during the package phase. We also need to create and configure a custom assembly descriptor.

    Our build now consists of 3 files: The build file in pom.xml:

    <project>
        <modelVersion>4.0.0</modelVersion>
        <groupId>com.example</groupId>
        <artifactId>org.eclipse.xsd</artifactId>
        <version>0.0.1</version>
        <packaging>eclipse-plugin</packaging>
        <repositories>
            <repository>
                <id>helios</id>
                <layout>p2</layout>
                <url>http://download.eclipse.org/releases/helios</url>
            </repository>
        </repositories>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.eclipse.tycho</groupId>
                    <artifactId>tycho-maven-plugin</artifactId>
                    <version>0.12.0</version>
                    <extensions>true</extensions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>unpack-dependencies</id>
                            <phase>package</phase>
                            <goals>
                                <goal>unpack-dependencies</goal>
                            </goals>
                            <configuration>
                                <outputDirectory>${project.build.directory}/dependency</outputDirectory>
                                <overWriteReleases>false</overWriteReleases>
                                <overWriteSnapshots>true</overWriteSnapshots>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <version>2.2.1</version>
                    <configuration>
                        <descriptors>
                            <descriptor>src/main/assembly/repackaged.xml</descriptor>
                        </descriptors>
                    </configuration>
                    <executions>
                        <execution>
                            <id>make-assembly</id>
                            <phase>package</phase>
                            <goals>
                                <goal>single</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </project>
    

    The manifest in META-INF/MANIFEST.MF:

    Manifest-Version: 1.0
    Bundle-ManifestVersion: 2
    Bundle-Name: Ignored
    Bundle-SymbolicName: Ignored
    Bundle-Version: 0.0.1
    Require-Bundle: org.eclipse.xsd
    Bundle-Vendor: Ignored
    

    The assembly descriptor in src/main/assembly/repackaged.xml:

    <assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
        <id>repackaged</id>
        <formats>
            <format>jar</format>
        </formats>
        <includeBaseDirectory>false</includeBaseDirectory>
        <fileSets>
          <fileSet>
            <directory>${project.build.directory}/dependency/</directory>
            <outputDirectory>/</outputDirectory>
            <useDefaultExcludes>true</useDefaultExcludes>
          </fileSet>
        </fileSets>
    </assembly>
    

    Now mvn package will create a jar file that contains all the code from our P2 dependency, re-packaged as a proper Maven artifact, ready to be used as a dependency in another project.

    $ jar tf target/org.eclipse.xsd-0.0.1-repackaged.jar 
    org/eclipse/xsd/ecore/XSDEcoreBuilder$1.class
    org/eclipse/xsd/ecore/XSDEcoreBuilder$2.class
    org/eclipse/xsd/ecore/XSDEcoreBuilder$Comparator.class
    org/eclipse/xsd/ecore/XSDEcoreBuilder$EffectiveOccurrence.class
    org/eclipse/xsd/ecore/XSDEcoreBuilder.class
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I have a text area in my form which accepts all possible characters from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I've got a string that has curly quotes in it. I'd like to replace
I want use html5's new tag to play a wav file (currently only supported
I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
Does anyone know how can I replace this 2 symbol below from the string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.