Search code examples
maveneclipse-plugintycho

Tycho fails to resolve packages from my own wrapper of plain Maven dependencies


I am trying to create an Eclipse plug-in which has dependencies to plain Maven artifacts. I created the following project structure:

Parent POM
 |- Dependencies (Third Party)
 \- My Code
     |- Bundle
     \- Bundle Tests

I have followed the Tycho example itp02 but only using the third-party dependencies. As I understood the idea is to wrap all the dependencies in a bundle and use it as input for my bundle. I manage to build and install the Dependencies bundle correctly: A jar is created and it contains all the JAR files obtained from the Maven repository. But when I try to compile my bundle I get an error saying that the packages in my bundle manifest cannot be imported.

[ERROR]   Missing requirement: MyPlugin 0.0.1.qualifier requires 'package org.apache.commons.lang.StringEscapeUtils 0.0.0' but it could not be found
[ERROR] 
[ERROR] Internal error: java.lang.RuntimeException: "No solution found because the problem is unsatisfiable.": ["Unable to satisfy dependency from MyPlugin 0.0.1.qualifier to package org.apache.commons.lang.StringEscapeUtils 0.0.0.", "No solution found because the problem is unsatisfiable."] -> [Help 1]
org.apache.maven.InternalErrorException: Internal error: java.lang.RuntimeException: "No solution found because the problem is unsatisfiable.": ["Unable to satisfy dependency from MyPlugin 0.0.1.qualifier to package org.apache.commons.lang.StringEscapeUtils 0.0.0.", "No solution found because the problem is unsatisfiable."]

What am I missing?


Solution

  • It is not very clear from your description how your project is set up or the commands you used to build it. However your "POM parent" seems to suggest you are attempting to build it all in one go. If that is the case, you cannot mix pom-first (maven-bundle-plugin) projects and manifest-first (eclispe-plugin) projects in the same build see [1]. You need to build and install the pom-first projects into your local maven repository first then you can build the manifest-first projects.

    The second thing to check is that your have the correct dependency configured and that you have set pomDependencies=consider as in [2].

    Finally, if that does not help, check that the jar file in your local maven repository has a META-INF/MANIFEST.MF with the correct "Export-Package" statements - specifically there should be a line for org.apache.commons.lang.StringEscapeUtils.

    [1] http://wiki.eclipse.org/Tycho/How_Tos/Dependency_on_pom-first_artifacts#It_is_not_possible_to_mix_pom-first_and_manifest-first_projects_in_the_same_reactor_build.

    [2] http://git.eclipse.org/c/tycho/org.eclipse.tycho-demo.git/tree/itp02/build02/pom.xml