简体   繁体   中英

Compile java classes ".class" ANT

I've a question about compiling and deployment process with ANT tool in JAVA.

According to my knowledge in java, when we have ".class" files this means that these classes are already compiled. Also a jar files contain compiled classes.

So, how can we compile jars that are already compiled (see the text bellow)? Is it possible and why?

<target name="compile_common" description="compile the java classes ">
    <mkdir dir="${BUILD_PATH}" />
    <javac target="1.6" source="1.6" srcdir="${SRC_COMMON}" destdir="${BUILD_PATH}" failonerror="false" debug="true">
        <classpath>
            <fileset dir="${ECOLL_LIB}">
                <include name="**/*.jar" />
            </fileset>
            <fileset dir="${COMMON_LIB}">
                <include name="**/*.jar" />
            </fileset>
        </classpath>
    </javac>
</target>

I hope that my question is clear.

Those are classpath declarations, they're not telling ant to compile those JARs, they're telling it were JARs needed for the build are.

In your case, you make jars part of you classpath. You don't need to recompile.

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