title: How can I add imported jar files to web-inf/lib in eclipse for my build?
body: <p>I understand questions relating to this has been answered, but I have not come across this particular question answered in my search.</p>
  
  <p>I've been trying to get my imported JAR files included in my build (shown below) of the spring application, but anything and everything I've done has not been the solution. I receive 'package does not exist' error when building in Eclipse using Tomcat and Ant because it cannot find the JAR files in the web-inf/lib folder (obviously). Eclipse does not allow me to drop and drag the files from the Referenced Library utility library to any desired folder. When I attempt to configure the build path, I add the external JARs and the directory path from which the file is located shows up next to the JAR in the libraries tab. The publish/export dependency is set to the WEB-INF/lib folder I've read adding all JAR files directly to the Tomcat/lib folder (which should not be done) could solve the issue but that's not the case for me. The deploy assembly path I set to /WEB-INF/lib for the JARs, no luck. I've tried restarting Eclipse, no luck. I created a new dynamic web project, no luck. I've unzipped the war file and no JAR files found, which is expected. I believe my environment variables are added correctly from</p>
  
  <p>It's been years since I've played with Eclipse and Spring applications, so I expect I'm missing an important step. </p>
  
  <p>NOTES:
  This is a Spring tutorial I've been working with to get back on my feet with Spring.
  Eclipse version 4.3.0
  Tomcat version 6
  Ant version 1.8.4 - was included as a plugin for Eclipse download</p>
  
  <p>Any help will be greatly appreciated, since I would enjoy playing with web applications once again.</p>
  
  <pre><code>&lt;project name="springapp1" basedir="." default="usage"&gt;
  &lt;property file="build.properties"/&gt;
  
  &lt;property name="lib.dir" value="C:/Eclipse/Tomcat/lib"/&gt;
  &lt;property name="webapps.dir" value="C:/Eclipse/Tomcat/webapps"/&gt;
  
  &lt;property name="src.dir" value="src"/&gt;
  &lt;property name="web.dir" value="WebContent"/&gt;
  &lt;property name="build.dir" value="${web.dir}/WEB-INF/classes"/&gt;
  &lt;property name="name" value="springapp1"/&gt;
  
  &lt;path id="master-classpath"&gt;
      &lt;fileset dir="${web.dir}/WEB-INF/lib"&gt;
          &lt;include name="*.jar"/&gt;
      &lt;/fileset&gt;
      &lt;!-- We need the servlet API classes: --&gt;
      &lt;!--  * for Tomcat 5/6 use servlet-api.jar --&gt;
      &lt;!--  * for other app servers - check the docs --&gt;
  
      &lt;!--&lt;fileset dir="${appserver.lib}"&gt;--&gt;
      &lt;fileset dir="${lib.dir}"&gt;
          &lt;include name="servlet*.jar"/&gt;
      &lt;/fileset&gt;
      &lt;pathelement path="${build.dir}"/&gt;
  &lt;/path&gt;
  
  &lt;target name="usage"&gt;
      &lt;echo message=""/&gt;
      &lt;echo message="${name} build file"/&gt;
      &lt;echo message="-----------------------------------"/&gt;
      &lt;echo message=""/&gt;
      &lt;echo message="Available targets are:"/&gt;
      &lt;echo message=""/&gt;
      &lt;echo message="build     --&gt; Build the application"/&gt;
      &lt;echo message="deploy    --&gt; Deploy application as directory"/&gt;
      &lt;echo message="deploywar --&gt; Deploy application as a WAR file"/&gt;
      &lt;echo message="install   --&gt; Install application in Tomcat"/&gt;
      &lt;echo message="reload    --&gt; Reload application in Tomcat"/&gt;
      &lt;echo message="start     --&gt; Start Tomcat application"/&gt;
      &lt;echo message="stop      --&gt; Stop Tomcat application"/&gt;
      &lt;echo message="list      --&gt; List Tomcat applications"/&gt;
      &lt;echo message=""/&gt;
  &lt;/target&gt;
  
  &lt;target name="build" description="Compile main source tree java files"&gt;
      &lt;mkdir dir="${build.dir}"/&gt;
      &lt;javac destdir="${build.dir}" source="1.5" target="1.5" debug="true"
             deprecation="false" optimize="false" failonerror="true"&gt;
          &lt;src path="${src.dir}"/&gt;
          &lt;classpath refid="master-classpath"/&gt;
      &lt;/javac&gt;
  &lt;/target&gt;
  
  &lt;target name="deploy" depends="build" description="Deploy application"&gt;
      &lt;copy todir="${webapps.dir}/${name}" preservelastmodified="true"&gt;
          &lt;fileset dir="${web.dir}"&gt;
              &lt;include name="**/*.*"/&gt;
          &lt;/fileset&gt;
      &lt;/copy&gt;
      &lt;echo message="Deploy Completed."/&gt;
  &lt;/target&gt;
  
  &lt;target name="deploywar" depends="build" description="Deploy application as a WAR file"&gt;
      &lt;war destfile="${name}.war"
           webxml="${web.dir}/WEB-INF/web.xml"&gt;
          &lt;fileset dir="${web.dir}"&gt;
              &lt;include name="**/*.*"/&gt;
          &lt;/fileset&gt;
      &lt;/war&gt;
      &lt;copy todir="${webapps.dir}" preservelastmodified="true"&gt;
          &lt;fileset dir="."&gt;
              &lt;include name="*.war"/&gt;
          &lt;/fileset&gt;
      &lt;/copy&gt;
  &lt;/target&gt;
  
  &lt;path id="catalina-ant-classpath"&gt;
      &lt;!-- We need the Catalina jars for Tomcat --&gt;
      &lt;!--  * for other app servers - check the docs --&gt;
      &lt;fileset dir="C:/Eclipse/Tomcat/lib"&gt;
          &lt;include name="catalina-ant.jar"/&gt;
      &lt;/fileset&gt;
  &lt;/path&gt;
  
  &lt;taskdef name="install" classname="org.apache.catalina.ant.InstallTask"&gt;
      &lt;classpath refid="catalina-ant-classpath"/&gt;
  &lt;/taskdef&gt;
  &lt;taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask"&gt;
      &lt;classpath refid="catalina-ant-classpath"/&gt;
  &lt;/taskdef&gt;
  &lt;taskdef name="list" classname="org.apache.catalina.ant.ListTask"&gt;
      &lt;classpath refid="catalina-ant-classpath"/&gt;
  &lt;/taskdef&gt;
  &lt;taskdef name="start" classname="org.apache.catalina.ant.StartTask"&gt;
      &lt;classpath refid="catalina-ant-classpath"/&gt;
  &lt;/taskdef&gt;
  &lt;taskdef name="stop" classname="org.apache.catalina.ant.StopTask"&gt;
      &lt;classpath refid="catalina-ant-classpath"/&gt;
  &lt;/taskdef&gt;
  
  &lt;target name="install" description="Install application in Tomcat"&gt;
      &lt;install url="${tomcat.url}"
               username="${tomcat.username}"
               password="${tomcat.password}"
               path="/${name}"
               war="${name}"/&gt;
  &lt;/target&gt;
  
  &lt;target name="reload" description="Reload application in Tomcat"&gt;
      &lt;reload url="${tomcat.url}"
               username="${tomcat.username}"
               password="${tomcat.password}"
               path="/${name}"/&gt;
  &lt;/target&gt;
  
  &lt;target name="start" description="Start Tomcat application"&gt;
      &lt;start url="${tomcat.url}"
               username="${tomcat.username}"
               password="${tomcat.password}"
               path="/${name}"/&gt;
  &lt;/target&gt;
  
  &lt;target name="stop" description="Stop Tomcat application"&gt;
      &lt;stop url="${tomcat.url}"
               username="${tomcat.username}"
               password="${tomcat.password}"
               path="/${name}"/&gt;
  &lt;/target&gt;
  
  &lt;target name="list" description="List Tomcat applications"&gt;
      &lt;list url="${tomcat.url}"
               username="${tomcat.username}"
               password="${tomcat.password}"/&gt;
  &lt;/target&gt;
  </code></pre>
  
  
  
  <p></p>