Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to reference Shared Libraries in Ant

843833Jun 2 2009
The User Library in WTP allows external JARs to be loaded in the project at runtime, this allows reducing the overall WAR files, and reuse the common libraries from many Web Applications, but somehow I cannot get the WAR to reference the Shared Library location here is my ANT file, what do I need to do, so that it will make the WAR load libraries other than WEB-INF/lib

<project name="invsBuilder" default="war" basedir="..">
<property file="ant/build.properties"/>
<path id="classpath">
<fileset dir="D:/eclipse/workspace/${lib.dir}">
<include name="**/*.jar"/>
</fileset>
</path>
<target name="clean">
<echo>../${lib.dir}</echo>
<echo>Cleaning the ${build.dir}</echo>
<delete dir="${build.dir}"/>
</target>
<target name="init" depends="clean">
<echo>Creating the build directory</echo>
<mkdir dir="${build.dir}/WEB-INF/classes"/>
<mkdir dir="${build.dir}/WEB-INF/classes/WSDL"/>
<mkdir dir="${build.dir}/WEB-INF/classes/META-INF"/>
<mkdir dir="${build.dir}/WEB-INF/classes/META-INF/xfire"/>
<mkdir dir="${build.dir}/WEB-INF/lib"/>
<mkdir dir="${dist.dir}/"/>
</target>
<target name="compile" depends="init">
<echo>Compile the source files</echo>
<javac srcdir="${src.dir}" destdir="${build.dir}/WEB-INF/classes">
<classpath refid="classpath"/>
</javac>
</target>
<target name="copy" depends="compile">
<copy todir="${build.dir}/WEB-INF/">
<fileset file="WebContent/WEB-INF/web.xml"/>
</copy>
<copy todir="${build.dir}/WEB-INF/classes/WSDL">
<fileset file="${src.dir}/WSDL/*"/>
</copy>
<copy todir="${build.dir}/WEB-INF/classes/META-INF/xfire">
<fileset file="${src.dir}/META-INF/xfire/*"/>
</copy>
</target>
<target name="war" depends="copy">
<echo>Building the war file</echo>
<war destfile="${dist.dir}/${project.name}.war" webxml="${build.dir}/WEB-INF/web.xml">
<fileset dir="${build.dir}"/>
</war>
</target>
</project>


Thanks a Million

Sarvapriya
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 30 2009
Added on Jun 2 2009
0 comments
280 views