views:

18

answers:

2

I have three projects which are build to the same /bin directory and anoher projects (let's call it A) where this is not necessary. A requires all the other projects. When I export A as a runnable JAR, then only one of the three projects makes it into the JAR.

I can add other projects (build to different directories) which are copied into the JAR. When I remove the (alphabetic) first of the three project's from the buildpath then the next is included.

Has somebody an idea how to let eclipse copy ALL projects in the JAR without giving up that the three projects are build to the same /bin directory?

+1  A: 

Each Eclipse project should have their own bin/ directory; otherwise you will get strange errors. To solve your problem, open the project properties and add the other three projects to A in "Build Path" -> "Projects".

Eclipse will then merge the classpaths of all projects.

To export all the classes in a single JAR file, simply select the source folders of all projects in the JAR exporter.

Aaron Digulla
Thank you very much.
Simon
But the projects need to share their bin/ directory and they're already on A's build path.
Simon
@Simon: Why do they need to share `bin/`? If they are on the build path, did you also check them on the "Order and Export" page?
Aaron Digulla
Yes, I checked them on the "Order and Export" page. The shared bin/ directory is a requirement from one of the three projects. The other two are plugins from it and are loaded dynamically.
Simon
Did you check the source folders of all projects in the JAR export wizard?
Aaron Digulla
I want to create a runnable JAR. There's no option to check any source folders.
Simon
Sorry, I mixed "project JAR" and "executable JAR" :-( Have a look at Maven. You can turn your projects into modules and have Maven bundle them into a single, executable JAR.
Aaron Digulla
Thank you. I'll check this out.
Simon
A: 

A workaround would be to create a JAR from each project and include these into A.

Simon