Eclipse Reference Anthoer project

L

Liming

Hey guys,

I'm coming from the .net background and I've been out of java
development for a few years so please bear with me.

How do I reference another project in eclipese? I have a web project
and another java project (business logic, data access logic, etc), I
want to reference the java projects from within the web project in the
IDE, i cna't find where to reference them.

one solution of course is to export jar files from the java projects
and drop them into my web project, but I don't wanne do that manually.
I could write a custom ant file i suppose, but I would like to know
where to do that in Eclipse IDE.

Also, say I can reference the java projects in some ways, is there an
automatic way after "build" that all java projects are compiled intos
jars and automatically dropped into my web project's lib directory?
This way, everytime after I compile, if i want to deploy, all i need
to focus on is my web project. This is similar to the dll idea from
visual studio.

Thanks.
 
C

Chris Smith

Liming said:
How do I reference another project in eclipese? I have a web project
and another java project (business logic, data access logic, etc), I
want to reference the java projects from within the web project in the
IDE, i cna't find where to reference them.

Choose properties on the project, and click "Java Build Path" on the
left margin. Choose the Projects tab, and check the project you need to
include.
Also, say I can reference the java projects in some ways, is there an
automatic way after "build" that all java projects are compiled intos
jars and automatically dropped into my web project's lib directory?

You can certainly add this as a custom build step. Better yet, do it
with an ant script, and use the ant script to deploy your project. Then
you aren't so tied to the IDE.
 
L

Liming

Choose properties on the project, and click "Java Build Path" on the
left margin. Choose the Projects tab, and check the project you need to
include.


You can certainly add this as a custom build step. Better yet, do it
with an ant script, and use the ant script to deploy your project. Then
you aren't so tied to the IDE.

Thanks a lot Chris. After some reading, I found out Maven project
offers exactly what I need and simplify even further of what I need to
do with Ant script. By declare a dependency on my DAO java project
from my web app project, my DAO*.jar files will be automatically
dropped into my web-inf/lib directory.

I'm just suprised that these kinds of build are not build into Java
IDEs directly. Visual Studio by default, when I reference another
project, the other project's dll will get compiled and dropped into my
current project's bin folder (the equalivent of lib directory under
WEB-INF).

Maven definitly helps out here, but still, need to get it installed
just for setting up my structure.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top