当我在 linux ubuntu 中运行 build.xml 时,应该从 svn 签出项目会给出以下错误:-
svn:
BUILD FAILED
java.net.MalformedURLException: Invalid svn url: svn://xxx-xx-xx-xx-xx.compute-1.amazonaws.com/srv/svn
at org.tigris.subversion.svnclientadapter.SVNUrl.parseUrl(SVNUrl.java:117)
at org.tigris.subversion.svnclientadapter.SVNUrl.<init>(SVNUrl.java:63)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.apache.tools.ant.IntrospectionHelper$11.set(IntrospectionHelper.java:1069)
at org.apache.tools.ant.IntrospectionHelper.setAttribute(IntrospectionHelper.java:388)
at org.apache.tools.ant.RuntimeConfigurable.maybeConfigure(RuntimeConfigurable.java:392)
at org.apache.tools.ant.RuntimeConfigurable.maybeConfigure(RuntimeConfigurable.java:349)
at org.apache.tools.ant.UnknownElement.handleChild(UnknownElement.java:568)
at org.apache.tools.ant.UnknownElement.handleChildren(UnknownElement.java:346)
at org.apache.tools.ant.UnknownElement.configure(UnknownElement.java:198)
at org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.java:160)
实际上 svn 的路径是我从本地盒子连接的。所以我不知道我应该在这里给出什么路径。svn 在同一个 linux 盒子里。
我build.xml所在的目录路径是:-/home/ubuntu/antCheckout 而svn所在的路径是:-/srv/svn
我也试过这条路:- ssh://srv/svn 但异常是一样的。
这是我的 build.xml:-
<?xml version="1.0"?>
<project name="Test" default="Main" basedir=".">
<!-- Sets variables which can be used. -->
<property name="checkout" location="./svncheckout" />
<!-- Define the classpath which includes the jars
that are required for svnant.jar -->
<path id="/usr/local/ant/apache-ant-1.7.1/">
<pathelement location="lib/svnant.jar" />
<pathelement location="lib/svnClientAdapter.jar" />
<pathelement location="lib/svnjavahl.jar" />
<pathelement location="lib/svnkit.jar" />
</path>
<typedef resource="org/tigris/subversion/svnant/svnantlib.xml"
classpathref="/usr/local/ant/apache-ant-1.7.1/" />
<!-- Deletes the existing build, docs and dist directory-->
<target name="clean">
<delete dir="${checkout}" />
</target>
<!-- Creates the build, docs and dist directory-->
<target name="makedir">
<mkdir dir="${checkout}" />
</target>
<!-- Checkout the latest source code of svnant itself-->
<target name="svn">
<svn username="guest" password="">
<checkout url="svn://srv/svn" revision="HEAD" destPath="${checkout}" />
</svn>
</target>
<target name="Main" depends="clean, makedir, svn">
<description>Main target</description>
</target>
</project>
感谢帮助。