Solved

how to exclude specfic jars with ant war task

Posted on 2007-11-19
7
7,501 Views
Last Modified: 2012-05-05
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>
0
Comment
Question by:chaitu chaitu
  • 4
  • 2
7 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 20313258
The exclude/include need to be inside a <fileset>
0
 
LVL 9

Expert Comment

by:ysnky
ID: 20314796
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
0
 
LVL 20

Author Comment

by:chaitu chaitu
ID: 20318260

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>
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 86

Accepted Solution

by:
CEHJ earned 500 total points
ID: 20321808
Try

<webinf dir="../web/WEB-INF" includes="**/*.jar" excludes="**/classes12.jar,**/jstl-1.1.0.jar" />

That should be the only element you need for WEB-INF/lib, so get rid of the others
0
 
LVL 20

Author Comment

by:chaitu chaitu
ID: 20326458
i write like this and its working.u wrote in that similiar lines only

<webinf dir="../web/WEB-INF" includes="*.tld,*.xml" >
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 20326465
OK that's good
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 20326708
:-)
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This video teaches viewers about errors in exception handling.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now