簡體   English   中英

Ant javac:包不存在

[英]Ant javac: package does not exist

試圖在這里編譯一個Web項目,但我繼續獲取包不存在幾十個類的例外。 一切似乎都在類路徑中,但它找不到它。 有關調試此問題的任何提示嗎?

例外:

 [javac] Compiling 73 source files to C:\workspace\SalesWeb\WebContent\WEB-INF\classes
 [javac] C:\workspace\SalesWeb\src\java\com\abc\xyz\supplier\interceptor\InfoInterceptor.java:8: package org.springframework.web.servlet does not exist
 [javac] import org.springframework.web.servlet.HandlerInterceptor;

build.xml文件:

<?xml version="1.0" encoding="UTF-8"?>

<project basedir="." default="build" name="SalesWeb">
<property environment="env"/>
<property name="SalesWebTest.location" value="../SalesWebTest"/>
<property name="debuglevel" value="source,lines,vars"/>
<property name="target" value="1.6"/>
<property name="source" value="1.6"/>
<path id="Web App Libraries.libraryclasspath">
    <pathelement location="WebContent/WEB-INF/lib/backport-util-concurrent-2.1.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/commons-fileupload-1.2.1.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/cxf-2.2.5.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/displaytag-1.1.1.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/dwr.3.rc1.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/abc-frameworkx-web.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/abc-svc-framework-web-2008.1.1.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/ehcache-1.4.1.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/ezmorph-1.0.6.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/fdsapi-1.1.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/freemarker-2.3.8.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/jakarta-oro.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/jaxb-impl-2.1.13.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/joda-time-1.6.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/json-lib-2.4-jdk15.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/org.springframework.config.java-1.0.0.M4.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/org.springframework.js-2.0.6.RELEASE.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/org.springframework.webflow-2.0.6.RELEASE.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/oscache-2.3.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/poi-3.5-FINAL-20090928.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/sitemesh-2.4.2.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/spring-security-taglibs-2.0.4.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/spring-web.2.5.6.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/spring-webmvc.2.5.6.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/standard-1.1.2.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/urlrewritefilter-3.0.4.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/velocity-1.4.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/velocity-tools-view-1.0.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/wsdl4j-1.6.2.jar"/>
    <pathelement location="WebContent/WEB-INF/lib/xwork-2.0.4.jar"/>
</path>
<path id="EAR Libraries.libraryclasspath">
    <pathelement location="../../../SalesWeb_C"/>
    <pathelement location="../../../SalesWeb_D"/>
    <pathelement location="../../../SalesWeb_J"/>
    <pathelement location="../../../SalesWeb_S"/>
    <pathelement location="../SalesWeb_ear/lib/apache/commons-beanutils-1.8.0.jar"/>
    <pathelement location="../SalesWeb_ear/lib/apache/commons-collections-3.2.1.jar"/>
    <pathelement location="../SalesWeb_ear/lib/apache/commons-dbcp-1.2.2.jar"/>
    <pathelement location="../SalesWeb_ear/lib/apache/commons-digester-1.7.jar"/>
    <pathelement location="../SalesWeb_ear/lib/apache/commons-lang-2.5.jar"/>
    <pathelement location="../SalesWeb_ear/lib/apache/commons-logging-1.1.1.jar"/>
    <pathelement location="../SalesWeb_ear/lib/apache/commons-pool-1.3.jar"/>
    <pathelement location="../SalesWeb_ear/lib/aspectj/cglib-nodep-2.2.jar"/>
    <pathelement location="../SalesWeb_ear/lib/db/db2jcc.jar"/>
    <pathelement location="../SalesWeb_ear/lib/db/db2jcc_license_cisuz.jar"/>
    <pathelement location="../SalesWeb_ear/lib/hcsc/JAMon.jar"/>
    <pathelement location="../SalesWeb_ear/lib/hcsc/cryptix32.jar"/>
    <pathelement location="../SalesWeb_ear/lib/hcsc/dsclass.jar"/>
    <pathelement location="../SalesWeb_ear/lib/hcsc/eas-svc-framework-2008.1.3.jar"/>
    <pathelement location="../SalesWeb_ear/lib/hcsc/eas-svc-mid-2008.1.2.jar"/>
    <pathelement location="../SalesWeb_ear/lib/hcsc/eas-svc-security-impl-2008.1.1.jar"/>
    <pathelement location="../SalesWeb_ear/lib/hcsc/eas-svc-security-impl-multitree-2008.1.1.jar"/>
    <pathelement location="../SalesWeb_ear/lib/hcsc/fdsapi-1.1.jar"/>
    <pathelement location="../SalesWeb_ear/lib/hcsc/jce1_2-do.jar"/>
    <pathelement location="../SalesWeb_ear/lib/hcsc/jcert.jar"/>
    <pathelement location="../SalesWeb_ear/lib/hcsc/jnet.jar"/>
    <pathelement location="../SalesWeb_ear/lib/hcsc/jsse.jar"/>
    <pathelement location="../SalesWeb_ear/lib/hcsc/providerutil.jar"/>
    <pathelement location="../SalesWeb_ear/lib/hcsc/signon.jar"/>
    <pathelement location="../SalesWeb_ear/lib/hcsc/xsdbeans-5.0.2.jar"/>
    <pathelement location="../SalesWeb_ear/lib/ldap40.jar"/>
    <pathelement location="../SalesWeb_ear/lib/logging/log4j-1.2.15.jar"/>
    <pathelement location="../SalesWeb_ear/lib/neethi-2.0.4.jar"/>
    <pathelement location="../SalesWeb_ear/lib/saaj-api-1.3.jar"/>
    <pathelement location="../SalesWeb_ear/lib/saaj-impl-1.3.jar"/>
    <pathelement location="../SalesWeb_ear/lib/spring/spring.2.5.6.jar"/>
    <pathelement location="../SalesWeb_ear/lib/stax-utils-20060502.jar"/>
    <pathelement location="../SalesWeb_ear/lib/webservice/jaxws-api.jar"/>
    <pathelement location="../SalesWeb_ear/lib/webservice/wsdl4j-1.6.2.jar"/>
    <pathelement location="../SalesWeb_ear/lib/wstx-asl-3.2.4.jar"/>
    <pathelement location="../SalesWeb_ear/lib/xml/XmlSchema-1.4.5.jar"/>
    <pathelement location="../SalesWeb_ear/lib/xml/dom4j-1.6.1.jar"/>
    <pathelement location="../SalesWeb_ear/lib/xml/xml-resolver-1.2.jar"/>
    <pathelement location="../SalesWeb_ear/lib/spring/spring-security-core-2.0.4.jar"/>
    <pathelement location="../SalesWeb_ear/lib/spring/spring-security-core-tiger-2.0.4.jar"/>
    <pathelement location="../SalesWeb_ear/lib/spring/spring-security-taglibs-2.0.4.jar"/>
    <pathelement location="../SalesWeb_ear/lib/apache/commons-io-1.2.jar"/>
    <pathelement location="../SalesWeb_ear/lib/javassist-3.9.0.GA.jar"/>
    <pathelement location="../SalesWeb_ear/lib/xmlbeans/jsr173_1.0_api.jar"/>
    <pathelement location="../SalesWeb_ear/lib/xmlbeans/resolver.jar"/>
    <pathelement location="../SalesWeb_ear/lib/xmlbeans/xbean.jar"/>
    <pathelement location="../SalesWeb_ear/lib/xmlbeans/xbean_xpath.jar"/>
    <pathelement location="../SalesWeb_ear/lib/xmlbeans/xmlbeans-qname.jar"/>
    <pathelement location="../SalesWeb_ear/lib/xmlbeans/xmlpublic.jar"/>
    <pathelement location="../SalesWeb_ear/lib/commons-net-2.0.jar"/>
    <pathelement location="../../../SalesWeb_I"/>
    <pathelement location="../../../SalesWeb_RC"/>
    <pathelement location="../../../SalesWeb_R"/>
