Le 29 août 2011 à 15:41, Frank Wilson a écrit : > 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?
I don't think it has been addressed. This is a feature I'm interested in too. For some other project I have done some work around with my custom implemented Ant task. If you could find that jira issue, I may look to into it (if you don't find it, you're welcomed to open a new one). Nicolas