Transitive dependencies not resolved with maven dependency and tycho pomConsider parameter

I am trying to create an eclipse plugin using OSGI dependencies on two repositories, one with maven dependencies and one with p2 dependencies:

<repositories> <repository> <snapshots> <enabled>true</enabled> </snapshots> <id>bintray-anrgenstar-genstar-packages</id> <name>bintray</name> <url>http://dl.bintray.com/anrgenstar/genstar-packages</url> </repository> </repositories> <repository> <id>gama</id> <name>GAMA Snapshots</name> <url>http://gama.unthinkingdepths.fr</url> <layout>p2</layout> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </repository> 

The project contains one parent pom.xml in ummisco.gaml.extensions.parent that creates the eclipse ummisco.gaml.extensions.genstar :

  • (1) ummisco.gaml.extensions.parent
    • pom.xml
  • (2) ummisco.gaml.extensions.genstar
    • pom.xml
    • CSI / ...
    • META-INF / MANIFEST.MF

(1) The parent ummisco.gaml.extensions.genstar pom.xml defines the module <module>../ummisco.gaml.extensions.genstar</module> to build and call the Tycho maven plugin:

 <modelVersion>4.0.0</modelVersion> <groupId>ummisco.gaml.extensions</groupId> <artifactId>ummisco.gaml.extensions.parent</artifactId> <version>1.7.0-SNAPSHOT</version> <packaging>pom</packaging> <modules> <module>../ummisco.gaml.extensions.genstar</module> </modules> <properties> <p2-maven.version>1.2.0-SNAPSHOT</p2-maven.version> <tycho.version>0.26.0</tycho.version> <project.version>1.7.0-SNAPSHOT</project.version> </properties> <repositories> <repository> <id>sonatype-nexus-snapshots</id> <name>Sonatype Nexus Snapshots</name> <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </repository> <repository> <id>eclipse-mars</id> <url>http://download.eclipse.org/releases/mars</url> <layout>p2</layout> </repository> <repository> <id>eclipse-elk</id> <url>http://build.eclipse.org/modeling/elk/updates/nightly/</url> <layout>p2</layout> </repository> <repository> <id>eclipse-graphiti</id> <url>http://download.eclipse.org/graphiti/updates/milestones/</url> <layout>p2</layout> </repository> <repository> <id>gama</id> <name>GAMA Snapshots</name> <url>http://gama.unthinkingdepths.fr</url> <layout>p2</layout> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </repository> </repositories> <build> <plugins> <plugin> <groupId>org.eclipse.tycho</groupId> <artifactId>tycho-maven-plugin</artifactId> <version>${tycho.version}</version> <extensions>true</extensions> <configuration> <source>1.7</source> <target>1.7</target> </configuration> </plugin> <plugin> <groupId>org.eclipse.tycho</groupId> <artifactId>tycho-p2-director-plugin</artifactId> <version>${tycho.version}</version> </plugin> </plugins> </build> </project> 

(2) eclipse-plugin pom.xml of ummisco.gaml.extensions.genstar , for which you want to use p2 and maven depending on the tycho <pomDependencies>consider</pomDependencies> .

 <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/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>ummisco.gaml.extensions.genstar</groupId> <artifactId>ummisco.gaml.extensions.genstar</artifactId> <packaging>eclipse-plugin</packaging> <parent> <groupId>ummisco.gaml.extensions</groupId> <artifactId>ummisco.gaml.extensions.parent</artifactId> <version>1.7.0-SNAPSHOT</version> <relativePath>../ummisco.gaml.extensions.parent/</relativePath> </parent> <dependencies> <dependency> <groupId>genstar.core</groupId> <artifactId>core</artifactId> <version>1.0</version> </dependency> <dependency> <groupId>genstar.spll</groupId> <artifactId>spll</artifactId> <version>1.0</version> </dependency> <dependency> <groupId>genstar.spin</groupId> <artifactId>spin</artifactId> <version>1.0</version> </dependency> <dependency> <groupId>genstar.gospl</groupId> <artifactId>gospl</artifactId> <version>1.0</version> </dependency> </dependencies> <repositories> <repository> <snapshots> <enabled>true</enabled> </snapshots> <id>bintray-anrgenstar-genstar-packages</id> <name>bintray</name> <url>http://dl.bintray.com/anrgenstar/genstar-packages</url> </repository> </repositories> <build> <plugins> <plugin> <groupId>org.eclipse.tycho</groupId> <artifactId>target-platform-configuration</artifactId> <version>${tycho.version}</version> <configuration> <resolver>p2</resolver> <pomDependencies>consider</pomDependencies> </configuration> </plugin> </plugins> </build> </project> 

MANIFEST.MF for this eclipse-plugin is defined as follows:

 Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Genstar Bundle-SymbolicName: ummisco.gaml.extensions.genstar;singleton:=true Bundle-Version: 1.7.0.qualifier Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Require-Bundle: msi.gama.core, core, gspl, spin, spll, javax.xml;bundle-version="1.3.4" 

