简体   繁体   中英

How to exclude particular java folders and java files using ANT Build

I'm using ANT build.xml for compile the java code and move the file into tomcat. Its working fine but now I've created multiple folders based on project requirement LIKE,

     com/abc/bean/abcbean.java
     com/abc/bean/model/abcmodel.java
     com/abc/bean/model/util/abcutil.java

So i want to exclude the files com/abc/bean/model/abcmodel.java and include other folders and files. How can i do this?

If you want to exclude files at compilation time, you may use options provided by javac ant task ( http://ant.apache.org/manual/Tasks/javac.html ). For instance:

<javac srcdir="${src}"
       destdir="${build}"
       includes="com/abc/**"
       excludes="com/abc/bean/model/*.java"/>

you may also use nested elements to do more complex filtering job (see ant documentation link above).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM