簡體   English   中英

運行Ant腳本時代理問題

[英]Issue with proxy while running Ant script

我正在為我的項目目的開發一個Ant腳本,並發現我的代理對我造成了問題。 以下是“復制”任務的Apache文檔中最簡單的示例:

=================== build.xml =====================
<project default="simplestCopy">
    <property name="test.dir" value="${basedir}/test/" />

    <target name="simplestCopy">
        <mkdir dir="${test.dir}" />
        <copy todir="${test.dir}" flatten="true">
            <resources>
                <url url="http://ant.apache.org/index.html"/>
            </resources>
        </copy>
    </target>
</project>

我有下一個錯誤:

d:\temp>ant
Buildfile: d:\temp\build.xml

simplestCopy:
java.net.ConnectException: Connection refused: connect

BUILD FAILED
d:\temp\build.xml:7: Warning: Could not find resource url "http://ant.apache.org/index.html" to copy.

我試着設定一下

<property name="java.net.useSystemProxies" value="true" />

並在命令行中定義此屬性

d:\temp>ant -Djava.net.useSystemProxies=true -verbose

但得到同樣的錯誤:

d:\temp>ant -Djava.net.useSystemProxies=true -verbose
Apache Ant version 1.8.1 compiled on April 30 2010
Trying the default build file: build.xml
Buildfile: d:\temp\build.xml
Detected Java version: 1.6 in: c:\ProgramFiles\Java\jdk1.6.0_24\jre
Detected OS: Windows XP
parsing buildfile d:\temp\build.xml with URI = file:/d:/temp/build.xml
Project base dir set to: d:\temp
parsing buildfile jar:file:/C:/ProgramFiles/Java/apache-ant-1.8.1/lib/ant.jar!/org/apache/tools/ant/antlib.xml with URI = jar:file:/C:/ProgramFiles/Java/apache-ant-1.8.1/lib/ant.jar!/org/apache/tools/ant/antlib.xml from a zip file
Build sequence for target(s) `simplestCopy' is [simplestCopy]
Complete build sequence is [simplestCopy, ]

simplestCopy:
    [mkdir] Skipping d:\temp\test because it already exists.
java.net.ConnectException: Connection refused: connect

BUILD FAILED
d:\temp\build.xml:7: Warning: Could not find resource url "http://ant.apache.org/index.html" to copy.
        at org.apache.tools.ant.taskdefs.Copy.execute(Copy.java:487)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        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:1397)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1366)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1249)
        at org.apache.tools.ant.Main.runBuild(Main.java:801)
        at org.apache.tools.ant.Main.startAnt(Main.java:218)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)

Total time: 1 second

任何想法如何解決?
感謝幫助...

使用setproxy任務: http ://ant.apache.org/manual/Tasks/setproxy.html

我啟動了tomcat服務器,然后發出命令,它可以工作

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM