I have the following projects setup in Eclipse Indigo SR1:
What I want to do is get rid of the manual export and copy of the JAR from project A into project B. I do not want to convert this project to a plug-in project because the same project is used in a legacy application that does not use OSGi.
This is particularly annoying since when I update the JAR eclipse does not pickup the modified class files and all my breakpoints in there go crazy (a separate issue).
I thought I would be able to edit the project properties for B so that A was a "Required project" (Proeprties -> Java Build Path -> Projects), and since that essentially includes the source (at least I guess that is what the entry in .classpath is doing ) I figured I could then export package P from project B. However when I do this, eclipse just complains that plug-in project B does not contain package P.
I figured I could just link the source folders from A into B but that's not really what I want to do.
If a referenced project A is on the classpath then surely the plug-in project A should be able to export those packages, or am I wrong in this assumption?
What is the best way to achieve what I want?
Cheers, Jason.
you should consider using maven as your build tool. the tool was built to automate exactly things you've described. Maven
You should convert your java project into a plugin project (an OSGi bundle) in this case. You can still use it both as a regular jar and as a plugin. When you convert it, make sure it creates the MANIFEST.MF. Just don't create an activator as that would require a dependency on org.eclipse.osgi
, and don't add any other require-bundle dependencies.
An OSGi bundle is really just a jar (which is fine) with an OSGi MANIFEST.MF that provides information like what packages are exported, any dependencies, etc.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.