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

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

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

Ivy.getSettings介绍

暂无

代码示例

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

public IvyGetArtifact getIvyGetArtifact() throws ParseException, IOException {
  File cacheDirectory = new File(ivyCache);// ivy下包缓存目录
  if (!cacheDirectory.exists()) {
    cacheDirectory.mkdirs();
  }
  URL settingsURL = MavenProjectUtils.class.getClassLoader().getResource("ivysettings.xml");
  Ivy ivy = Ivy.newInstance();
  ivy.getSettings().setDefaultCache(cacheDirectory);
  ivy.getSettings().setVariable("ivy.local.default.root", localRepository);
  ivy.getSettings().load(settingsURL);
  return new IvyGetArtifact(logger, ivy);
}

代码示例来源: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

protected IvySettings getSettings() {
  return getIvyInstance().getSettings();
}

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

public IvySettings getSettings() {
  return getIvy().getSettings();
}

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

public Object doInIvyContext(Ivy ivy, IvyContext context) {
    try {
      return  ModuleDescriptorParserRegistry.getInstance().parseDescriptor(ivy.getSettings(),
          fivyF.toURI().toURL(), ivy.getSettings().doValidate());
    } catch (MalformedURLException e) {
      LOGGER.log(Level.WARNING, "The URL is malformed : " + fivyF, e);
      return null;
    } catch (ParseException e) {
      LOGGER.log(Level.WARNING, "Parsing error while reading the ivy file " + fivyF, e);
      return null;
    } catch (IOException e) {
      LOGGER.log(Level.WARNING, "I/O error while reading the ivy file " + fivyF, e);
      return null;
    }
  }
});

代码示例来源:origin: org.jvnet.hudson.plugins/ivy

public Object doInIvyContext(Ivy ivy, IvyContext context) {
    try {
      return  ModuleDescriptorParserRegistry.getInstance().parseDescriptor(ivy.getSettings(),
          ivyF.toURI().toURL(), ivy.getSettings().doValidate());
    } catch (MalformedURLException e) {
      LOGGER.log(Level.WARNING, "The URL is malformed : " + ivyF, e);
      return null;
    } catch (ParseException e) {
      LOGGER.log(Level.WARNING, "Parsing error while reading the ivy file " + ivyF, e);
      return null;
    } catch (IOException e) {
      LOGGER.log(Level.WARNING, "I/O error while reading the ivy file " + ivyF, e);
      return null;
    }
  }
}));

代码示例来源:origin: org.jvnet.hudson.plugins/ivy

public Object doInIvyContext(Ivy ivy, IvyContext context) {
    try {
      return ModuleDescriptorParserRegistry.getInstance().parseDescriptor(ivy.getSettings(), ivyFile.toURI().toURL(),
          ivy.getSettings().doValidate());
    } catch (MalformedURLException e) {
      logger.println("The URL is malformed : " + ivyFile);
      return null;
    } catch (ParseException e) {
      logger.println("Parsing error while reading the ivy file " + ivyFile);
      return null;
    } catch (IOException e) {
      logger.println("I/O error while reading the ivy file " + ivyFile);
      return null;
    }
  }
});

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

public Object doInIvyContext(Ivy ivy, IvyContext context) {
    try {
      return ModuleDescriptorParserRegistry.getInstance().parseDescriptor(ivy.getSettings(), ivyFile.toURI().toURL(),
          ivy.getSettings().doValidate());
    } catch (MalformedURLException e) {
      logger.println("The URL is malformed : " + ivyFile);
      return null;
    } catch (ParseException e) {
      logger.println("Parsing error while reading the ivy file " + ivyFile);
      return null;
    } catch (IOException e) {
      logger.println("I/O error while reading the ivy file " + ivyFile);
      return null;
    }
  }
});

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

public Object doInIvyContext(Ivy ivy, IvyContext context) {
    try {
      return  ModuleDescriptorParserRegistry.getInstance().parseDescriptor(ivy.getSettings(),
          fivyF.toURI().toURL(), ivy.getSettings().doValidate());
    } catch (MalformedURLException e) {
      LOGGER.log(Level.WARNING, "The URL is malformed : " + fivyF, e);
      return null;
    } catch (ParseException e) {
      LOGGER.log(Level.WARNING, "Parsing error while reading the ivy file " + fivyF, e);
      return null;
    } catch (IOException e) {
      LOGGER.log(Level.WARNING, "I/O error while reading the ivy file " + fivyF, e);
      return null;
    }
  }
}));

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

