Including libraries in WAR files in Eclipse

By default, the newer versions of Eclipse do not include the libraries that you add to the build path in .war files. There are three approaches to solving this problem:

  • Declare your libraries/jar files to be module dependencies for your war file; essentially forcing Eclipse fo treat the lib the same way it would a dependent project. I found a web page describing how to do this for an older version of Eclipse and couldn’t readily figure out how to do it with Helios. This one is an excersize for the reader.
  • Add the library to your directory of shared libraries on your app server.
  • Either copy, or symlink the jar files directly into your WEB-INF/lib directory on your file system and then do a refresh for your project in Eclipse.

Leave a Reply