簡體   English   中英

Ant:即使在類路徑中,javac也無法找到類

[英]Ant: javac cannot find class even though it's in the classpath

我們的build.xml文件包含以下內容:

<path id="our.classpath">
    <fileset dir="${in.libs}"/>
    <fileset file="/home/ouruser/fortify/Core/lib/sourceanalyzer.jar"/>
</path>

<target name="compile">
    <pathconvert property="test" refid="our.classpath"/>
    <echo message="CLASSPATH=${test}"/>

    <javac debug="true"
           debuglevel="source,lines,vars"
           destdir="${out.classes}"
           includeAntRuntime="no"
           fork="false"
           source="1.7" target="1.7">
        <src path="${src1.dir}"/>
        <src path="${src2.dir}"/>
        <classpath refid="our.classpath"/>
        <compilerarg value="-Xlint:-path"/>
        <compilerarg line="-proc:none"/>
        <compilerarg line="-s &quot;${out.classes}&quot;"/>
    </javac>
</target>

<target name="fortify">
     <antcall target="compile">
         <param name="build.compiler" value="com.fortify.dev.ant.SCACompiler"/>
     </antcall>
</target>

運行ant fortify ,得到以下輸出:

fortify:

compile:
 [echo] CLASSPATH=<a long list of jar files snipped>:/home/ouruser/fortify/Core/lib/sourceanalyzer.jar

BUILD FAILED
/home/ouruser/build.xml:542: The following error occurred while executing this line:
/home/ouruser/build.xml:230: Class not found: com.fortify.dev.ant.SCACompiler

echo輸出中可以看到,sourceanalyzer.jar文件位於javac任務使用的類路徑中。

當我運行jar -tvf /home/ouruser/fortify/Core/lib/sourceanalyzer.jar | grep SCACompiler.class jar -tvf /home/ouruser/fortify/Core/lib/sourceanalyzer.jar | grep SCACompiler.class ,列出了SCACompiler類:

8408 Fri Apr 04 11:17:26 EDT 2014 com/fortify/dev/ant/SCACompiler.class

那么,為什么螞蟻說Class not found: com.fortify.dev.ant.SCACompiler

代替com/fortify/dev/ant/SCACompiler.class類,使用

com.fortify.dev.ant.SourceanalyzerTask

暫無
暫無

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

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