On 10/30/07, John Rasmussen <[EMAIL PROTECTED]> wrote: > > I have extended org.apache.ivy.plugins.repository.AbstractRepository > in order to build modules directly from source.
Interesting use case, feel free to share more about that with the community if you can. If any of the module/source contains compilation errors, I like the > resolve process to stop. > > In method Resource getResource(String source) of AbstractRepository, I > have tried calling fireTransferError, throwing an IOException and > returning a Resource.exists = false. Thus Ivy knows the module is > unresolved but Ivy continues resolving the next dependencies. > Because resolving a dependency can involve building source, it gets > time consuming to wait for the resolve process to complete all the > dependencies - no errors are written until the process completes. > That's why I want to stop when the first dependency fails. > Well, one solution is to call System.exit, but like > org.apache.ivy.util.Message() is not flushed, so this is not the best > solution. > > Normally, Ivy should continue resolving dependencies (as it does), but > in this case, I like a way to halt. > IvyResolve.isHaltonfailure() is only read after all the dependencies > have been resolved. > > I have tried Ivy 1.4.1 and 2.0.0-alpha2 but not found a way to halt on > an unresolved dependency. > > Summary: Are there a "nice" way to stop the resolve process when > failing to resolve a dependency? Unfortunately not, Ivy resolution process tries to get as much information as possible, like a compiler do. But I understand your use case, and since you seems to have already scratched Ivy internals maybe opening a JIRA issue and providing a patch to handle this would be easy enough for you. Maybe you could add a new runtime exception, eg HaltIvyProcessException (a generic name could be reused in other situation than resolution), and catch it specifically to make sure it actually halts the resolution process in the ResolveEngine. Xavier Regards > John Rasmussen > -- Xavier Hanin - Independent Java Consultant http://xhab.blogspot.com/ http://ant.apache.org/ivy/ http://www.xoocode.org/
