Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » 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 #854573] Tue, 24 April 2012 04:06 Go to next message
Marc Chamberlin is currently offline Marc ChamberlinFriend
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 check-mark
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.

I dunno which newsgroup would be best to post these questions to, and
since I am by no means a guru myself, I will just pose as a newcomer to
Eclipse and ask here initially. If there is a better group, please point
me in the right direction. Thanks in advance...

Marc..
Re: Trying to grok Java Build Path v.s. Project References v.s. Deployment Assembly [message #854595 is a reply to message #854573] Tue, 24 April 2012 04:43 Go to previous messageGo to next message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3798
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 2012.04.23 22:06, Marc Chamberlin wrote:
> 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!
>
> [snip]
>
> I dunno which newsgroup would be best to post these questions to, and
> since I am by no means a guru myself, I will just pose as a newcomer to
> Eclipse and ask here initially. If there is a better group, please point
> me in the right direction. Thanks in advance...
>
> Marc..


Because your question does seem to strike at the Dynamic Web Project, it
might be more appropriate in the Eclipse web tools forum, but this is
relevant to this forum also.

There isn't just one answer. I've never used "dependent" projects myself
because I build software that must have a life, configuration management
speaking, outside of Eclipse. However, I have used Web App Libraries,
User Libraries and other means.

My present strategy makes use of Apache Ivy, but basically I prefer to
create a lib subdirectory directly off the root of the project with
subdirectories underneath it so that my Hibernate JARs aren't mixed with
my Jersey JARs which aren't mixed with my Spring JARs, etc. I use Build
Path->Libraries->Add JARs to wire up to the Eclipse classpath and the
Deployment Assembly mechanism. I use a flatten statement in build.xml to
ensure that all my JARs are present in the WAR file since Tomcat will
not dive down into the artificial (but useful) subdivisions I place
under the lib subdirectory.

I have also at other times used WebContent/WEB-INF/lib.

As I say, there are myriad solutions to your woes. I would be willing to
go into more specifics if you wish, but the way I do it isn't the way
everyone else solves it. Maven is a very popular tool, one that I do not
like, but it seems to be the king of solutions everywhere else. It has a
place in this discussion.

I've avoided discussing the sharing of projects; this is because I use
ant to build, jar and deploy, including between projects, since I use
Jenkins and have to jump through configuration management hoops anyway,
so I don't tend to use a purely Eclipse solution.

Hope this doesn't just add to your frustrations and I know I haven't
been very specific.

Russ
Re: Trying to grok Java Build Path v.s. Project References v.s. Deployment Assembly [message #855266 is a reply to message #854595] Tue, 24 April 2012 16:55 Go to previous message
Marc Chamberlin is currently offline Marc ChamberlinFriend
Messages: 27
Registered: July 2009
Junior Member
On 4/23/2012 9:43 PM, Russell Bateman wrote:
> On 2012.04.23 22:06, Marc Chamberlin wrote:
>> 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!
>>
>> [snip]
>>
>> I dunno which newsgroup would be best to post these questions to, and
>> since I am by no means a guru myself, I will just pose as a newcomer to
>> Eclipse and ask here initially. If there is a better group, please point
>> me in the right direction. Thanks in advance...
>>
>> Marc..
>
>
> Because your question does seem to strike at the Dynamic Web Project, it
> might be more appropriate in the Eclipse web tools forum, but this is
> relevant to this forum also.
>
> There isn't just one answer. I've never used "dependent" projects myself
> because I build software that must have a life, configuration management
> speaking, outside of Eclipse. However, I have used Web App Libraries,
> User Libraries and other means.
>
> My present strategy makes use of Apache Ivy, but basically I prefer to
> create a lib subdirectory directly off the root of the project with
> subdirectories underneath it so that my Hibernate JARs aren't mixed with
> my Jersey JARs which aren't mixed with my Spring JARs, etc. I use Build
> Path->Libraries->Add JARs to wire up to the Eclipse classpath and the
> Deployment Assembly mechanism. I use a flatten statement in build.xml to
> ensure that all my JARs are present in the WAR file since Tomcat will
> not dive down into the artificial (but useful) subdivisions I place
> under the lib subdirectory.
>
> I have also at other times used WebContent/WEB-INF/lib.
>
> As I say, there are myriad solutions to your woes. I would be willing to
> go into more specifics if you wish, but the way I do it isn't the way
> everyone else solves it. Maven is a very popular tool, one that I do not
> like, but it seems to be the king of solutions everywhere else. It has a
> place in this discussion.
>
> I've avoided discussing the sharing of projects; this is because I use
> ant to build, jar and deploy, including between projects, since I use
> Jenkins and have to jump through configuration management hoops anyway,
> so I don't tend to use a purely Eclipse solution.
>
> Hope this doesn't just add to your frustrations and I know I haven't
> been very specific.
>
> Russ

Thanks Russ, I will post my question on the webtools newsgroup also...
And while I appreciate your offer to show me more details in how you
have solved some of these issues for your project(s), as I said in my
post, I am not looking for a particular solution/approach or a
"cookbook" set of instructions. Rather I want to be able to understand
what the Eclipse model is, exactly what these various parameters and
settings do etc. If I can understand the implications more fully, then I
(and probably other Java programmers) have a much better chance at being
able to adapt and use these tools to our advantage...

If the Eclipse teams are not addressing the issue, or providing a means
of keeping the build environment in complete sync with the
published/deployment environment, then I think that is an issue which
should be brought to their attention. But I DON'T know yet if that is
the case. What I do know is that so far I have not found adequate
documentation about the underlying model and the interactions between
these various settings and how they impact Eclipse. As you implied,
there may be multiple approaches to solving this issue, but without a
deeper understanding of Eclipse, one can only guess and guessing can be
costly if a mistake is not discovered early on, i.e when setting up
projects. I have already discovered too that Eclipse can be somewhat
brittle in that once you select a project type, or set up some settings,
it may be very difficult to try and change your selections later on when
you discover you may have made a wrong choice....

Marc..
Previous Topic:Eclipse Indigo Reporting and External Browser
Next Topic:What is org.eclipse.rcp.feature.group and where do I find it?
Goto Forum:
  


Current Time: Thu Apr 25 09:46:39 GMT 2024

Powered by FUDForum. Page generated in 0.06009 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top