当前位置: 首页>>代码示例>>Java>>正文


Java ResolveOptions类代码示例

本文整理汇总了Java中org.apache.ivy.core.resolve.ResolveOptions的典型用法代码示例。如果您正苦于以下问题:Java ResolveOptions类的具体用法?Java ResolveOptions怎么用?Java ResolveOptions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ResolveOptions类属于org.apache.ivy.core.resolve包,在下文中一共展示了ResolveOptions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: genreport

import org.apache.ivy.core.resolve.ResolveOptions; //导入依赖的package包/类
private void genreport(ResolutionCacheManager cache, String organisation, String module) {
    // first process the report with xslt
    XSLTProcess xslt = new XSLTProcess();
    xslt.setTaskName(getTaskName());
    xslt.setProject(getProject());
    xslt.init();

    String resolveId = ResolveOptions.getDefaultResolveId(new ModuleId(organisation, module));
    xslt.setIn(cache.getConfigurationResolveReportInCache(resolveId, "default"));
    xslt.setOut(new File(getTodir(), outputname + "." + xslext));

    xslt.setStyle(xslFile);

    XSLTProcess.Param xslExt = xslt.createParam();
    xslExt.setName("extension");
    xslExt.setExpression(xslext);

    // add the provided XSLT parameters
    for (XSLTProcess.Param param : params) {
        XSLTProcess.Param realParam = xslt.createParam();
        realParam.setName(param.getName());
        realParam.setExpression(param.getExpression());
    }

    xslt.execute();
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:27,代码来源:IvyRepositoryReport.java

示例2: doExecute

import org.apache.ivy.core.resolve.ResolveOptions; //导入依赖的package包/类
public void doExecute() throws BuildException {
    prepareAndCheck();

    try {
        ResolutionCacheManager cacheMgr = getIvyInstance().getResolutionCacheManager();
        String resolveId = getResolveId();
        if (resolveId == null) {
            resolveId = ResolveOptions.getDefaultResolveId(getResolvedModuleId());
        }
        XmlReportParser parser = new XmlReportParser();
        for (String conf : splitToArray(getConf())) {
            File report = cacheMgr.getConfigurationResolveReportInCache(resolveId, conf);
            parser.parse(report);

            for (Artifact artifact : parser.getArtifacts()) {
                String name = IvyPatternHelper.substitute(getSettings().substitute(getName()),
                        artifact, conf);
                String value = IvyPatternHelper.substitute(
                        getSettings().substitute(getValue()), artifact, conf);
                setProperty(name, value);
            }
        }
    } catch (Exception ex) {
        throw new BuildException("impossible to add artifact properties: " + ex, ex);
    }
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:27,代码来源:IvyArtifactProperty.java

示例3: testUnpackExt

import org.apache.ivy.core.resolve.ResolveOptions; //导入依赖的package包/类
/**
 * Test case for IVY-1478.
 * {@link RetrieveEngine} must retrieve artifacts with the correct extension if the artifact
 * is unpacked.
 *
 * @throws Exception if something goes wrong
 * @see <a href="https://issues.apache.org/jira/browse/IVY-1478">IVY-1478</a>
 */
@Test
public void testUnpackExt() throws Exception {
    final ResolveOptions roptions = getResolveOptions(new String[] {"*"});

    final URL url = new File("test/repositories/1/packaging/module10/ivys/ivy-1.0.xml").toURI()
            .toURL();

    // normal resolve, the file goes in the cache
    final ResolveReport report = ivy.resolve(url, roptions);
    assertFalse("Resolution report has errors", report.hasError());
    final ModuleDescriptor md = report.getModuleDescriptor();
    assertNotNull("Module descriptor from report was null", md);

    final String pattern = "build/test/retrieve/[organization]/[module]/[conf]/[type]s/[artifact]-[revision](.[ext])";

    ivy.retrieve(md.getModuleRevisionId(),
        getRetrieveOptions().setDestArtifactPattern(pattern));

    final File dest = new File("build/test/retrieve/packaging/module9/default/jars/module9-1.0.jar");
    assertTrue("Retrieved artifact is missing at " + dest.getAbsolutePath(), dest.exists());
    assertTrue("Retrieved artifact at " + dest.getAbsolutePath() + " is not a file", dest.isFile());
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:31,代码来源:RetrieveTest.java

示例4: setUp

import org.apache.ivy.core.resolve.ResolveOptions; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    settings = new IvySettings();
    engine = new ResolveEngine(settings, new EventManager(), new SortEngine(settings));
    data = new ResolveData(engine, new ResolveOptions());
    TestHelper.createCache();
    settings.setDefaultCache(TestHelper.cache);
    settings.setVariable("test.mirroredurl.mirrorlist-solo.url",
        this.getClass().getResource("mirrorlist-solo.txt").toExternalForm());
    settings.setVariable("test.mirroredurl.mirrorlist-failover.url", this.getClass()
            .getResource("mirrorlist-failover.txt").toExternalForm());
    settings.setVariable("test.mirroredurl.mirrorlist-fail.url",
        this.getClass().getResource("mirrorlist-fail.txt").toExternalForm());
    new XmlSettingsParser(settings).parse(MirroredURLResolverTest.class
            .getResource("mirror-resolver-settings.xml"));
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:17,代码来源:MirroredURLResolverTest.java

示例5: setUp

import org.apache.ivy.core.resolve.ResolveOptions; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    Message.setDefaultLogger(new DefaultMessageLogger(99));

    settings = new IvySettings();
    ResolveEngine engine = new ResolveEngine(settings, new EventManager(), new SortEngine(
            settings));
    cache = new File("build/cache");
    data = new ResolveData(engine, new ResolveOptions());
    cache.mkdirs();
    settings.setDefaultCache(cache);

    // Create work space with build and resource cache directories
    workdir = new File("build/test/PackagerResolverTest");
    builddir = new File(workdir, "build");
    cachedir = new File(workdir, "resources");
    cleanupTempDirs();
    if (!builddir.mkdirs() || !cachedir.mkdirs()) {
        throw new Exception("can't create directories under " + workdir);
    }
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:22,代码来源:PackagerResolverTest.java

示例6: configureResolveOptions

import org.apache.ivy.core.resolve.ResolveOptions; //导入依赖的package包/类
/**
 * Configures resolve options
 * 
 * @return configured resolveOptions
 */
protected ResolveOptions configureResolveOptions() {
    // Here we do not specify explicit configuration to resolve as
    // we want to check multiple configurations.
    // If we make specify explicitly configurations to resolve, the
    // resolution could through exceptions when configuration does
    // not exist in resolved modules.
    // resolveOptions.setConfs(new String[] { mainConf,providedConf });

    // By default we consider that main conf is default.
    // To verify core compliance we can have a dependency on
    // easyant-core in a specific configuration.
    // By default this configuration is provided.

    // An error can be thrown if module contains non-public configurations.
    ResolveOptions resolveOptions = new ResolveOptions();
    resolveOptions.setLog(getResolveLog());

    Boolean offline = Boolean.valueOf(getProject().getProperty(EasyAntMagicNames.EASYANT_OFFLINE));
    resolveOptions.setUseCacheOnly(offline);
    return resolveOptions;
}
 
开发者ID:apache,项目名称:ant-easyant-core,代码行数:27,代码来源:AbstractImport.java

示例7: getResolveReport

import org.apache.ivy.core.resolve.ResolveOptions; //导入依赖的package包/类
/**
 * Try to load a resolve report. If not found, not available, out of date or contains resolve errors, it returns
 * <code>null</code>.
 */
private XmlReportParser getResolveReport(Ivy ivy, ModuleId mid, String conf, File ivyfile) {
    File report = ivy.getResolutionCacheManager().getConfigurationResolveReportInCache(
            ResolveOptions.getDefaultResolveId(mid), conf);
    if (!report.exists()) {
        return null;
    }
    if (ivyfile != null && ivyfile.lastModified() > report.lastModified()) {
        return null;
    }
    // found a report, try to parse it.
    try {
        log("Reading resolve report " + report, Project.MSG_DEBUG);
        XmlReportParser reportparser = new XmlReportParser();
        reportparser.parse(report);
        if (reportparser.hasError()) {
            return null;
        }
        log("Loading last resolve report for " + mid + "[" + conf + "]", Project.MSG_VERBOSE);
        return reportparser;
    } catch (ParseException e) {
        return null;
    }
}
 
开发者ID:apache,项目名称:ant-easyant-core,代码行数:28,代码来源:ImportAntscripts.java

示例8: findAllArtifactOnRefresh

import org.apache.ivy.core.resolve.ResolveOptions; //导入依赖的package包/类
/**
 * Populate the map of artifact. The map should be populated by metadata in cache as this is
 * called in the refresh process.
 *
 * @param ivy Ivy
 * @param parser XmlReportParser
 * @param result ResolveResult
 * @throws ParseException if parser fails
 */
private void findAllArtifactOnRefresh(Ivy ivy, XmlReportParser parser, ResolveResult result)
        throws ParseException {
    ModuleRevisionId[] dependencyMrids = parser.getDependencyRevisionIds();
    IvyDEMessage.verbose("Resolve report parsed. Fetching artifacts of "
            + dependencyMrids.length + " dependencie(s)");
    for (ModuleRevisionId dependencyMrid : dependencyMrids) {
        DependencyResolver depResolver = ivy.getSettings().getResolver(dependencyMrid);
        DefaultDependencyDescriptor depDescriptor = new DefaultDependencyDescriptor(
                dependencyMrid, false);
        ResolveOptions options = new ResolveOptions();
        options.setRefresh(true);
        options.setUseCacheOnly(true);
        IvyDEMessage.debug("Fetching dependency " + dependencyMrid);
        ResolvedModuleRevision dependency = depResolver.getDependency(depDescriptor,
            new ResolveData(ivy.getResolveEngine(), options));
        if (dependency != null) {
            Artifact[] artifacts = dependency.getDescriptor().getAllArtifacts();
            IvyDEMessage.debug("Dependency " + dependencyMrid + " found: "
                    + artifacts.length + " artifact(s) found");
            result.putArtifactsForDep(dependencyMrid, artifacts);
        } else {
            IvyDEMessage.debug("Dependency " + dependencyMrid + " not found");
        }
    }
}
 
开发者ID:apache,项目名称:ant-ivyde,代码行数:35,代码来源:IvyResolver.java

示例9: buildResolveId

import org.apache.ivy.core.resolve.ResolveOptions; //导入依赖的package包/类
/**
 * Build the resolve id used when reading and writing resolve reports.
 *
 * @param useExtendedResolveId
 *            boolean indicating if extended resolve id is being used.
 * @param md
 *            The ModuleDescriptor to be resolved.
 * @return The resolve id.
 */
public static String buildResolveId(boolean useExtendedResolveId, ModuleDescriptor md) {
    StringBuilder sb = new StringBuilder(ResolveOptions.getDefaultResolveId(md));
    if (useExtendedResolveId) {
        ModuleRevisionId mrid = md.getModuleRevisionId();
        String sts = md.getStatus();
        String bch = mrid.getBranch();
        String rev = mrid.getRevision();
        sb.append("-");
        if (sts != null) {
            sb.append(sts);
        }
        sb.append("-");
        if (bch != null) {
            sb.append(bch);
        }
        sb.append("-");
        if (rev != null) {
            sb.append(rev);
        }
    }
    return sb.toString();
}
 
开发者ID:apache,项目名称:ant-ivyde,代码行数:32,代码来源:IvyClasspathUtil.java

示例10: newResolveOptions

import org.apache.ivy.core.resolve.ResolveOptions; //导入依赖的package包/类
private ResolveOptions newResolveOptions(String[] confs, String revision, File cache, Date date,
        boolean validate, boolean useCacheOnly, boolean transitive, boolean useOrigin,
        boolean download, boolean outputReport, Filter<Artifact> 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);
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:11,代码来源:Ivy14.java

示例11: resolve

import org.apache.ivy.core.resolve.ResolveOptions; //导入依赖的package包/类
public ResolveReport resolve(ModuleRevisionId mrid, ResolveOptions options, boolean changing)
        throws ParseException, IOException {
    pushContext();
    try {
        return resolveEngine.resolve(mrid, options, changing);
    } finally {
        popContext();
    }
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:10,代码来源:Ivy.java

示例12: findModule

import org.apache.ivy.core.resolve.ResolveOptions; //导入依赖的package包/类
public ResolvedModuleRevision findModule(ModuleRevisionId mrid) {
    pushContext();
    try {
        ResolveOptions options = new ResolveOptions();
        options.setValidate(false);
        return resolveEngine.findModule(mrid, options);
    } finally {
        popContext();
    }
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:11,代码来源:Ivy.java

示例13: gen

import org.apache.ivy.core.resolve.ResolveOptions; //导入依赖的package包/类
private void gen(ResolutionCacheManager cache, String organisation, String module,
        String style, String ext) {
    XSLTProcess xslt = new XSLTProcess();
    xslt.setTaskName(getTaskName());
    xslt.setProject(getProject());
    xslt.init();

    String resolveId = ResolveOptions.getDefaultResolveId(new ModuleId(organisation, module));
    xslt.setIn(cache.getConfigurationResolveReportInCache(resolveId, "default"));
    xslt.setOut(new File(getTodir(), outputname + "." + ext));
    xslt.setBasedir(cache.getResolutionCacheRoot());
    xslt.setStyle(style);
    xslt.execute();
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:15,代码来源:IvyRepositoryReport.java

示例14: getResolveOptions

import org.apache.ivy.core.resolve.ResolveOptions; //导入依赖的package包/类
private ResolveOptions getResolveOptions(Ivy ivy, String[] confs, IvySettings settings) {
    if (useOrigin) {
        settings.useDeprecatedUseOrigin();
    }
    return ((ResolveOptions) new ResolveOptions().setLog(log)).setConfs(confs)
            .setValidate(doValidate(settings))
            .setArtifactFilter(FilterHelper.getArtifactTypeFilter(type)).setRevision(revision)
            .setDate(getPubDate(pubdate, null)).setUseCacheOnly(useCacheOnly)
            .setRefresh(refresh).setTransitive(transitive).setResolveMode(resolveMode)
            .setResolveId(resolveId).setCheckIfChanged(checkIfChanged);
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:12,代码来源:IvyResolve.java

示例15: ResolverManifestIterator

import org.apache.ivy.core.resolve.ResolveOptions; //导入依赖的package包/类
public ResolverManifestIterator() {
    organisations = resolver.listOrganisations();
    IvySettings settings = new IvySettings();
    ResolveEngine engine = new ResolveEngine(settings, new EventManager(), new SortEngine(
            settings));
    data = new ResolveData(engine, new ResolveOptions());
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:8,代码来源:ResolverManifestIterable.java


注:本文中的org.apache.ivy.core.resolve.ResolveOptions类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。