Javac package exception in ANT build.xml

I am trying to compile all my packages except two of them, here is what my javac in build.xml looks like

<javac srcdir="${src}" destdir="${output}" debug="${debug}" failonerror="yes" >
    <exclude name="com/abc/uyyy/**"/>
    <exclude name="com/abc/zzz/**"/>
    <include name="com/abc/zzz/Text.java"/>
    <patternset refid="excluded.from.compilation.abc"/>
    <classpath refid="abc.module.classpath"/>
</javac>

But all the files in the package are compiled: (.

I read the documentation ( http://ant.apache.org/manual/Tasks/javac.html) but still failed, any help?

NOTE. After compiling Text.java, I need to create a WSDL file and then create excluded packages. I use Metro to write and build WS.

+3
source share
3 answers

Well here's what I did, I wrote a new target to compile only the WS file, and then generated the classes, it works fine :)

<target name="compile-ws-server">
        <javac srcdir="${src}" destdir="${output}"
        debug="${debug}" failonerror="yes">
            <include name="com/abc/xxx/Text.java"/>
            <exclude name="${src}/abc/xxx/**"/>
            <classpath refid="abc.module.classpath"/>
        </javac>
    </target>
+2
source

, , , , WSDL?

<target name="copy_all_class_files">
    <copy todir="${output}">
        <fileset dir="classes">
            <include name="com/abc/zzz/Text.class"/>
            <exclude name="com/abc/uyyy/**"/>
            <exclude name="com/abc/zzz/**"/>
        </fileset>
    </copy>
</target> 
+2

All above, this is not the right way ...

I did as

<target name="compile" depends="init">
    <javac srcdir="${src}" destdir="${build}" excludes="com/company/example/test/**" />
</target>

Here we must avoid placing $ {src} and run src folders from within.

0
source

Source: https://habr.com/ru/post/1767503/


All Articles