[英]SVN checkout under Linux using Ant
当我在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>
感谢帮助。
如果您使用的是Linux,那么您有Subversion命令行客户端吗?
尝试这个:
$ svn --version
如果您具有Subversion命令行客户端,请尝试以下命令:
$ svn ls svn://svn/srv
看看你得到什么。 我敢打赌,您会收到一条错误消息,告诉您svn://srv/svn
找不到或不是有效的URL。
这行:
<checkout url="svn://srv/svn" revision="HEAD" destPath="${checkout}" />
等效于命令行:
$ svn checkout -rHEAD svn://srv/svn .svncheckout
您必须先找到有效的Subversion存储库URL,此命令才能起作用。 然后,在<checkout>
子任务中更改url
参数以匹配该URL。 Subversion使用URL指向存储库地址。
顺便说一句,这到底应该做什么? 为什么要将工作目录.svncheckout
到.svncheckout
目录? 在Unix中,这是一个隐藏目录。
顺便说一句: svn co svn://127.0.0.1
无法工作,除非程序snvserve
在本地系统上运行。 svnserve
程序
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.