Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[tycho-user] How to build OSGI bundle with Tycho into jar-with-dependencies ?

Hello,

I have common source code between a java application and an RCP application. So I have prepared an OSGI bundle containing :

  • a main class to use it as a classic jar

  • and the common code for using with my RCP application with a product and a repository

I built all with Tycho Manifest-first and it worked fine... Until I need to use an external jar in my common code.

Now, I need to use jsch in the common part of the code. So I have add jsch in my OSGI bundle MANIFEST.MF : 

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Main-Class: mygroupid.Main
Bundle-Name: Common tools
Bundle-SymbolicName: common-tools
Bundle-Version: 1.0.1.qualifier
Export-Package: mygroupid,
      mygroupid.tools
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: org.osgi.framework;version="1.3.0"
Require-Bundle: com.jcraft.jsch;bundle-version="0.1.46"

When I build with Tycho my RCP application, it works. But when I built my OSGI bundle alone, and trying to use it with "java -jar common-tools-1.0.1-qualifier.jar"

I have : Exception in thread "main" java.lang.NoClassDefFoundError: com/jcraft/jsch/JSchException

If I export my bundle with Eclipse, it works. So I have an error in my tycho configuration...

How to have a independant OSGI bundle with Tycho like jar-with-dependencies from Maven ?

Thanks for your help

David

Environnement : Eclipse Juno with m2e, Tycho 0.16.0





Back to the top