org.apache.ivy.Ivy.resolve()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(8.5k)|赞(0)|评价(0)|浏览(100)

本文整理了Java中org.apache.ivy.Ivy.resolve()方法的一些代码示例,展示了Ivy.resolve()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ivy.resolve()方法的具体详情如下:
包路径:org.apache.ivy.Ivy
类名称:Ivy
方法名:resolve

Ivy.resolve介绍

暂无

代码示例

代码示例来源:origin: vipshop/Saturn

public List<URL> get(String org, String name, String rev, String[] confs, Set<Map<String, Object>> artifacts)
    throws IOException, ParseException {
  Set<URL> artifactsGeted = new HashSet<URL>();
  try {
    ivy.getSettings().addAllVariables(System.getProperties());
    ivy.pushContext();
    File ivyfile = getIvyfile(org, name, rev, confs, artifacts);
    String[] conf2 = new String[] { "default" };
    ResolveOptions resolveOptions = new ResolveOptions().setConfs(conf2).setValidate(true).setResolveMode(null)
        .setArtifactFilter(FilterHelper.getArtifactTypeFilter("jar,bundle,zip"));
    ResolveReport report = ivy.resolve(ivyfile.toURI().toURL(), resolveOptions);
    if (report.hasError()) {
      List<?> problemMessages = report.getAllProblemMessages();
      for (Object message : problemMessages) {
        log.error(message.toString());
      }
    } else {
      artifactsGeted.addAll(getCachePath(report.getModuleDescriptor(), conf2));
    }
  } catch (IOException e) {
    throw e;
  } catch (ParseException e) {
    throw e;
  } finally {
    ivy.popContext();
  }
  List<URL> result = new ArrayList<URL>();
  result.addAll(artifactsGeted);
  return result;
}

代码示例来源:origin: org.apache.ivy/ivy

public ResolveReport resolve(URL ivySource) throws ParseException, IOException {
  return ivy.resolve(ivySource);
}

代码示例来源:origin: org.apache.ivy/ivy

public ResolveReport resolve(ModuleDescriptor md, String[] confs, File cache, Date date,
    boolean validate, boolean useCacheOnly, boolean transitive, boolean useOrigin,
    boolean download, boolean outputReport, Filter artifactFilter) throws ParseException,
    IOException {
  return ivy.resolve(
    md,
    newResolveOptions(confs, null, cache, date, validate, useCacheOnly, transitive,
      useOrigin, download, outputReport, artifactFilter));
}

代码示例来源:origin: org.apache.ivy/ivy

public ResolveReport resolve(File ivySource, ResolveOptions options) throws ParseException,
    IOException {
  return resolve(ivySource.toURI().toURL(), options);
}

代码示例来源:origin: org.apache.ivy/ivy

public ResolveReport resolve(ModuleRevisionId mrid, String[] confs, boolean transitive,
    boolean changing, File cache, Date date, boolean validate, boolean useCacheOnly,
    Filter artifactFilter) throws ParseException, IOException {
  return ivy.resolve(
    mrid,
    newResolveOptions(confs, null, cache, date, validate, useCacheOnly, transitive, false,
      true, true, artifactFilter), changing);
}

代码示例来源:origin: org.apache.ivy/ivy

public ResolveReport resolve(URL ivySource, String revision, String[] confs, File cache,
    Date date, boolean validate, boolean useCacheOnly, boolean transitive,
    Filter artifactFilter) throws ParseException, IOException {
  return ivy.resolve(
    ivySource,
    newResolveOptions(confs, revision, cache, date, validate, useCacheOnly, transitive,
      false, true, true, artifactFilter));
}

代码示例来源:origin: org.apache.ivy/ivy

public ResolveReport resolve(ModuleDescriptor md, String[] confs, File cache, Date date,
    boolean validate, boolean useCacheOnly, boolean transitive, boolean download,
    boolean outputReport, Filter artifactFilter) throws ParseException, IOException {
  return ivy.resolve(
    md,
    newResolveOptions(confs, null, cache, date, validate, useCacheOnly, transitive, false,
      download, outputReport, artifactFilter));
}

代码示例来源:origin: org.apache.ivy/ivy

public ResolveReport resolve(ModuleDescriptor md, String[] confs, File cache, Date date,
    boolean validate, boolean useCacheOnly, Filter artifactFilter) throws ParseException,
    IOException {
  return ivy.resolve(
    md,
    newResolveOptions(confs, null, cache, date, validate, useCacheOnly, true, false, true,
      true, artifactFilter));
}

代码示例来源:origin: org.apache.ivy/ivy

public ResolveReport resolve(URL ivySource, String revision, String[] confs, File cache,
    Date date, boolean validate) throws ParseException, IOException {
  return ivy.resolve(
    ivySource,
    newResolveOptions(confs, revision, cache, date, validate, false, true, false, true,
      true, FilterHelper.NO_FILTER));
}

代码示例来源:origin: org.apache.ivy/ivy

public ResolveReport resolve(ModuleDescriptor md, String[] confs, File cache, Date date,
    boolean validate, boolean useCacheOnly, boolean transitive, Filter artifactFilter)
    throws ParseException, IOException {
  return ivy.resolve(
    md,
    newResolveOptions(confs, null, cache, date, validate, useCacheOnly, transitive, false,
      true, true, artifactFilter));
}

代码示例来源:origin: org.apache.ivy/ivy

