0

我正在使用 Google 的 Guava 库,特别是类集。我曾尝试使用 Ant 构建我的程序,但它失败了。来自 javac 的错误是

找不到符号 [javac] 符号:变量集。

Guava 在类路径中。在这里我附上我的 build.xml

<project name="projekt" basedir="." default="">

    <property name="product.name"    value="Petrinet editor"/>
    <property name="product.version" value="1.0"/>
    <property name="build"           value="build"/>
    <property name="java.encoding"   value="utf8" />

    <path id="build.classpath"> 
        <pathelement location="bin"/>
        <pathelement location="lib/guava-11.0.2.jar"/>
        <pathelement location="lib/jgraphx.jar"/>
    </path>

<!-- ===================== Project Environment =========================== -->

    <property name="source.home"    value="${basedir}/src"/>
    <property name="example.home"   value="${basedir}/examples"/>

<!-- ==================== Target: clean ==================== -->

    <target name="clean">
        <delete dir="build"/>
        <delete dir="dest-client"/>
        <delete dir="dest-server"/>
        <delete dir="doc"/>
    </target> 

<!-- ==================== Target: compile ==================== -->

    <target name="compile">
        <mkdir dir="build"/>
        <mkdir dir="build/client"/>
        <mkdir dir="dest-client"/>

        <javac srcdir="src" encoding="${java.encoding}" destdir="build/client" includeantruntime="false">
            <exclude name="**/server/*"/>
            <classpath refid="build.classpath" />
        </javac>
        <copy todir="dest-client/lib">
            <fileset dir="lib"/>
        </copy>

        <jar basedir="build/client" destfile="dest-client/ija2012-client.jar">
            <manifest>
                <attribute name="Main-Class" value="main.Client"/>
            </manifest>
        </jar>

        <mkdir dir="build/server"/>
        <mkdir dir="dest-server"/>

        <javac srcdir="src" destdir="build/server" includeantruntime="false">
            <exclude name="**/main/*"/>
            <exclude name="**/filter/*"/>
        </javac>
        <copy todir="dest-server/lib"><fileset dir="lib"/></copy>

        <jar basedir="build/server" destfile="dest-server/ija2012-server.jar">
            <manifest>
                <attribute name="Main-Class" value="server.Server"/>
            </manifest>
        </jar>

        <mkdir dir="doc"/>
        <javadoc sourcepath="src" destdir="doc" author="true" version="true" use="true" windowtitle="Sitovy editor Petriho siti">
        <doctitle><![CDATA[<h1>Síťový editor Petriho sítí</h1>]]></doctitle>
            <bottom><![CDATA[Síťový editor Petriho sítí (c) 2012 xbabic06, xbabic07]]></bottom>
        </javadoc>
    </target>
</project>
4

1 回答 1

1

构建客户端或服务端时是否会出现编译失败?您在客户端而不是服务器的类路径中包含番石榴。

于 2012-05-03T08:51:44.443 回答