public Object doInIvyContext(Ivy ivy, IvyContext context) {
    try {
      return ModuleDescriptorParserRegistry.getInstance().parseDescriptor(ivy.getSettings(), ivyFile.toURI().toURL(),
          ivy.getSettings().doValidate());
    } catch (MalformedURLException e) {
      logger.println("The URL is malformed : " + ivyFile);
      return null;
    } catch (ParseException e) {
      logger.println("Parsing error while reading the ivy file " + ivyFile);
      return null;
    } catch (IOException e) {
      logger.println("I/O error while reading the ivy file " + ivyFile);
      return null;
    }
  }
});

代码示例来源: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: org.apache.ivy/ivy

public void doExecute() throws BuildException {
  Ivy ivy = getIvyInstance();
  IvySettings settings = ivy.getSettings();
  if (getName() != null) {
    settings.setVariable(getVarName(getName()), getValue());

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

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

    Ivy ivy = getIvyInstance();
    IvySettings settings = ivy.getSettings();
    if (branch == null) {
      branch = settings.getDefaultBranch(new ModuleId(organisation, module));
    }
    ResolvedModuleRevision rmr = ivy.findModule(ModuleRevisionId.newInstance(organisation,
      module, branch, revision));
    if (rmr != null) {
      getProject().setProperty(property, rmr.getId().getRevision());
    }
  }
}

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

private static IvySettings initSettings(CommandLine line, Ivy ivy)
    throws java.text.ParseException, IOException, ParseException {
  IvySettings settings = ivy.getSettings();
  settings.addAllVariables(System.getProperties());
  if (line.hasOption("m2compatible")) {
    settings.setVariable("ivy.default.configuration.m2compatible", "true");
  }
  configureURLHandler(line.getOptionValue("realm", null), line.getOptionValue("host", null),
    line.getOptionValue("username", null), line.getOptionValue("passwd", null));
  String settingsPath = line.getOptionValue("settings", "");
  if ("".equals(settingsPath)) {
    settingsPath = line.getOptionValue("conf", "");
    if (!"".equals(settingsPath)) {
      Message.deprecated("-conf is deprecated, use -settings instead");
    }
  }
  if ("".equals(settingsPath)) {
    ivy.configureDefault();
  } else {
    File conffile = new File(settingsPath);
    if (!conffile.exists()) {
      error("ivy configuration file not found: " + conffile);
    } else if (conffile.isDirectory()) {
      error("ivy configuration file is not a file: " + conffile);
    }
    ivy.configure(conffile);
  }
  return settings;
}

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

public void doExecute() throws BuildException {
    IvySettings settings = getIvyInstance().getSettings();
    if (isResolution()) {
      settings.getResolutionCacheManager().clean();
    }
    if (ALL.equals(getCache())) {
      RepositoryCacheManager[] caches = settings.getRepositoryCacheManagers();
      for (int i = 0; i < caches.length; i++) {
        caches[i].clean();
      }
    } else if (!NONE.equals(getCache())) {
      RepositoryCacheManager cache = settings.getRepositoryCacheManager(getCache());
      if (cache == null) {
        throw new BuildException("unknown cache '" + getCache() + "'");
      } else {
        cache.clean();
      }
    }
  }
}

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

public void doExecute() throws BuildException {
  Ivy ivy = getIvyInstance();
  IvySettings settings = ivy.getSettings();

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

public void doExecute() throws BuildException {
  Ivy ivy = getIvyInstance();
  IvySettings settings = ivy.getSettings();

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

IvySettings settings = ivy.getSettings();

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

IvySettings settings = ivy.getSettings();
File cacheDirFile = settings.getDefaultRepositoryCacheBasedir();
RepositoryCacheManager repositoryCacheManager = new DefaultRepositoryCacheManager("repo", settings, cacheDirFile);

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

private ResolveOptions newResolveOptions(String[] confs, String revision, File cache,
    Date date, boolean validate, boolean useCacheOnly, boolean transitive,
    boolean useOrigin, boolean download, boolean outputReport, Filter artifactFilter) {
  if (useOrigin) {
    ivy.getSettings().useDeprecatedUseOrigin();
  }
  return new ResolveOptions().setConfs(confs).setRevision(revision).setValidate(validate)
      .setUseCacheOnly(useCacheOnly).setTransitive(transitive).setDownload(download)
      .setOutputReport(outputReport).setArtifactFilter(artifactFilter);
}

相关文章