Apache Ant 安装错误的解决方法 [英] Workaround for Apache Ant Install Bug

查看:69
本文介绍了Apache Ant 安装错误的解决方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以帮忙提供有关 Windows 中 Apache Ant 安装错误的解决方法的说明吗?

Can someone please help with instructions for a workaround on the Apache Ant installation bug in Windows?

下面的代码段描述了三种解决方法之一.如果您能够成功地使其中一个工作,您可以分享吗?

The snippet below describes one of three workarounds. If you are able to successfully get one of these to work, can you please share?

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7077696

(1) 使用 -Djava.net.preferIPv4Stack=true 运行- 为 Java 二进制文件添加防火墙例外.

(1) Run with -Djava.net.preferIPv4Stack=true - add a firewall exception for the Java binary.

(2) 使用 -Djava.net.preferIPv4Stack=true 运行(禁用 IPv6 并使用AF_INET 套接字专用)

(2) Run with -Djava.net.preferIPv4Stack=true (which disables IPv6 and uses AF_INET sockets exclusively)

(3) 或禁用防火墙中的状态 FTP 检查(注册表设置或 netsh 命令)

(3) Or disable stateful FTP inspection in the firewall (registry setting or netsh command)

============

============

设置:

安装 Apache Ant:

导航到此路径以获取安装说明:手册 > 安装 Apache Ant > 获取 Ant > ..按照说明

navigate to this path for installation instructions: Manual > Installing Apache Ant > Getting Ant > ..follow instructions

将解压后的文件夹(包含 bin 文件夹)移动到 C:\source_code\apache-ant-1.8.3\ 或 %ANT_HOME% 环境变量中使用的目录

move the extracted folder (containing the bin folder) inside of C:\source_code\apache-ant-1.8.3\ or directory used in %ANT_HOME% environment variable

Windows 7 > 控制面板 > 系统 > 单击环境变量"按钮 >

Windows 7 > Control Panel > System > click "Environment Variables" button >

(去掉环境变量后面的\"字符)

  • 在系统变量"部分下,单击添加"> 变量名称:JAVA_HOME 变量值:C:\Program Files\Java\jdk1.7.0_02

  • under the "System Variables" section, click "Add" > Variable Name: JAVA_HOME Variable Value: C:\Program Files\Java\jdk1.7.0_02

在系统变量"部分下,单击添加"> 变量名称:ANT_HOME 变量值:C:\source_code\apache-ant-1.8.3

under the "System Variables" section, click "Add" > Variable Name: ANT_HOME Variable Value: C:\source_code\apache-ant-1.8.3

在系统变量"部分下,点击路径"环境变量,点击编辑">变量名:路径变量值:{编辑前的值};%JAVA_HOME%\bin;%ANT_HOME%\bin;

under the "System Variables" section, click "Path" environment variable, click "Edit" > Variable Name: Path Variable Value: {value before editing};%JAVA_HOME%\bin;%ANT_HOME%\bin;

重新启动命令提示符(以管理员身份运行)

restart command prompt (Run As Administrator)

确保 Windows 看到 Apache Ant:

make sure Windows sees Apache Ant:

C:\source_code\apache-ant-1.8.3>ant -version2012 年 2 月 26 日编译的 Apache Ant(TM) 1.8.3 版

C:\source_code\apache-ant-1.8.3>ant -version Apache Ant(TM) version 1.8.3 compiled on February 26 2012

导航到 http://ant.apache.org/ > 手册 > 安装 ApacheAnt > 安装 Ant >

navigate to http://ant.apache.org/ > Manual > Installing Apache Ant > Install Ant >

========================

========================

FTP 错误:

C:\source_code\apache-ant-1.8.3>ant -f fetch.xml -Ddest=system
Buildfile: C:\source_code\apache-ant-1.8.3\fetch.xml

pick-dest:
     [echo] Downloading to C:\source_code\apache-ant-1.8.3\lib

...

-fetch-netrexx:
      [ftp] getting files

BUILD FAILED
C:\source_code\apache-ant-1.8.3\fetch.xml:325: The following error occurred whil
e executing this line:
C:\source_code\apache-ant-1.8.3\fetch.xml:144: java.net.SocketException: Permiss
ion denied: recv failed
        at java.net.SocketInputStream.socketRead0(Native Method)
        at java.net.SocketInputStream.read(SocketInputStream.java:150)
        at java.net.SocketInputStream.read(SocketInputStream.java:121)
        at java.io.BufferedInputStream.read1(BufferedInputStream.java:273)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:334)
        at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:254)
        at org.apache.commons.net.telnet.TelnetInputStream.__read(TelnetInputStr
eam.java:114)
        at org.apache.commons.net.telnet.TelnetInputStream.run(TelnetInputStream
.java:535)
        at java.lang.Thread.run(Thread.java:722)

Total time: 3 seconds

C:\source_code\apache-ant-1.8.3>

==============

==============

我已尝试制定入站和出站 Windows 防火墙规则以允许该程序通过.

I've tried making an inbound and outbound Windows Firewall rule to allow this program through.

%ProgramFiles%\Java\jdk1.7.0_02\bin\java.exe

我还尝试使用他们在解决方法中提到的参数运行命令.

I've also tried running the command with the parameter they mention in the workaround.

C:\source_code\apache-ant-1.8.3>ant -f fetch.xml -Ddest=system -Djava.net.preferIPv4Stack=true

推荐答案

从 Windows 命令提示符(以管理员身份运行)运行此程序作为禁用有状态 FTP 过滤的解决方法,以便 Windows 防火墙不会阻止 FTP 流量.

Ran this from the Windows command prompt (Run As Administrator) as a workaround to disable stateful FTP filtering so that Windows Firewall will not block FTP traffic.

netsh advfirewall set global StatefulFtp disable

这篇关于Apache Ant 安装错误的解决方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