18

内部企業 svn の ivy.xml で依存関係を定義したという問題があります。ant でプロキシ タスクを使用せずに、この svn サイトにアクセスできます。私の依存関係は ibiblio にありますが、それは私たちの会社の外にあるものであり、何かをダウンロードするにはプロキシが必要です。ここでツタを使用して問題に直面しています。

私はbuild.xmlで以下を持っています

<target name="proxy">  
    <property name="proxy.host" value="xyz.proxy.net"/>  
    <property name="proxy.port" value="8443"/>  
    <setproxy proxyhost="${proxy.host}" proxyport="${proxy.port}"/>  
</target>  

<!-- resolve the dependencies of stratus -->
<target name="resolveTestDependency" depends="testResolve, proxy" description="retrieve test dependencies with ivy">
    <ivy:settings file="stratus-ivysettings.xml" />
    <ivy:retrieve conf="test" pattern="${jars}/[artifact]-[revision].[ext]"/><!--pattern here specifies where do you want to download lib to?-->                                          
</target>

<target name=" testResolve ">
    <ivy:settings file="stratus-ivysettings.xml" />
    <ivy:resolve conf="test" file="stratus-ivy.xml"/>
</target>

以下は、stratus-ivysettings.xml からの抜粋です。

<resolvers>  
    <!-- here you define your file in private machine not on the repo (e.g. jPricer.jar or edgApi.jar)-->  
    <!-- This we will use a url nd not local file system.. -->  
    <url name="privateFS">  
        <ivy pattern="http://xyz.svn.com/ivyRepository/ [organisation]/ivy/ivy.xml"/>                                                    
    </url>  
.  
.  
.  
    <url name="public" m2compatible="true">     
        <artifact pattern="http://www.ibiblio.org/maven2/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]"/>  
    </url>
.  
.  
.  

ここでivy.xmlを取得するために見られるように、プロキシを設定するとアクセスできない独自のネットワーク内にあるため、プロキシは必要ありません。しかし一方で、ネットワークの外部にあり、プロキシでのみ動作する ibiblio も使用しています。したがって、上記の build.xml はその場合は機能しません。誰かがここで助けてくれますか。

ivy.xml を取得するときにプロキシは必要ありません (プロキシがあるかのように、ネットワーク内からプロキシの背後にある ivy ファイルを ivy が見つけることができません)。

4

1 に答える 1

14

を使用setproxyする場合は、nonproxyhosts属性を使用して、プロキシを使用しないホストを指定します (パイプ区切り)。setproxyたとえば、例のタスクを次のように変更します

<setproxy proxyhost="${proxy.host}"
          proxyport="${proxy.port}"
          nonproxyhosts="xyz.svn.com"/>

詳細については、http://ant.apache.org/manual/Tasks/setproxy.htmlを参照してください。

于 2011-03-14T01:26:44.023 に答える