Skip to main content

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

Ok .. I guess I was hoping for more support from PDE/Manifest editor.

Manually adding "com.google.guava" to the Require-Bundle header also seems to work.  I assume this means I don't have to explicitly import every Guava package that the application uses.  I am happily surprised that Eclipse doesn't complain about a plugin that it doesn't seem to know about.

Too bad PDE doesn't recognize Maven dependencies as available plug-ins or bundles.

Thanks
   Lee

On Sun, Nov 30, 2014 at 9:30 AM, Stuart McCulloch <mcculls@xxxxxxxxx> wrote:
Hi,

Your current bundle manifest doesn’t import any packages (it just requires the Eclipse UI and runtime) - if I add this import:

Import-Package: com.google.common.base

to the manifest then it compiles fine, because this package is now visible to the bundle.

I can then also launch the example from Eclipse with M2E+Tycho and use the sample action.

-- 
Cheers, Stuart

On Sunday, 30 November 2014 at 00:44, Lee Carver wrote:

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
_______________________________________________
tycho-user mailing list
To change your delivery options, retrieve your password, or unsubscribe from this list, visit

Attachments:
- BundleUser.zip


_______________________________________________
tycho-user mailing list
tycho-user@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/tycho-user


Back to the top