2010-12-24 2 views
0
Buildfile: /.../build.xml 
build: 
buildtests: 
tests: 

BUILD FAILED 
/.../build.xml:43: Problem: failed to create task or type junit 
Cause: Could not load a dependent class org/apache/tools/ant/Task 
    It is not enough to have Ant's optional JARs 
    you need the JAR files that the optional tasks depend upon. 
    Ant's optional task dependencies are listed in the manual. 
Action: Determine what extra JAR files are needed, and place them in one of: 
    -/Applications/eclipse/plugins/org.apache.ant_1.7.1.v20090120-1145/lib 
    -/Users/cjwalsh/.ant/lib 
    -a directory added on the command line with the -lib argument 

Do not panic, this is a common problem. 
The commonest cause is a missing JAR. 

This is not a bug; it is a configuration problem 


Total time: 512 milliseconds 

... 그리고 권장되는 모든 디렉토리를 검사했지만 아직 빌드 실패가 계속 발생합니다. 살펴본 특정 JAR 'ant.jar'에는 'Task'클래스가 있으며 '/Applications/eclipse/plugins/org.apache.ant_1.7.1.v20090120-1145/lib'파일에 있습니다. 예배 규칙서. 이 클래스 경로를 build.xml에도 수동으로 추가해야합니까? 다음은 내 build.xml입니다.로드되지 않는 종속 작업 클래스로 인해 앤트 빌드가 실패했습니다.

<?xml version="1.0" encoding="UTF-8"?> 
<project name="springapp" basedir="." default="build"> 
<property file="build.properties"></property> 

<property name="src.dir" value="src"></property> 
<property name="web.dir" value="war"></property> 
<property name="build.dir" value="${web.dir}/WEB-INF/classes"></property> 
<property name="name" value="springapp"></property> 
<property name="test.dir" value="test"></property> 

<path id="master-classpath"> 
    <fileset dir="${web.dir}/WEB-INF/lib"> 
     <include name="*.jar" /> 
    </fileset> 
    <fileset dir="${appserver.lib}"> 
     <include name="servlet*.jar"></include> 
    </fileset> 
    <pathelement path="${build.dir}"></pathelement> 
</path> 

<target name="build" description="Compile main source tree java files"> 
    <mkdir dir="${build.dir}" /> 
    <javac destdir="${build.dir}" source="1.5" target="1.5" debug="true" deprecation="false" optimize="false" 
     failonerror="true"> 

     <src path="${src.dir}" /> 
     <classpath refid="master-classpath" /> 
    </javac> 
</target> 

<target name="buildtests" description="Compile test tree java files"> 
    <mkdir dir="${build.dir}" /> 
    <javac destdir="${build.dir}" source="1.5" target="1.5" debug="true" 
     deprecation="false" optimize="false" failonerror="true"> 

     <src path="${test.dir}"></src> 
     <classpath refid="master-classpath"></classpath> 
    </javac> 
</target> 

<target name="tests" depends="build, buildtests" description="Run tests"> 
    <junit printsummary="on" fork="false" haltonfailure="false" failureproperty="tests.failed" 
     showoutput="true"> 

     <classpath refid="master-classpath"></classpath> 

     <formatter type="brief" usefile="false" /> 

     <batchtest> 
      <fileset dir="${build.dir}"> 
       <include name="**/*Tests.*" /> 
      </fileset> 
     </batchtest> 
    </junit> 

    <fail if="tests.failed"> 
     tests.failed=${tests.failed} 
     *********************************************************************** 
     *********************************************************************** 
     **** One or more tests failed! Check the output ... *************** 
     *********************************************************************** 
     *********************************************************************** 
    </fail> 
</target> 

<target name="deploy" depends="build" description="Deploy the application"> 
    <copy todir="${deploy.path}/${name}" preservelastmodified="true"> 
     <fileset dir="${web.dir}"> 
      <include name="**/*.*" /> 
     </fileset> 
    </copy> 
</target> 