When I try mvn clean install in ummisco.gaml.extensions.parent , it seems that tycho loads and recognizes the dependencies defined in p2 ( msi.gama.core for example) and is defined in pom.xml ( core, spll,gospl, spin OSGI package), but the transitive dependencies of these bundles are not resolved.

 [INFO] Fetching p2.index from http://gama.unthinkingdepths.fr/ (172B) [INFO] Adding repository http://gama.unthinkingdepths.fr [INFO] Resolving dependencies of MavenProject: ummisco.gaml.extensions.genstar:ummisco.gaml.extensions.genstar:1.7.0-SNAPSHOT @ /home/reyman/Projets/genstar-gama-plugin/ummisco.gaml.extensions.genstar/pom.xml [INFO] {osgi.os=linux, osgi.ws=gtk, org.eclipse.update.install.features=true, osgi.arch=x86_64} [ERROR] Cannot resolve project dependencies: [ERROR] Software being installed: ummisco.gaml.extensions.genstar 1.7.0.qualifier [ERROR] Missing requirement: core 1.0.0 requires 'package org.math.R 0.0.0' but it could not be found [ERROR] Cannot satisfy dependency: ummisco.gaml.extensions.genstar 1.7.0.qualifier depends on: bundle core 0.0.0 [ERROR] 

I check the transitive dependencies of the OSGI Bundle core 1.0.0 manifest (using mvn dependency:tree ) and it seems correct, the manifest contains the dependency declaration in the Import-Package , for example org.math.R , as you can see here:

 Manifest-Version: 1.0 Bnd-LastModified: 1481896487741 Build-Jdk: 1.8.0_101 Built-By: reyman Bundle-ManifestVersion: 2 Bundle-Name: core Bundle-SymbolicName: core Bundle-Version: 1.0 Created-By: Apache Maven Bundle Plugin Export-Package: core.configuration;version="1.0.0";uses:="com.thoughtw orks.xstream,core.metamodel,core.metamodel.pop,core.metamodel.pop.io" ,core.metamodel;version="1.0.0",core.metamodel.geo;version="1.0.0";us es:="com.vividsolutions.jts.geom,core.metamodel",core.metamodel.geo.i o;version="1.0.0";uses:="com.vividsolutions.jts.geom,core.metamodel.g eo",core.metamodel.pop;version="1.0.0";uses:="com.vividsolutions.jts. geom,core.metamodel,core.metamodel.geo,core.util.data",core.metamodel .pop.io;version="1.0.0",core.util;version="1.0.0";uses:="org.apache.l ogging.log4j",core.util.R;version="1.0.0";uses:="org.math.R",core.uti l.data;version="1.0.0";uses:="core.util.excpetion",core.util.excpetio n;version="1.0.0",core.util.random;version="1.0.0",core.util.random.r oulette;version="1.0.0",core.util.stats;version="1.0.0" Import-Package: com.thoughtworks.xstream;version="[1.4,2)",com.thought works.xstream.converters;version="[1.4,2)",com.thoughtworks.xstream.c onverters.extended;version="[1.4,2)",com.thoughtworks.xstream.io;vers ion="[1.4,2)",com.thoughtworks.xstream.io.xml;version="[1.4,2)",com.t houghtworks.xstream.mapper;version="[1.4,2)",com.vividsolutions.jts.g eom,core.metamodel;version="[1.0,2)",core.metamodel.geo;version="[1.0 ,2)",core.metamodel.pop;version="[1.0,2)",core.metamodel.pop.io;versi on="[1.0,2)",core.util.data;version="[1.0,2)",core.util.excpetion;ver sion="[1.0,2)",core.util.random;version="[1.0,2)",org.apache.logging. log4j;version="[2.7,3)",org.math.R,org.rosuda.REngine,org.rosuda.REng ine.Rserve Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))" Tool: Bnd-3.2.0.201605172007 

I really don't understand why transitive dependencies are not automatically resolved by tycho using the pom.xml dependency ... If tycho recognized the core, spll, spin package , etc. in eclipse-plugin MANIFEST , why the transitive dependencies of the kernel, spll, spin, gospl of the OSGI package are not loaded?

Do you think there is a solution to this problem?

UPDATE

After this repository, I try to do two projects:

  • maven-bundle that bundles all dependencies into one big jar
  • tycho-bundle that accept this maven-bundle depending

Intelij Idea found another dependency class when I compiled in graphical mode, but not my maven project, when I run mvn install , this is really strange ... I donโ€™t understand where the problem is.

You can find the project archive here , you need mvn clean install pom.xml in the /maven-bundle/ folder, then mvn clean install pom.xml in the tycho-bundle/ folder.

+4
source share

Source: https://habr.com/ru/post/1239218/


All Articles