>
>Mmm, ok, I understand now, it's a problem of responsibilities:
>the resolver is responsible for calling the associated cache
>manager to actually download (or not) the artifacts.
If that is the case I am a bit confused by the what happens in the
resolve stack trace:
org.apache.ivy.Main at localhost:2843 (may be out of synch)
Thread [main] (Suspended (entry into method download in
BasicResolver))
GraceResolver(BasicResolver).download(Artifact[], DownloadOptions) line:
573
ResolveEngine.downloadArtifacts(ResolveReport,
Filter, DownloadOptions) line: 341
ResolveEngine.resolve(ModuleDescriptor,
ResolveOptions) line: 285
ResolveEngine.resolve(URL, ResolveOptions) line:
191
Ivy.resolve(URL, ResolveOptions) line: 506
Main.main(String[]) line: 235
In ResolveEngine.resolve(ModuleDescriptor, ResolveOptions) there is:
if (options.isDownload()) {
Message.verbose(":: downloading artifacts ::");
downloadArtifacts(report, options.getArtifactFilter(),
(DownloadOptions) new
DownloadOptions().setLog(options.getLog()));
}
Shouldn't specifying "useOrigin" result in options.isDownload()
returning false?
So it's
>normal that your resolver download method is called. Have a
>look at BasicResolver#download(Artifact[] artifacts,
>DownloadOptions options) implementation for an example of how
>this can be done. BTW, most of the time extending
>BasicResolver (or even one of its subclasses like
>RepositoryResolver) is the best option. In Ivy resolvers have
>a lot of responsibilities which aren't easy to get right
>without relying on the base implementation we provide.
>
>Xavier
>
>>
>>
>> Thanks
>>
>> paul
>>
>>
>> >-----Original Message-----
>> >From: ext Xavier Hanin [mailto:[EMAIL PROTECTED]
>> >Sent: Thursday, March 27, 2008 4:57 AM
>> >To: [email protected]
>> >Subject: Re: resolve behaviour in Main.main() does not properly
>> >account for useOrigin
>> >
>> >Usage of useOrigin has changed with Ivy 2, now it's the cache which
>> >is responsible for telling if it's configured in useOrigin mode or
>> >not, and not the resolve operation. To preserve backward
>> >compatibility, we have thus deprecated "useOrigin" in resolve.
>> >
>> >Though the command line version of Ivy should still accept the now
>> >depcreated useOrigin argument, and take it into account.
>> >The lines responsible to handle this are:
>> > if (line.hasOption("useOrigin")) {
>> > ivy.getSettings().useDeprecatedUseOrigin();
>> > }
>> >
>> >This changes the default value of useOrigin which should be taken
>> >into account in the cache implementation. But we may have a bug due
>> >to the recent change...
>> >
>> >To track this down, could you please provide the version of Ivy you
>> >use, and your debug log (running with -debug) on a simple case?
>> >
>> >Xavier
>> >
>> >On Thu, Mar 27, 2008 at 12:42 AM, <[EMAIL PROTECTED]> wrote:
>> >
>> >> Hi,
>> >>
>> >> I'm running Ivy through the command line and my current
>requirement
>> >> with Ivy is not to download and cache artifacts. I tried setting
>> >> useOrigin on the command line but it seems like it may not be
>> >> accounted for. Please note my inline comments below:
>> >>
>> >> ResolveOptions resolveOptions = new
>> >> ResolveOptions().setConfs(confs)
>> >> .setValidate(validate);
>> >>
>> >> // This call to resolve does not account for any use of useOrigin
>> >> it seems, thus it attempts to download dependencies to the cache
>> >> ResolveReport report = ivy.resolve(ivyfile.toURL(),
>> >> resolveOptions);
>> >> if (report.hasError()) {
>> >> System.exit(1);
>> >> }
>> >> ModuleDescriptor md = report.getModuleDescriptor();
>> >>
>> >> if (confs.length == 1 && "*".equals(confs[0])) {
>> >> confs = md.getConfigurationsNames();
>> >> }
>> >> if (line.hasOption("retrieve")) {
>> >> String retrievePattern =
>> >> settings.substitute(line.getOptionValue("retrieve"));
>> >> if (retrievePattern.indexOf("[") == -1) {
>> >> retrievePattern = retrievePattern +
>> >> "/lib/[conf]/[artifact].[ext]";
>> >> }
>> >>
>> >> // Here the option is checked by this is not reached, and
>is for a
>> >> different purpose anyway
>> >> ivy.retrieve(md.getModuleRevisionId(),
>> >retrievePattern,
>> >> new RetrieveOptions()
>> >>
>> >.setConfs(confs).setSync(line.hasOption("sync"))
>> >>
>.setUseOrigin(line.hasOption("useOrigin")));
>> >>
>> >>
>> >> Am I missing anything here?
>> >>
>> >> thanks
>> >>
>> >> paul
>> >>
>> >>
>> >
>> >
>> >--
>> >Xavier Hanin - Independent Java Consultant
>http://xhab.blogspot.com/
>> >http://ant.apache.org/ivy/ http://www.xoocode.org/
>> >
>>
>
>
>
>--
>Xavier Hanin - Independent Java Consultant
>http://xhab.blogspot.com/
>http://ant.apache.org/ivy/
>http://www.xoocode.org/
>