Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tycho-user] Thirdparty POM dependencies with m2e

Hello!

I managed to get this working and uploaded it to a separate repository: https://github.com/szarnyasg/maven-tycho-thirdparty
https://github.com/szarnyasg/maven-tycho-thirdparty/blob/master/build02/tycho.demo.itp02.bundle/src/tycho/demo/itp02/bundle/ITP02.java
The projects are a bit brittle in Eclipse. It often shows an "The import org.codehaus cannot be resolved" error (e.g. after restarting Eclipse). When this happened, the following workarounds helped:
- delete all the projects (but not the files on the disk) and restart Eclipse,
- clean the "pomfirst-thirdparty" project.

Now my problem is that this approach does not seem to work for third party dependencies that are only available in the Maven Central Repository (e.g. com.typesafe.akka:akka-actor_2.10) and not available az OSGi bundles. The Tycho tutorial (http://wiki.eclipse.org/Tycho/How_Tos/Dependency_on_pom-first_artifacts) mentions that "p2 metadata is generated for all maven dependencies. Currently this only works for OSGi bundles, all other dependencies are silently ignored." So I guess this solution will not work for any third party dependency.

I also found the p2-maven-plugin (https://github.com/reficio/p2-maven-plugin) as an alternative solution which does work for dependencies in the Maven Central Repository. In contrast, I think the pde-target-maven-plugin (https://github.com/andriusvelykis/pde-target-maven-plugin) will not work for me as it only supports dependencies that were uploaded as OSGi bundles in the Maven Central Repository (but I'm not entirely certain).

My questions are the following:
- What is the status on the org.sonatype.tycho.m2e.wrapperBundle plugin?
- Is it possible to use the "pom-first, manifest-first" approach of the ITP02 project to use third party dependencies which are not OSGi bundles (like Akka) or should I use a private update site (p2-maven-plugin or Nexus update site) for that purpose?

Thanks,
Gabor


On 1 January 2014 22:06, Szárnyas Gábor <szarnyasg@xxxxxxxxx> wrote:
Hello!

I'm quite new with Tycho. My goal is to use allow my Eclipse plug-ins to use third party libraries defined in a POM file. My environment is Eclipse Kepler on a Linux machine.

I started working based on this tutorial: http://wiki.eclipse.org/Tycho/How_Tos/Dependency_on_pom-first_artifacts. I understand that I need a two-phase build, first for POM-first and then manifest-first projects. Setting up the pomfirst-bundle and the tycho.demo.itp02.bundle projects was pretty straightforward and I managed to get them work.

The pomfirst-thirdparty project displayed the following error in Eclipse:

Lifecycle mapping "org.sonatype.tycho.m2e.wrapperBundle" is not available. To enable full functionality, install the lifecycle mapping and run Maven->Update Project Configuration.

However, I could not find this in the m2e Marketplace or on the web. Deleting the <plugin> element for org.eclipse.m2e:lifecycle-mapping makes the error go away and makes it possible to use Maven install on the project.

I tried to import the org.codehaus.plexus.util package from tycho.demo.itp02.bundle by adding the following lines to the bundle's manifest file:

Require-Bundle: tycho.demo.itp02.pomfirst-thirdparty;bundle-version="1.0.0"
Import-Package: org.codehaus.plexus.util;version="2.0.7"

This way, instead of using the PomFirst wrapper class, I could use the StringUtils class directly. However, I cannot import the appropriate package from the Java code ("the import ... cannot be resolved").

Can you provide me some pointers on how to do this?

Thanks,
Gabor


Back to the top