public void doExecute() throws BuildException {
    if (organisation == null) {
      throw new BuildException("no organisation provided for ivy listmodules task");
    }
    if (module == null) {
      throw new BuildException("no module name provided for ivy listmodules task");
    }
    if (revision == null) {
      throw new BuildException("no revision provided for ivy listmodules task");
    }
    if (property == null) {
      throw new BuildException("no property provided for ivy listmodules task");
    }
    if (value == null) {
      throw new BuildException("no value provided for ivy listmodules task");
    }

    Ivy ivy = getIvyInstance();
    IvySettings settings = ivy.getSettings();

    SearchEngine searcher = new SearchEngine(settings);
    PatternMatcher patternMatcher = settings.getMatcher(matcher);

    ModuleRevisionId[] mrids;
    if (resolver == null) {
      mrids =
          searcher.listModules(
              ModuleRevisionId.newInstance(organisation, module, branch, revision), patternMatcher);
    } else {
      DependencyResolver depResolver = settings.getResolver(resolver);
      if (depResolver == null) {
        throw new BuildException("Unknown resolver: " + resolver);
      }
      mrids =
          searcher.listModules(
              depResolver,
              ModuleRevisionId.newInstance(organisation, module, branch, revision),
              patternMatcher);
    }

    for (int i = 0; i < mrids.length; i++) {
      String name = IvyPatternHelper.substitute(settings.substitute(property), mrids[i]);
      String value = IvyPatternHelper.substitute(settings.substitute(this.value), mrids[i]);
      getProject().setProperty(name, value);
    }
  }
 private String getResourceURL() {
   String baseURL =
       IvyPatternHelper.substitute(
           resourceURL,
           mr.getOrganisation(),
           mr.getName(),
           mr.getRevision(),
           null,
           null,
           null,
           null,
           mr.getQualifiedExtraAttributes(),
           null);
   int slash = baseURL.lastIndexOf('/');
   if (slash != -1) {
     baseURL = baseURL.substring(0, slash + 1);
   }
   return baseURL;
 }