public ResolveReport resolve(ModuleRevisionId mrid, String[] confs, boolean transitive,
    boolean changing, File cache, Date date, boolean validate, boolean useCacheOnly,
    boolean useOrigin, Filter artifactFilter) throws ParseException, IOException {
  return ivy.resolve(
    mrid,
    newResolveOptions(confs, null, cache, date, validate, useCacheOnly, transitive,
      useOrigin, true, true, artifactFilter), changing);
}

代码示例来源:origin: org.apache.ivy/ivy

public ResolveReport resolve(URL ivySource, String revision, String[] confs, File cache,
    Date date, boolean validate, boolean useCacheOnly, boolean transitive,
    boolean useOrigin, Filter artifactFilter) throws ParseException, IOException {
  return ivy.resolve(
    ivySource,
    newResolveOptions(confs, revision, cache, date, validate, useCacheOnly, transitive,
      useOrigin, true, true, artifactFilter));
}

代码示例来源:origin: org.apache.ivy/ivy

public ResolveReport resolve(URL ivySource, String revision, String[] confs, File cache,
    Date date, boolean validate, boolean useCacheOnly, Filter artifactFilter)
    throws ParseException, IOException {
  return ivy.resolve(
    ivySource,
    newResolveOptions(confs, revision, cache, date, validate, useCacheOnly, true, false,
      true, true, artifactFilter));
}

代码示例来源:origin: org.apache.ivy/ivy

public ResolveReport resolve(URL ivySource, String revision, String[] confs, File cache,
    Date date, boolean validate, boolean useCacheOnly) throws ParseException, IOException {
  return ivy.resolve(
    ivySource,
    newResolveOptions(confs, revision, cache, date, validate, useCacheOnly, true, false,
      true, true, FilterHelper.NO_FILTER));
}

代码示例来源:origin: org.apache.ivy/ivy

public ResolveReport resolve(ModuleRevisionId mrid, String[] confs) throws ParseException,
    IOException {
  return ivy.resolve(
    mrid,
    newResolveOptions(confs, null, ivy.getSettings().getDefaultCache(), null, true, false,
      true, false, true, true, FilterHelper.NO_FILTER), false);
}

代码示例来源:origin: net.sourceforge.scenarlang/UT_DSL_JAVA_UTL

public static void resolveDependencies() throws ParseException, IOException {
  Ivy ivy = Ivy.newInstance(getIvySettings());
  File dependencyFile = getIvyDependencyFile();
  // resolve the dependencies - Ivy returns a report of the resolution
  ResolveReport resolveReport = ivy.resolve(dependencyFile);
  // check for errors (if any) during resolve
  if (resolveReport.hasError()) {
    System.err.println(getErrorString(resolveReport));
  } else {
    System.out.println("Dependencies in file " + dependencyFile + " were successfully resolved");
  }
}

代码示例来源:origin: org.walkmod/walkmod-core

ResolveReport report = ivy.resolve(ivyfile.toURL(), resolveOptions);

代码示例来源:origin: com.netflix.spinnaker.clouddriver/clouddriver-artifacts

public InputStream download(Artifact artifact) {
 Path cacheDir = cacheBuilder.get();
 Ivy ivy = account.getSettings().toIvy(cacheDir);
 String[] parts = artifact.getReference().split(":");
 if (parts.length < 3) {
  throw new IllegalArgumentException("Ivy artifact reference must have a group, artifact, and version separated by ':'");
 }
 ModuleRevisionId mrid = new ModuleRevisionId(new ModuleId(parts[0], parts[1]), parts[2]);
 try {
  ResolveReport report = ivy.resolve(mrid, (ResolveOptions) new ResolveOptions()
   .setTransitive(false)
   .setConfs(account.getResolveConfigurations().toArray(new String[0]))
   .setLog("download-only"), true);
  return Arrays.stream(report.getAllArtifactsReports())
   .findFirst()
   .map(rep -> {
    try {
     return new DiskFreeingInputStream(new FileInputStream(rep.getLocalFile()), cacheDir);
    } catch (FileNotFoundException e) {
     throw new UncheckedIOException(e);
    }
   })
   .orElseThrow(() -> new IllegalArgumentException("Unable to resolve artifact for reference '" + artifact.getReference() + "'"));
 } catch (ParseException | IOException e) {
  throw new IllegalArgumentException(e);
 }
}

代码示例来源:origin: org.jenkins-ci.plugins/ivytrigger

ResolveReport resolveReport = ivy.resolve(ivyFileURL, options);
if (resolveReport.hasError()) {
  List problems = resolveReport.getAllProblemMessages();

代码示例来源:origin: io.restx/restx-core-shell

private void installDepsFromIvyDescriptor(RestxShell shell, File ivyFile) throws Exception {
  Ivy ivy = ShellIvy.loadIvy(shell);
  shell.println("resolving dependencies...");
  ResolveReport resolveReport = ivy.resolve(ivyFile);
  shell.println("synchronizing dependencies in " + shell.currentLocation().resolve("target/dependency") + " ...");
  ivy.retrieve(resolveReport.getModuleDescriptor().getModuleRevisionId(),
      new RetrieveOptions()
          .setDestArtifactPattern(
              shell.currentLocation().toAbsolutePath() + "/target/dependency/[artifact]-[revision](-[classifier]).[ext]")
          .setSync(true)
  );
}

相关文章