0

大家好,我正在尝试运行一个简单的 ant 构建。我正在使用 ubuntu 12.04。我不确定为什么我不断收到错误引用

在 org.tigris.subversion.svnclientadapter

有人可以看看我的帮助我建立这个蚂蚁。

我的 build.xml 有。

<?xml version="1.0" encoding="UTF-8"?>
<project name="AppBuilder" default="war" basedir="..">

    <property name="project.name" value="DIS" />

    <property name="checkout.dir" value="home/mark/Desktop/checkout" />
    <property name="build.dir" value="home/mark/Desktop/build" />
    <property name="server.dir" 
    value="Oracle/Middleware/user_projects/domains/test1/servers/AdminServer/upload"/>

    <property name="repo.url" value="svn://127.0.0.1:3690/eHRMS_Project" />
    <property name="repo.usr" value="mark" />
    <property name="repo.pwd" value="java" />

    <property name="ant.dir" value="apps/apache-ant-1.8.2"/>


<!-- SET THE SVNANT CLASSPATH -->
<path id ="svnant.classpath">
    <fileset dir="${ant.dir}/lib/svnant" includes="**/svn*.jar"/>
</path>
<typedef resource="org/tigris/subversion/svnant/svnantlib.xml"
    classpathref="svnant.classpath"/>


<!--REMOVE OLD BUILD -->
<target name="clean">
    <echo>Cleaning directories</echo>
    <delete dir="${build.dir}"/>
    <delete dir="${checkout.dir}"/>
</target>


<!-- CREATE NEW DIRECTORIES-->
 <target name="init" depends="clean">
    <echo>Creating the directories</echo>
    <mkdir dir="${build.dir}/WEB-INF/classes" />
    <mkdir dir="${build.dir}/WEB-INF/lib"/>
    <mkdir dir="${checkout.dir}"/>
</target>


<!--
CHECKOUT THE LATEST CODE FROM THE SVN REPOSITORY.
AN SVN CLIENT MUST BE INSTALLED ON YOUR MACHINE.
-->
<target name="checkoutLatest" depends="init">
  <echo>Checking out the project</echo> 
  <svn  svnkit="false"
    javahl="false"
    username="${repo.usr}" 
    password="${repo.pwd}"> 
      <checkout url="${repo.url}/${project.name}" destPath="${checkout.dir}"/> 
  </svn>
</target>


<!--COMPILE THE JAVA CLASSES-->
<target name="compile" depends="checkoutLatest">
    <echo>Compile the source files</echo>

<javac  srcdir="${checkout.dir}/src"
    destdir="${build.dir}/WEB-INF/classes"
    includeAntRuntime="no">

    <!--ALL THE POSSIBLE LOCATIONS OF FILES NEEDED FOR COMPILATION-->        
    <classpath>
        <fileset dir="${checkout.dir}/WebContent/WEB-INF/lib">
        <include name="*.jar" />
        </fileset>

        <fileset dir="home/mark/Oracle/Middleware/modules">
        <include name="*.jar" />
        </fileset>

        <fileset dir="home/mark/Oracle/Middleware/wlserver_10.3/server/lib">
        <include name="*.jar" />
        </fileset>
    </classpath>

</javac>

</target>


<!--TRANSFER WEBCONTENT AND CONFIG FILES FROM CHECKOUT FOLDER TO BUILD FOLDER-->
<target name="copy" depends="compile">
    <echo>Transferring WebContent and config files</echo>

    <!--COPY THE CONFIG/RESOURCE FILES-->
    <copy todir="${build.dir}/WEB-INF/classes">
            <fileset dir="${checkout.dir}/src" excludes="com/**"/>
    </copy>

    <!--COPY THE HBM FILES FOR EHRMS-->
    <copy todir="${build.dir}/WEB-INF/classes/com/multivision/ehrms/business">
            <fileset dir="${checkout.dir}/src/com/multivision/ehrms/business" excludes="*.java"/>
    </copy>

    <!--COPY THE HBM FILES FOR DIS-->
    <copy todir="${build.dir}/WEB-INF/classes/com/multivision/dis/businesses">
            <fileset dir="${checkout.dir}/src/com/multivision/dis/businesses" excludes="*.java"/>
    </copy>

    <!--COPY THE WEBCONTENT FILES AND SUBDIRECTORIES-->
    <copy todir="${build.dir}">
        <fileset dir="${checkout.dir}/WebContent"/>
    </copy>

</target>

<!-- CREATE THE WAR-->
<target name="war" depends="copy">
    <echo>Building WAR file</echo>
    <war destfile="${server.dir}/${project.name}.war" 
        webxml="${build.dir}/WEB-INF/web.xml">
        <fileset dir="${build.dir}"/>
    </war>
</target>

当我运行我的 ant 构建时,我的控制台会显示这个

 BUILD FAILED
    /home/mark/Desktop/build.xml:52: java.lang.NoSuchFieldError: notifylisteners
        at org.tigris.subversion.svnclientadapter.commandline.CmdLineNotificationHandler.logException(Unknown Source)
        at org.tigris.subversion.svnclientadapter.commandline.CommandLine.execString(Unknown Source)
        at org.tigris.subversion.svnclientadapter.commandline.SvnCommandLine.checkout(Unknown Source)
        at org.tigris.subversion.svnclientadapter.commandline.CmdLineClientAdapter.checkout(Unknown Source)
        at org.tigris.subversion.svnant.commands.Checkout.execute(Unknown Source)
        at org.tigris.subversion.svnant.commands.SvnCommand.executeCommand(Unknown Source)
        at org.tigris.subversion.svnant.SvnTask.execute(Unknown Source)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
        at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:390)
        at org.apache.tools.ant.Target.performTasks(Target.java:411)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
        at     org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
        at org.apache.tools.ant.Main.runBuild(Main.java:809)
        at org.apache.tools.ant.Main.startAnt(Main.java:217)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)

    Total time: 2 seconds 
4

1 回答 1

0

编译 svnant 时使用的 svnclientadapter 版本与 svn.classpath. 由于您没有说明您使用的是哪个版本的 svnant,因此无法告诉您正确的版本。

当您发现它是什么时,将相应的 JAR 更改为{ant.dir}/lib/svn

于 2012-09-23T15:49:22.637 回答