Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

how to exclude specfic jars with ant war task

Posted on 2007-11-19
7
7,711 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Protect jar file - windows app 2 65
more than one jdk and one jre 1 50
Notify sent to other threads in Java 9 33
Eclipse for Java EE development 2 27
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
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:
The viewer will learn how to implement Singleton Design Pattern in Java.

856 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