<target name="deploywar" depends="build" description="Deploy application as WAR file"> 
    <war destfile="${name}.war" webxml="${web.dir}/WEB-INF/web.xml"> 
     <fileset dir="${web.dir}"> 
      <include name="**/*.*"></include> 
     </fileset> 
    </war> 
    <copy todir="${deploy.path}" preservelastmodified="true"> 
     <fileset dir="."> 
      <include name="*.war"></include> 
     </fileset> 
    </copy> 
</target> 

<path id="catalina-ant-classpath"> 
    <fileset dir="${appserver.lib}"> 
     <include name="catalina-ant.jar"></include> 
    </fileset> 
</path> 

<taskdef name="install" classname="org.apache.catalina.ant.InstallTask"> 
    <classpath refid="catalina-ant-classpath"></classpath> 
</taskdef> 

<taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask"> 
    <classpath refid="catalina-ant-classpath"></classpath> 
</taskdef> 

<taskdef name="list" classname="org.apache.catalina.ant.ListTask"> 
    <classpath refid="catalina-ant-classpath" /> 
</taskdef> 

<taskdef name="start" classname="org.apache.catalina.ant.StartTask"> 
    <classpath refid="catalina-ant-classpath"></classpath> 
</taskdef> 

<taskdef name="stop" classname="org.apache.catalina.ant.StopTask"> 
    <classpath refid="catalina-ant-classpath"></classpath> 
</taskdef> 

<target name="install" description="Install application in Tomcat"> 
    <install url="${tomcat.manager.url}" username="${tomcat.manager.username}" 
     password="${tomcat.manager.password}" 
     path="/${name}" 
     war="${name}" /> 
</target> 

<target name="reload" description="Reload applicatio in Tomcat"> 
    <reload url="${tomcat.manager.url}" username="${tomcat.manager.username}" 
     password="${tomcat.manager.password}" 
     path="/${name}" /> 
</target> 

<target name="start" description="Start tomcat application"> 
    <start url="${tomcat.manager.url}" username="${tomcat.manager.username}" 
     password="${tomcat.manager.password}" 
     path="/${name}" /> 
</target> 

<target name="stop" description="Stop Tomcat application"> 
    <stop url="${tomcat.manager.url}" 
      username="${tomcat.manager.username}" 
      password="${tomcat.manager.password}" 
      path="/${name}" /> 
</target> 

<target name="list" description="List Tomcat applications"> 
    <list url="${tomcat.manager.url}" 
      username="${tomcat.manager.username}" 
      password="${tomcat.manager.password}" /> 
</target> 
</project> 

답변

1

Eclipse 내에서 개미를 시작 했습니까?

{Run | External Tools Configuration ...}을 클릭하면 Classpath 탭에 "Ant Home"이 포함됩니다. 확장 후 유효한 파일을 가리 킵니까?

+0

예, Eclipse에서 Ant를 실행하고 있습니다. External Tools Configuration> Classpath 탭 아래에 User Entries, Ant Home (Default) 및 Additional Tasks & Support가 나열됩니다. 앤트 홈 아래에있는 JAR 목록에는 '/Applications/eclipse/plugins/org.apache.ant_1.7.1.v20090120-1145/lib'에있는 필요한 모든 앤트 JAR 파일이 들어 있습니다. – cj5

+0

다음은 앤트 홈 아래에있는 jar 파일 목록입니다. ant-apache-bsl.jar, ant-apache-log4j.jar, ant-apache-oro.jar, ant-apache-regexp.jar, ant-ja.jar, ant-javamail.jar, ant-jdepend.jar, ant-jmf.jar, ant- jsch.jar, ant-junit.jar, ant-launcher.jar, ant-netrexx.jar, ant-nodeps.jar, ant-starteam.jar, ant-stylebook.jar, ant-swing.jar, ant-trax. jar, ant-weblogin.jar – cj5

+0

고마워요! 이것은 내가 바람둥이 개미 작업과 관련하여 겪고있는 문제를 해결했다. JAR 목록에 catalina-ant.jar를 추가해야했습니다. – kibibu

관련 문제