Topic: ant求助2,文件过滤

  Print this page

1.ant求助2,文件过滤 Copy to clipboard
Posted by: updatedb
Posted on: 2004-07-16 13:17

求助:
在利用ant打包war时,大概代码如下:
<war filename="hello.war" webxml="./meta/web.xml">
<fileset dir="./hello">
..........
<webinfo dir="./hello/WEB-INF"/>
</war>
这将导致WEB-INFO中的内容两次(fileset也将WEB-INF打了一次)被打进hello.war中,我想知道如何在打包时将WEB-INF去掉。
(当
<fileset dir="./hello/images"/>
<fileset dir="./hello/css"/>
images ,css在包内没有被建立,而是将它们下面的文档打到包的根目录中)

也就是,如何在fileset中,过滤掉一个目录

QQ:76903573

2.Re:ant求助2,文件过滤 [Re: updatedb] Copy to clipboard
Posted by: l_walker
Posted on: 2004-07-19 13:20

参考一下,你可以将注释部分修改成你需要的

<!-- ============================================== -->
  <!-- Generate war file -->
  <!-- ============================================== -->    
  <target name="war"
    depends="jar,-init-j2ee,gen-webxml,i18n"
    description="Generate war file.">

<!--define properties and directory-->
    <property name="war.name" value="${app.release.name}.war"/>
    <property name="war.dist.dir" value="${app.dist.dir}/${DSTAMP}"/>
    <mkdir dir="${war.dist.dir}"/>    
    
    <echo>+ ===================================================== +</echo>
    <echo>+ +</echo>
    <echo>+ Generating war file: +</echo>
    <echo>+ ${war.name} </echo>
    <echo>+ +</echo>
    <echo>+ ===================================================== +</echo>

<war destfile="${war.dist.dir}/${war.name}"
webxml="${app.web.webinf}/web.xml"
index="true">
      
      <!-- /WEB-INF/ most are configuration files.
<webinf dir="${app.web.webinf}">
<exclude name="web.xml" />
<exclude name="**/tmp/*" />
<exclude name="**/work/*" />
<exclude name="**/lib/**/* "/>

    </webinf>-->
    
      <!--
      <lib dir="${app.lib.runtime}" includes="*.jar" />     
      
      <lib dir="${app.web.lib}" includes="*.jar" />-->

      <!-- Class files without java class files,the class
       files packaged in the jar file in web-inf/lib.
       and here just contain the property and xml files
       under ${app.build.classes} directory,such as
       hibernate.properties
       log4j.properties/or log4j.xml
       and others  -->  
      
<classes dir="${app.build.classes}">
      <include name="*.properties" />
      <include name="*.xml" />
      <exclude name="**/*Test.class" />
    </classes>
    <fileset dir="${app.web.dir}">
<exclude name="**/WEB-INF/*" />
</fileset>
</war>    
  </target>

3.Re:ant求助2,文件过滤 [Re: updatedb] Copy to clipboard
Posted by: updatedb
Posted on: 2004-07-20 12:56

<exclude name="**/*Test.class" />

**/*.jar
**/*
中**代表什么意思?

4.Re:ant求助2,文件过滤 [Re: updatedb] Copy to clipboard
Posted by: l_walker
Posted on: 2004-07-21 09:37

all jar files in the directory

$ANT_HOME/docs/manual/index.html

you can found the ant core and optional task descriptioon and examplesSmile

5.Re:ant求助2,文件过滤 [Re: updatedb] Copy to clipboard
Posted by: updatedb
Posted on: 2004-07-22 09:38

thank u


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923