开发者

Use packages from plain old Java project in eclipse plugin project

开发者 https://www.devze.com 2022-12-23 06:17 出处:网络
I h开发者_StackOverflowave the following setup: eclipse a standard Java project (A) an eclipse plugin project (B)

I h开发者_StackOverflowave the following setup:

  • eclipse
  • a standard Java project (A)
  • an eclipse plugin project (B)

How (if possible) can I use packages from A within B without first compiling a JAR file from A and adding it to B?

Thanks!


The java project A needs to be known from OSGi/Eclipse in order to be accessible at design time (ie while in eclipse, including launch and debugging) and then at runtime. The correct approach would be to make A an OSGI bundle, and reference this in B:

  • select A, right-click, project, pde tools, convert to plugins project ...

  • then in B, open the manifest.mf and add (com.example.pack being some packages defined in A that you want to use in B): Import-Package: com.example.pack


if you declare:

  • a project with sources from A
    ("New" Java Project / "Create a Java Project" / "create project from existing source")
  • a second project with:
    • sources from B
    • project dependency including "projectA"

you will get just what you need.
(a compilation -- of sources from A -- is still needed, but no jarA needs to be produced)

0

精彩评论

暂无评论...
验证码 换一张
取 消