离线/断开连接时解析Apache Ivy依赖关系



脱机/断开连接时,如何让Ivy从本地缓存解析依赖项(包括与changing="true"的依赖项)?

我正在做一个基于Java的开源项目,该项目使用ApacheIvy来解析和下载第三方依赖关系。该项目的build.xml有一个名为resolve的ant目标,它下载Ivy(如果需要),然后使用Ivy检索所需的jar。

在线时一切都很好。但是,如果没有Internet访问,即使所需的jar在本地Ivy缓存(~/.ivy2/cache)中,ant resolve也会失败。Ivy似乎正在尝试连接到Maven存储库以刷新changing="true"依赖关系。

我得到的错误类似于以下内容:

[ivy:retrieve] You probably access the destination server through a proxy server that is not well configured.
[ivy:retrieve] You probably access the destination server through a proxy server that is not well configured.
[ivy:retrieve] 
[ivy:retrieve] :: problems summary ::
[ivy:retrieve] :::: WARNINGS
[ivy:retrieve]  Host repo.example.com not found. url=http://repo.example.com/exampleorg/examplename/examplerev/ivys/ivy.xml
[ivy:retrieve]  Host repo.example.com not found. url=http://repo.example.com/exampleorg/examplename/examplerev/jars/examplename.jar
[ivy:retrieve]          module not found: exampleorg#examplename;examplerev
[ivy:retrieve]  ==== local: tried
[ivy:retrieve]    ~/.ivy2/local/exampleorg/examplename/examplerev/ivys/ivy.xml
[ivy:retrieve]    -- artifact exampleorg#examplename;examplerev!examplename.jar:
[ivy:retrieve]    ~/.ivy2/local/exampleorg/examplename/examplerev/jars/examplename.jar
[ivy:retrieve]  ==== shared: tried
[ivy:retrieve]    ~/.ivy2/shared/exampleorg/examplename/examplerev/ivys/ivy.xml
[ivy:retrieve]    -- artifact exampleorg#examplename;examplerev!examplename.jar:
[ivy:retrieve]    ~/.ivy2/shared/exampleorg/examplename/examplerev/jars/examplename.jar
[ivy:retrieve]  ==== repo: tried
[ivy:retrieve]    http://repo.example.com/exampleorg/examplename/examplerev/ivys/ivy.xml
[ivy:retrieve]    -- artifact exampleorg#examplename;examplerev!examplename.jar:
[ivy:retrieve]    http://repo.example.com/exampleorg/examplename/examplerev/jars/examplename.jar
[ivy:retrieve]          ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve]          ::          UNRESOLVED DEPENDENCIES         ::
[ivy:retrieve]          ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve]          :: exampleorg#examplename;examplerev: not found
[ivy:retrieve]          ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve] 
[ivy:retrieve] :: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS
BUILD FAILED
~/exampleproj/build.xml:123: impossible to resolve dependencies:
        resolve failed - see output for details

按照警告的建议运行ant -verbose resolve会在输出中打印以下行:

[ivy:retrieve] don't use cache for exampleorg#examplename;examplerev: changing=true

如何让Ivy在脱机时从缓存中解析changing="true"依赖项,但在联机时继续查询每个构建的存储库?

oers已经回答了这个问题,但这并不明显。

尝试从命令行运行构建设置ivy.cache.ttl.default属性:

ant -Divy.cache.ttl.default=eternal build

来源:

  • IVY-879
  • 常春藤邮件列表

相关内容

  • 没有找到相关文章

最新更新