Link to home
Start Free TrialLog in
Avatar of chaitu chaitu
chaitu chaituFlag for India

asked on

how to exclude specfic jars with ant war task

Below is the war Task; i want to exclude classes12.jar,jstl-1.1.0.jar in WEB-INF/lib of x.war; but when i open x.war(WEB-INF/lib) still classes12.jar existing.how to exclude classes12.jar in my  WEB-INF/lib of x.war.

<war destFile="${temp.dir}/${x.war.name}" webxml="../web/WEB-INF/web.xml" manifest="../web/META-INF/MANIFEST.MF" duplicate="preserve">
      <classes dir="${web.compile.dir}"/>
      <fileset dir="../web/" includes="jsp/**"/>
      <fileset dir="../web/" includes="*.jsp"/>
      <fileset dir="../web/" includes="*.html"/>
<lib  dir="../web/WEB-INF/lib">
      <exclude name="classes12.jar"/>
      <exclude name="jstl-1.1.0.jar"/>

</lib>
<webinf dir="../web/WEB-INF" excludes="web.xml,/lib/*.jar,/classes/**" />
</war>
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

The exclude/include need to be inside a <fileset>
a sample how to exclude;

<!-- Generate the war file -->
    <target name="war" depends="prepare-war">

        <war warfile="${final.war.name}"
             webxml="${conf.dir}/web.xml"
             manifest="${out.conf.dir}/manifest">

            <classes dir="${out.classes.dir}">
                <!-- Do not include test files in the runtime jar -->
                <exclude name="**/Test*.*"/>
                <exclude name="**/test*.*"/>

                <!-- Also exclude the test cactus.properties file -->
                <exclude name="cactus.properties"/>
            </classes>

            <fileset dir="${web.dir}">
                <exclude name="test/**"/>
            </fileset>
        </war>

    </target>

for more info;
http://www.ch-open.ch/html/ws/ws01/commons-cactus-23-1.1/doc/ant.html
Avatar of chaitu chaitu

ASKER


If i write like this, still these 2 jars existing in WEB-INF/lib directory.



<war destFile="${temp.dir}/${x.war.name}" webxml="../web/WEB-INF/web.xml" manifest="../web/META-INF/MANIFEST.MF" duplicate="preserve">
      <classes dir="${web.compile.dir}"/>
      <fileset dir="../web/" includes="jsp/**"/>
      <fileset dir="../web/" includes="*.jsp"/>
      <fileset dir="../web/" includes="*.html"/>
<fileset  dir="../web/WEB-INF/lib">
      <exclude name="classes12.jar"/>
      <exclude name="jstl-1.1.0.jar"/>

</fileset>
<webinf dir="../web/WEB-INF" excludes="web.xml,/lib/*.jar,/classes/**" />
</war>
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
i write like this and its working.u wrote in that similiar lines only

<webinf dir="../web/WEB-INF" includes="*.tld,*.xml" >
OK that's good
:-)