</path>

<path id="SalesWeb.classpath">
    <pathelement location="WebContent/WEB-INF/classes"/>
    <path refid="Web App Libraries.libraryclasspath"/>
    <path refid="EAR Libraries.libraryclasspath"/>

</path>


<target name="init">
    <mkdir dir="WebContent/WEB-INF/classes"/>
    <copy includeemptydirs="false" todir="WebContent/WEB-INF/classes">
        <fileset dir="src/java" excludes="**/*.launch, **/*.java"/>
    </copy>
    <copy includeemptydirs="false" todir="WebContent/WEB-INF/classes">
        <fileset dir="src/config" excludes="**/*.launch, **/*.java"/>
    </copy>
    <copy includeemptydirs="false" todir="WebContent/WEB-INF/classes">
        <fileset dir="src/resources" excludes="**/*.launch, **/*.java"/>
    </copy>
    <copy includeemptydirs="false" todir="WebContent/WEB-INF/classes">
        <fileset dir=".apt_generated" excludes="**/*.launch, **/*.java"/>
    </copy> 
</target>
<target name="clean">
    <delete dir="WebContent/WEB-INF/classes"/>
</target>
<target depends="clean" name="cleanall"/>
<target depends="build-subprojects,build-project" name="build"/>
<target name="build-subprojects"/>
<target depends="init" name="build-project">
    <echo message="${ant.project.name}: ${ant.file}"/>
        <javac debug="true" debuglevel="${debuglevel}" destdir="WebContent/WEB-INF/classes" source="${source}" target="${target}" includeantruntime="false">
        <src path="src/java"/>
        <classpath refid="SalesWeb.classpath"/>
    </javac>
    <javac debug="true" debuglevel="${debuglevel}" destdir="WebContent/WEB-INF/classes" source="${source}" target="${target}" includeantruntime="false">
        <src path="src/config"/>
        <classpath refid="SalesWeb.classpath"/>
    </javac>
    <javac debug="true" debuglevel="${debuglevel}" destdir="WebContent/WEB-INF/classes" source="${source}" target="${target}" includeantruntime="false">
        <src path="src/resources"/>
        <classpath refid="SalesWeb.classpath"/>
    </javac>
    <javac debug="true" debuglevel="${debuglevel}" destdir="WebContent/WEB-INF/classes" source="${source}" target="${target}" includeantruntime="false">
        <src path=".apt_generated"/>
        <classpath refid="SalesWeb.classpath"/>
    </javac>
</target>

一切似乎都在類路徑中,但它找不到它。

關鍵詞是“似乎”。 例外情況告訴你他們不是。

我將創建一個包含所需內容的Ant CLASSPATH,然后重試。

http://ant.apache.org/manual/develop.html

Spring JAR文件是否在WEB-INF/lib文件夾中?

在這種情況下,一切都應該“正常工作”......

是否假設與您的服務器一起打包?

您可能必須在Eclipse項目/ ANT文件中添加Spring JAR的路徑。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM