File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

about development with multiple java packages using ant

 
david hu
Ranch Hand
Posts: 143
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am working on a project that used multiple open source java packages in addition to J2EE. My question is that

1) where do you guys put these jars files, in the ..\lib directory where these packages installed? or put them into a single location?

2) During deployment, do you put all these jars files inside tomcat_home\shared\lib, or just set the classpath to where thse ..lib directory where these packages installed?

3) How to make ant build easier for the build and deployment process?

Thanks,

David
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64205
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
At run-time, I place them in WEB-INF/lib because different web applications may require different versions of the packages.

At compile it doesn't really matter where you put them as long as you define your ant task to add them to the classpath.

I keep them in a single location where ant adds them to the classpath, then makes a copy in WEB-INF/lib when building the war file.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree with Bear on most points. (I've stopped being surprised at this )

Yes, always try to place the jars in the WEB-INF/lib directory. There are some specific cases I've found it necessary to place them elsewhere, but they are the exception to the rule (such as using LDAP for authentication, since the server needs the jars too)

I tend to try to do it the way Bear says at compile time, and this is a good way to do it, although when I'm feeling lazy I place the runtime jars in the WEB-INF/lib dir and the compiletime or testing JARs (such as junit or j2ee jars) in a lib jar.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64205
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by David O'Meara:
There are some specific cases I've found it necessary to place them elsewhere...


Another good example of this is when using container-managed connection pooling. The jar file with the JDBC implementation must be placed in common/lib so that it available to both Tomcat and the web apps.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic