Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipse-dev] Still stuck with no progress trying to replace "hard-stored" jars with generated bundle

Just about two weeks ago now I discovered a problem with an Eclipse plugin codebase that I inherited, being that one plugin module was storing a small number of third-party jars directly in the module. I realized quickly that I had to replace this with declarative dependencies.

Since that time, I've posted questions about this problem on eclipse-dev, tycho-user, the Eclipse platform forum, and the #eclipse IRC channel. From these queries, I've received a small number of responses, mostly talking about the idea of using the "maven-bundle-plugin" to produce a bundle from the declared Maven dependencies. Despite that, half of the responses I've gotten about this admitted that they've never gotten this to work when they had attempted this. Some of the responses referred to strategies using "mvn dependencies", or some variation, but I believe that only addresses building the bundle, not referencing it from the "core" module. As far as I can tell, what I've done so far is producing a valid bundle, I just can't get the referencing module to find it.

I've reported the problems I've been hitting, particularly on this list, but I'm going to try again, because I still don't have a solution. You might think this is more appropriate on "tycho-user", but I've already tried again there.

The main project has several modules, consisting of a handful of plugins, two features, a target platform, and an update site. The "core" plugin module (not its full name) is the one that had the "lib" folder with a handful of jars.

What I've done so far is define a new "maventhirdparty" plugin module, that declares Maven dependencies for the third-party jars formerly in the "core" module, and uses the "maven-bundle-plugin" to produce a bundle. I added the "maventhirdparty" bundle to the "Require-Bundle" list in the manifest for the "core" module. I would have thought that that would be all that is required. However, when I run the build in the "core" module, I see the following output:
--------------------
[INFO] Resolving dependencies of MavenProject: com.cisco.yangide:com.cisco.yangide.core:1.1.1-SNAPSHOT @ /home/opnfv/git/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
-------------------------------

I would REALLY like to understand how to add more verbosity to this, so I can understand where this is looking, if it couldn't find this bundle. Perhaps that verbosity will make it obvious to me what the problem is, but I'm not aware of any way to make this give me more information.

The following is an excerpt from the "maventhirdparty" pom:
----------------------------
<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-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
            <Bundle-Version>1.1.1</Bundle-Version>
            <Embed-Dependency>
              antlr4-runtime, mapdb, yang-model-api, yang-parser-impl
            </Embed-Dependency>
<Export-Package>org.opendaylight.yangtools.*, org.antlr.*, org.mapdb.*</Export-Package>
            <Embed-Transitive>true</Embed-Transitive>
            <Embed-Directory>jars</Embed-Directory>
            <_failok>true</_failok>
            <_nouses>true</_nouses>
          </instructions>
        </configuration>
      </plugin>
    </plugins>
------------------------

I also inspected the jar and manifest produced by the "maventhirdparty" build, which is installed in my local .m2 repo. Here's an excerpt of the manifest, with some of the longer values elided, if I felt they likely wouldn't provide any info:
------------------------------
Manifest-Version: 1.0
Bnd-LastModified: 1453741848674
Build-Jdk: 1.8.0_60
Built-By: opnfv
Bundle-ClassPath: .,jars/antlr4-runtime-4.0.jar,jars/mapdb-1.0.4.jar,jar
 s/yang-model-api-0.6.1.jar,jars/yang-parser-impl-0.6.1.jar
Bundle-DocURL: https://www.opendaylight.org
Bundle-License: https://www.eclipse.org/legal/epl-v10.html
Bundle-ManifestVersion: 2
Bundle-Name: com.cisco.yangide.maventhirdparty
Bundle-SymbolicName: com.cisco.yangide.maventhirdparty
Bundle-Vendor: OpenDaylight
Bundle-Version: 1.1.1
Created-By: Apache Maven Bundle Plugin
Embed-Dependency: antlr4-runtime, mapdb, yang-model-api, yang-parser-imp
 l
Embed-Directory: jars
Embed-Transitive: true
Embedded-Artifacts: ...
Export-Package: ...
Import-Package: ...
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.7))"
Tool: Bnd-3.0.0.201509101326
----------------------

I would assume the "Bundle-Name" and "Bundle-Version" properties are significant here, and their values match I specified in the manifest for the "core" module, and which are reported on the build output. Here is an excerpt of the manifest for the "core" module:
----------------------
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: com.cisco.yangide.core
Bundle-SymbolicName: com.cisco.yangide.core;singleton:=true
Bundle-Version: 1.1.1.qualifier
Bundle-Activator: com.cisco.yangide.core.YangCorePlugin
Bundle-Vendor: Cisco Systems, Inc.
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"
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy
Export-Package: com.cisco.yangide.core,
 com.cisco.yangide.core.buffer,
 com.cisco.yangide.core.dom,
 com.cisco.yangide.core.indexing,
 com.cisco.yangide.core.parser,
 com.cisco.yangide.core.model,
 org.antlr.v4.runtime
-------------------------------

Again, I'd really appreciate substantive advice that leads me to a solution to this.


Back to the top