Jens
Jens

Reputation: 545

include Eclipseproject into other Project which is an OSGi bundle

I am developing an OSGi-Bundle (Project 1) in Eclipse and have to export it as a jar to run it on my target environment. I am using the normal eclipse export as "jar file" or export as "deployable plugins and fragments", both work well so far.

Now I have another eclipse-Project (Project 2, non-OSGi, just some classes) which I want to be included, preffered as a jar-lib in my Bundle.

I tried adding the new project as linked source in the buildpath-settings. The code will resolve well but the jar cannot be build because of missing the classes.

I also tried adding the new project as project in the buildpath-settings. It doesnt work for "deployable plugins and fragments" but for "jar file". But then, everytime i do a new jar export, it will add all sourcefiles and projectfiles of the second project into the jar.

Whats the best way to include it without having to export jars of that project all the time and without using maven, if possible?

Upvotes: 0

Views: 112

Answers (1)

Christian Schneider
Christian Schneider

Reputation: 19606

The standard OSGi way is to use Export-Package in your project2 and use Import-Package in your project1. It is no problem that you project2 is not pure OSGi as an OSGi enabled jar is still a normal jar and can be used outside OSGi by default.

So unless there is a very good reason to embed your project2 classes in project1 I would use the above way.

Upvotes: 1

Related Questions