[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

how to exclude specfic jars with ant war task

Posted on 2007-11-19
7
Medium Priority
?
8,164 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 86

Accepted Solution

by:
CEHJ earned 2000 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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
In this post we will learn different types of Android Layout and some basics of an Android App.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This video teaches viewers about errors in exception handling.
Suggested Courses
Course of the Month17 days, 21 hours left to enroll

830 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