gpt4 book ai didi

ant - Ivy 代理设置

转载 作者:行者123 更新时间:2023-12-03 13:54:31 30 4
gpt4 key购买 nike

我有一个问题,我在 ivy.xml 中定义了我们内部公司 svn 的依赖关系。我可以在没有任何代理任务的情况下访问这个 svn 站点。虽然我的依赖项驻留在 ibiblio 上,但那是我们公司之外的东西,需要代理才能下载一些东西。我在这里使用 Ivy 时遇到问题。

我在 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 文件),当我的解析器转到公共(public) url 时我只需要它。

最佳答案

使用 setproxy 时, 使用 nonproxyhosts属性指定不应使用代理的主机(管道分隔)。例如,修改 setproxy您的示例中的任务

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

更多详情见 http://ant.apache.org/manual/Tasks/setproxy.html

关于ant - Ivy 代理设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2921364/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com