Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » Trying to grok Java Build Path v.s. Project References v.s. Deployment Assembly
Trying to grok Java Build Path v.s. Project References v.s. Deployment Assembly [message #855240] Tue, 24 April 2012 12:23
Marc Chamberlin is currently offline Marc Chamberlin
Messages: 27
Registered: July 2009
Junior Member
After doing a LOT of Google searching, I have determined there are a LOT
of confused souls around besides myself regarding the purpose and
underlying details of what is going on when one adds projects to the
build path, adds libraries of jar files to the build path, adds a
project reference or specifies a deployment path. So if some kind guru
could provide a pointer to some documentation one can read about the
underlying model used by Eclipse and the details of what exactly happens
when these various properties are defined, I would much appreciate it!

Lets say, within a single workspace, I create a project A that is simply
a collection of common java utilities that I want to bundle together in
a jar file. That is without a doubt easy to do. Next I create a web
app, in the same workspace, that wants to use the jar file from project
A. Could someone answer the following questions for me or point me at
something that explains all this in detail?

1. What is the consequences of adding project A as a "required project"
on the build path of my web app? (done by going into the properties of
my web apps project > Java Build Path > Projects > Add) What is the
consequences of adding the jar file created by/from project A to the set
of libraries on the build path of my web app? (Properties > Java Build
Path > Libraries > Add Jars) If project A includes its source files in
the jar file it creates, then what is the difference between adding it's
jar file and adding project A as a required project? I, and I think most
Java programmers, understand the implications it has on the Java
compiler to resolve Java types, but I do not understand what the real
difference is between these two "methods/properties" nor do I understand
the implications these may have on subsequent deployment of my web app
either for example via a WAR file or publication to a server.

2. What is the consequences of adding project A to the set of project
references in my web apps properties? (done by going into the properties
of my web apps project > Project References and placing a checkmark next
to project A in the list of possible project references) This property
is very confusing because it seems somewhat redundant. What is the
difference between this and setting build path properties as asked in my
first set of questions.

3. I am guessing that the consequences of adding a deployment path in
the Web Deployment Assembly ONLY takes effect when a WAR file is created
or a project is published to a server? So if I add a Deploy Path for the
jar file created by project A, to the Deployment Assembly properties of
my web app, I will pick up the latest version of the jar file that has
been created in project A when I build a WAR file for my web app? Is
there any way to force the automatic re-creation of a jar file for
project A when it is needed by my dependent web app's deployment? Also,
it is confusing that a jar file from project A, when specified to be
deployed to my web app's WEB-INF/lib directory does not show up in the
Eclipse view of what is in WEB-INF/lib directory but it does show up
under Java Resources > Libraries > Web App Libraries. Maybe someone can
comment on this?

5. My question # 4 leads to further questions as well about jar files
put in the WEB-INF/lib directory of my web app. Is it possible for
Eclipse to get out of sync between what files are being used during
development and testing of a web app and what jar files get subsequently
deployed via a WAR file or publication to say a Tomcat server? Because
of my lack of understanding, my guess is they can get out of sync. I
could modify the source code in Project A, but the only way the jar file
gets built (correct me if I am wrong) is to remember to manually export
it in a jar file. If not, then how is this synchronization maintain?
Another way of asking this is - If Project A gets modified/updated, what
mechanisms are available in Eclipse and how are they specified, that
will insure that my web app is notified of the update, possibly force a
recreation of a new jar file for/from Project A, and automatically
copy/use the new updated jar file from Project A, when the web app is
deployed or published? How does the Eclipse IDE help me maintain
synchronization between what is seen and used during the creation/build
phase of working on a webapp, and what is seen and used on a server
when the web app is deployed?

I am presenting my questions using a very simplified model, but in a
complex environment, with lots of projects contributing lots of jar
files to multiple and/or different web projects, the management of these
could become easily susceptible to errors that in turn lead to lost time
in debugging. As I said in the beginning, in my searches on Google, I
found a LOT of people having troubles understanding the Eclipse model on
building v.s. publication/deployment. If no good documentation exists
yet, I think my questions might form the basis for a good document
explaining these details in a way that will allow others to grok what
all these various properties are for and how they are used. But we need
someone with a good internal understanding of Eclipse to take the time
to answer.. And please, I am NOT looking for simple cookbook answers,
but a deeper understanding of the model Eclipse is using, so I can
understand where there are pitfalls, how misuse of these parameters
might occur, how they are interrelated, what their real purpose is and
what underlying effects they have.

Thanks in advance...

Marc..
Previous Topic:Editing Library in build path
Next Topic:Problem with WAR File Export (lastmodified)
Goto Forum:
  


Current Time: Fri Aug 22 02:02:36 EDT 2014

Powered by FUDForum. Page generated in 0.01454 seconds