I have an ant build that is triggered by eclipse when project files are saved. The ant build depends on various ant tasks that are resolved via the ivy cachepath task. The problem is the resolve task re-executes even when dependencies are already cached under the .ivy directory. Is there a way to shortcut the dependency resolution when there is already information in the cache?
This was my initial build file (for the sake of argument assume test-contrib is a useful thing when saving files in an IDE). <target name="-resolve-build-dependencies"> <ivy:resolve> <ivy:cachepath pathid="build.classpath" conf="build" /> </target> <target name="-define-build-dependencies" depends="-resolve-build-dependencies"> <taskdef resource="net/sf/antcontrib/antcontrib.properties" uri="http://ant-contrib.sourceforge.net/tasks"> <classpath refid="build.classpath" /> </taskdef> </target> <target name="test-contrib" depends="-define-build-dependencies" <ac:osfamily property="os.family" /> <echo message="${os.family}" /> </target> The resolve tasks was always being executed. I read that cachepath task would indeed shortcut the resolution of dependencies if it was given an organisation and module attribute. So my resolve-build-dependencies task was changed to this: <target name="-resolve-build-dependencies"> <ivy:info/> <ivy:cachepath organisation="${ivy.organisation}" module="${ivy.module}" pathid="build.classpath" conf="build" /> </target> However when the cache gets blown away by the cleancache task (say) this will not work because it is not doing the resolution anymore. I therefore get the following error: Caused by: java.lang.IllegalStateException: Report file '/Users/frank/.ivy2/cache/com.example-appconfig-build.xml' does not exist. I tried using cachepaths ability to do resolution by supplying the file attribute. <target name="-resolve-build-dependencies"> <ivy:info/> <ivy:cachepath organisation="${ivy.organisation}" module="${ivy.module}" file="${ivy.dep.file}" pathid="build.classpath" conf="build" /> </target> However this only works when organisation and module are not provided, in which case we are back to the situation where we always resolve dependencies even when it is not necessary. If organisation and module are provided with the file attribute then we get the error again. Is there some way to prevent ivy from resolving dependencies unnecessarily? I guess its possible to write out some property to a file and check for it before running resolve task, but this seems messy and something that could be managed more elegantly by ivy internally. It seems an issue similar to this was raised in JIRA back in 06/07. I wondered if it has been addressed since? Thanks, Frank