简体   繁体   中英

ant javac exclude everything not included

I am trying to write a build script for a REST service which sits on top of our existing business logic layer, however, I only want to include the minimal amount of sources to keep the service small and only contain what it absolutely needs.

Below is my current compile target. I am able to either include everything or nothing. I assume I am making a simple mistake I can't seem to spot or find online.

<target name="compile">
    <mkdir dir="${build.classes.dir}"/>
    <javac source="1.6"
           target="1.6"
           encoding="UTF-8"
           debug="true"
           debuglevel="lines,vars,source"
           srcdir="${basedir}"
           destdir="${build.classes.dir}"
           includeAntRuntime="false">
        <src>
            <dirset dir="${src.eai.dir}" errorOnMissingDir="true">
                <include name="common/vo/MyPojo.java"/>
                <include name="common/SomeException.java"/>
            </dirset>
            <dirset dir="${src.ets.dir}" errorOnMissingDir="true">
                <include name="common/vo/AnotherPojo.java" />
                <include name="price/vo/YetAnotherPojo.java" />
                <include name="price/vo/OneMorePojo.java" />
            </dirset>
            <dirset dir="${src.java.dir}" errorOnMissingDir="true">
                <include name="java"/>
            </dirset>
        </src>
        <!-- this line ignores everything, without it it includes everything -->
        <exclude name="**/*.java"/>
        <classpath refid="classpath"/>
    </javac>
</target>

Is there a way to only include the files specified above?

代替exclude ,尝试include并列出用逗号(,)分隔的Java文件,例如:

<include name="common/vo/MyPojo.java,common/SomeException.java,common/vo/AnotherPojo.java,price/vo/YetAnotherPojo.java" />

不要同时设置srcdir属性和嵌套的<src>元素,因为我想象Ant只是将两者结合在一起。

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