How can I get Ivy to resolve dependencies (including dependencies with changing="true"
) from the local cache when offline/disconnected?
I'm working on a Java-based open-source project that uses Apache Ivy to resolve and download 3rd party dependencies. The project's build.xml
has an ant target named resolve
that downloads Ivy (if needed) and then uses Ivy to retrieve the required jars.
Everything works great when online. However, without Internet access, ant resolve
fails even if the required jars are in the local Ivy cache (~/.ivy2/cache
). It appears that Ivy is trying to connect to the Maven repository to refresh changing="true"
dependencies.
The error I get is similar to the following:
[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
Running ant -verbose resolve
as suggested by the warning prints the following line in the output:
[ivy:retrieve] don't use cache for exampleorg#examplename;examplerev: changing=true
How can I get Ivy to resolve changing="true"
dependencies from the cache when offline, but continue to query the repository each build when online?
ivy.cache.ttl.default=eternal
?" part because that is a separate issue. But my original question -- how to resolve dependencies when offline -- is still unanswered. – Inpour