Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[tycho-user] Failing with simple dependency on guava

Hi again,

In a previous question, I was trying to bundle the gauva-18.0.jar into an OSGi compliant wrapper. As mcculls@xxxxxxxxx noted, the gauva-18.0.jar already comes with the correct OSGi metadata in the MANIFEST.MANIFEST.MF file.  As igor@xxxxxxxxxxxxxx pointed out, when I was building my own bundle, is was missing required Header fields.  So why not try to use the pre-packaged gauva-18.0.jar as it is.

Unfortunately, I unable to get the gauva-18.0.jar to work in a simple Tycho/Maven project that uses "eclipse-plugin" packaging.

Attached is a zip file with a nearly minimal example.  The notes below are drawn from that project.

The pom.xml file defines one dependency:

  <dependencies>
    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <version>18.0</version>
    </dependency>
  </dependencies>

The configuration for build plugin "target-platform-configuration" specifies <pomDependencies> "consider".

If you import the project into Eclipse, it appears to compile successfully.  At least there are no "red-stickies".  The Maven Dependencies show guava-18.0.jar is present.  However, I cannot add it on the Required Plug-ins page of the Manifest editor.  This seems to cause problems with the both the debug launch and the command line Maven build.

If I Launch an Eclipse application to test the BundleUser project, selecting the new action (Sample Menu -> Sample Action or the Eclipse icon on the toolbar) results in a ClassNotFoundException:

   java.lang.ClassNotFoundException: org.demo.bundleuser.actions.SampleAction cannot be found by BundleUser_1.0.0.qualifier

Although Eclipse seems to think the project builds, a command line Maven build reports errors about undefined imports and methods:

ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:0.20.0:compile (default-compile) on project BundleUser: Compilation failure: Compilation failure:
[ERROR] /Users/lee.carver/Projects/DepAn/tycho/demo-002/BundleUser/src/org/demo/bundleuser/actions/SampleAction.java:[9]
[ERROR] import com.google.common.base.Joiner;
[ERROR] ^^^^^^^^^^
[ERROR] The import com.google cannot be resolved
[ERROR] /Users/lee.carver/Projects/DepAn/tycho/demo-002/BundleUser/src/org/demo/bundleuser/actions/SampleAction.java:[34]
[ERROR] String msg = Joiner.on(", ").join("Hello", "world");
[ERROR] ^^^^^^
[ERROR] Joiner cannot be resolved

Ultimately, I'd like to use and package guava (and a dozen other third-party libraries) into a much larger RCP application.  But I'm stymied trying to get the references to existing OSGi bundles to work.

Thanks in advance for your guidance
   Lee

Attachment: BundleUser.zip
Description: Zip archive


Back to the top