[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [eclipse-dev] Confirm that Tycho can't manage BOTH p2 and Maven artifacts?
|
On 01/21/2016 10:27 AM, David M. Karr wrote:
On 01/18/2016 11:01 PM, Max Rydahl Andersen wrote:
The answer is that it depends.
Tycho either can be driven by a plugin manifest or Pom.xml to resolve
its p2 dependencies and here I believe it is true - it has to be
either/or.
but what you can do in your specific case of having nested jars
inside your plugin is to use mvn copy-dependencies which allow you to
remove lib content from your source Repo and have it dynamically
downloaded and put into the lib folder during build.
http://wiki.eclipse.org/Tycho/How_Tos/Dependency_on_pom-first_artifacts
has more
on it.
Jbosstools projects uses this for a few things where creating a full
set of Osgi dependencies was not feasible.
Hope that helps.
I may be getting closer, but there are a few details I'm unsure of.
I'm currently working on a "maventhirdparty" module, to contain the
jars currently hard-included in the "core" module. I'm modeling this
on the "pomfirst-thirdparty" module from that example.
For background, here's an excerpt from the "pom.xml" from that code
sample:
---------------------
<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Embed-Dependency>
plexus-utils
</Embed-Dependency>
<_exportcontents>
org.codehaus.plexus.util.*;version="2.0.7"
</_exportcontents>
<Bundle-ClassPath>{maven-dependencies}</Bundle-ClassPath>
<Embed-Transitive>true</Embed-Transitive>
<Embed-Directory>jars</Embed-Directory>
<_failok>true</_failok>
<_nouses>true</_nouses>
</instructions>
</configuration>
</plugin>
</plugins>
--------------------------
I've read through most of the bundle plugin doc to understand the
"instructions" section. I assume that "Embed-Dependency" refers to
artifactIds. I didn't see a clear statement to that effect in the
docs. I'm confused about how this is specifying the required version
of "plexus-utils". Instead of specifying it in the GAV, it's
specified in the "_exportContents" value. In my case, I was assuming
that I would package several jars in this module. If I do that, I
would assume I would specify multiple comma-separated values in
"Embed-Dependency" and "_exportContents", but if I did that, what is
the significance of the "version" property? Can I just leave out the
version property if I specify the versions in the GAVs?
Are there any other instructions I need to modify, add, or delete from
this if I'm trying to contain multiple jars in this module?
I ended up with the following POM (excerpt) for the new module:
------------------
<artifactId>com.cisco.yangide.maventhirdparty</artifactId>
<packaging>bundle</packaging>
<version>1.1.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
<version>4.0</version>
</dependency>
<dependency>
<groupId>org.mapdb</groupId>
<artifactId>mapdb</artifactId>
<version>1.0.4</version>
</dependency>
<dependency>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yang-model-api</artifactId>
<version>0.6.1</version>
</dependency>
<dependency>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yang-parser-impl</artifactId>
<version>0.6.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-Version>1.1.1</Bundle-Version>
<Embed-Dependency>
antlr4-runtime, mapdb, yang-model-api, yang-parser-impl
</Embed-Dependency>
<_exportcontents>
org.opendaylight.yangtools.*, org.antlr.*, org.mapdb.*
</_exportcontents>
<Bundle-ClassPath>{maven-dependencies}</Bundle-ClassPath>
<Embed-Transitive>true</Embed-Transitive>
<Embed-Directory>jars</Embed-Directory>
<_failok>true</_failok>
<_nouses>true</_nouses>
</instructions>
</configuration>
</plugin>
</plugins>
--------------------
Note that I specifically set "Bundle-Version" to 1.1.1. I found that
letting it default to the Maven artifact version of 1.1.1-SNAPSHOT
caused other problems. I'd rather not have to do that, but I don't know
how to fix that otherwise.
In the MANIFEST.MF of the referencing module, I ended up with the following:
----------------
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.jdt.core;visibility:=reexport,
org.eclipse.text,
org.eclipse.core.resources,
org.eclipse.core.filesystem,
com.cisco.yangide.maventhirdparty;bundle-version="1.1.1"
-------------------
However, I noticed that in the GUI editor for this, when I tried to add
the new module, the "Add" dialog showed the list of the existing
modules, including the new one, but there was a red X on that row, with
"(out of sync)" at the end of the row for that module. It still let me
add it, but the red X went with it in the list of required plugins.
Outside of that red X and the "(out of sync)" thing, there is no other
indication there is any error here, not even in the Problems view of
either project.
When I run the whole build, I see it fail with the following:
-----------------------
[INFO] Resolving dependencies of MavenProject:
com.cisco.yangide:com.cisco.yangide.core:1.1.1-SNAPSHOT @
.../yangide/plugins/com.cisco.yangide.core/pom.xml
[INFO] {osgi.os=linux, osgi.ws=gtk,
org.eclipse.update.install.features=true, osgi.arch=x86}
[ERROR] Cannot resolve project dependencies:
[ERROR] Software being installed: com.cisco.yangide.core 1.1.1.qualifier
[ERROR] Missing requirement: com.cisco.yangide.core 1.1.1.qualifier
requires 'bundle com.cisco.yangide.maventhirdparty 1.1.1' but it could
not be found
-------------------------
The build of the "maventhirdparty" module was successful, but I'm
obviously doing at least one thing wrong in the build for the new module.
/max
http://about.me/maxandersen
On 18 Jan 2016, at 14:27, David M. Karr <davidmichaelkarr@xxxxxxxxx>
wrote:
I inherited a large Eclipse plugin codebase, but I'm pretty new to
Eclipse plugin development.
I happened to notice that one of the subprojects had a few jars just
dumped into a "lib" folder, and those jars are referenced from the
.classpath, build.properties, and META-INF/MANIFEST.MF file. This
subproject also has several bundles that it depends on.
I wondered why these artifacts weren't just specified as Maven
artifacts. I asked about this odd convention on the IRC #eclipse
channel, and someone said that Tycho can't handle BOTH p2 and Maven
artifacts. I took him at his word, but I need to get more
information about this. I'm working with someone else who believes
this shouldn't be a problem, so I need to find some proof for this
statement.
_______________________________________________
eclipse-dev mailing list
eclipse-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or
unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/eclipse-dev
_______________________________________________
eclipse-dev mailing list
eclipse-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or
unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/eclipse-dev