Ant安装找不到maven-artifact-ant-2.0.4-dep.jar

时间:2011-12-10 21:34:39

标签: maven ant

我正在尝试使用these指令在Windows 7上安装Ant,但在第5阶段,当我运行命令ant -f fetch.xml -Ddest=system时,我收到以下错误:

  

Buildfile: C:\Program Files\WinAnt\fetch.xml
pick-dest:
[echo] Downloading to C:\Program Files\WinAnt\lib
probe-m2:
download-m2:
[echo] Downloading to C:\Program Files\WinAnt\lib
[get] Getting: http://ibiblio.org/maven2//org/apache/maven/maven-artifact-ant/2.0. /maven-artifact-ant-2.0.4-dep.jar
[get] To: C:\Program Files\WinAnt\lib\maven-artifact-ant-2.0.4-dep.jar
[get] Error opening connection java.io.FileNotFoundException: http://ibiblio.org/maven2//org/apache/maven/maven-artifact-ant/2.0.4/maven-artifact-ant-2.0.4-dep.jar
[get] Error opening connection java.io.FileNotFoundException: http://ibiblio.org/maven2//org/apache/maven/maven-artifact-ant/2.0.4/maven-artifact-ant-2.0.4-dep.jar
[get] Error opening connection java.io.FileNotFoundException: http://ibiblio.org/maven2//org/apache/maven/maven-artifact-ant/2.0.4/maven-artifact-ant-2.0.4-dep.jar
[get] Can't get http://ibiblio.org/maven2//org/apache/maven/maven-artifact-ant/2.0.4/maven-artifact-ant-2.0.4-dep.jar to C:\Program Files\WinAnt\lib\maven-artifact-ant-2.0.4-dep.jar
BUILD FAILED
C:\Program Files\WinAnt\get-m2.xml:85: Can't get http://ibiblio.org/maven2//org/apach/maven/maven-artifact-ant/2.0.4/maven-artifact-ant-2.0.4-dep.jar to C:\Program Files\WinAnt\lib\maven-artifact-ant-2.0.4-dep.jar
Total time: 1 second

我知道URL无法访问,因此我尝试将此URL输入浏览器,实际上它不存在。我找到了文件maven-artifact-ant-2.0.4-dep.jar

http://mirrors.ibiblio.org/pub/mirrors/maven2/org/apache/maven/maven-artifact-ant/2.0.4/maven-artifact-ant-2.0.4-dep.jar

代替。那么我该如何解决这个问题?

3 个答案:

答案 0 :(得分:10)

只需将lib / library.properties文件中的m2.url属性更新为http://mirrors.ibiblio.org/pub/mirrors/maven2

答案 1 :(得分:8)

按如下方式运行ANT

$ ant -f $ANT_HOME/fetch.xml -Ddest=user -Dm2.url=http://repo1.maven.org/maven2 

m2.url属性需要重载。 ANT中的以下属性文件需要更新:

$ANT_HOME/lib/libraries.properties

使用现已弃用的Maven Central URL

答案 2 :(得分:2)

网址是正确的,但您尝试将文件下载到Program Files(C:\ Program Files \ WinAnt \ lib)的子文件夹中。为此,您需要使用管理员权限运行命令。

右键单击命令提示符快捷方式并选择“run as administrator”或在开始菜单的搜索字段中输入“cmd”,然后按CTRL + SHIFT + ENTER。

然后尝试再次运行ant命令:

ant -f fetch.xml -Ddest=system

如果您在使用该脚本下载任何其他文件时遇到问题,那么只需使用您的浏览器下载它们,将它们放在正确的位置,然后将fetch.xml编辑为而不是< / strong>下载文件。