YMA
YMA

Reputation: 259

Eclipse Java - Use output of one project as lib in other

I have two projects, "Foo Engine" and "Foo Webapp". Obviously, to run the webapp, I can package Foo as a jar, and link to this jar. But this is time consuming when you are making changes to Foo as well. Is there a way to tell eclipse to continually update the jar in the same way as the in-editor instant-compile system (is this even possible?), and specify the path for this jar (so that it's in the lib folder of webapp).

Thanks!

Edit: Thanks for the advice! I've just realised that the webapp project isn't being compiled by eclipse, but by the webapp framework (play) - so the reference projects option isn't available. I'll see if I can refer to a project in play, if not I'll go back to jar packaging...

wtf? I'm not even allowed to vote up the answers... Sorry about that guys

Upvotes: 2

Views: 1401

Answers (2)

dogbane
dogbane

Reputation: 274898

From the Eclipse User Guide:

Open the Java Build Path dialog (Project > Properties > Java Build Path) and go to the Projects tab.

In the Required projects on the build path list, you can add project dependencies by selecting other workbench projects to add to the build path for this new project.

Adding a required project indirectly adds all its classpath entries marked as 'exported'. Setting a classpath entry as exported is done in the Order and Export tab

Upvotes: 2

Joachim Sauer
Joachim Sauer

Reputation: 308279

Simple add the "Foo Engine" project as a dependency to the "Foo Webapp" project.

Upvotes: 1

Related Questions