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


Java ModuleDescriptorParser.parseDescriptor方法代码示例

本文整理汇总了Java中org.apache.ivy.plugins.parser.ModuleDescriptorParser.parseDescriptor方法的典型用法代码示例。如果您正苦于以下问题:Java ModuleDescriptorParser.parseDescriptor方法的具体用法?Java ModuleDescriptorParser.parseDescriptor怎么用?Java ModuleDescriptorParser.parseDescriptor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.ivy.plugins.parser.ModuleDescriptorParser的用法示例。


在下文中一共展示了ModuleDescriptorParser.parseDescriptor方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: deployEffectivePom

import org.apache.ivy.plugins.parser.ModuleDescriptorParser; //导入方法依赖的package包/类
private void deployEffectivePom( ModuleRevisionId moduleRevisionId, Path artifactPath )
    throws IOException
{
    try
    {
        File pomFile = artifactPath.resolveSibling( artifactPath.getName( artifactPath.getNameCount() - 1 )
            + "-xmvn.pom" ).toFile();
        ModuleDescriptorParser parser = XmlModuleDescriptorParser.getInstance();
        ModuleDescriptor module =
            parser.parseDescriptor( getSettings(), artifactPath.toFile().toURI().toURL(), false );
        PomModuleDescriptorWriter.write( module, pomFile, new PomWriterOptions() );

        org.fedoraproject.xmvn.artifact.Artifact artifact = ivy2aether( moduleRevisionId, "pom" );
        deploy( artifact, null, artifactPath );
    }
    catch ( ParseException e )
    {
        throw new IOException( e );
    }
}
 
开发者ID:fedora-java,项目名称:xmvn,代码行数:21,代码来源:IvyResolver.java

示例2: resolve

import org.apache.ivy.plugins.parser.ModuleDescriptorParser; //导入方法依赖的package包/类
/**
 * Resolve dependencies of a module described by an ivy file.
 *
 * @param ivySource URL
 * @param options ResolveOptions
 * @return ResolveReport
 * @throws ParseException if something goes wrong
 * @throws IOException if something goes wrong
 */
public ResolveReport resolve(URL ivySource, ResolveOptions options) throws ParseException,
        IOException {
    URLResource res = new URLResource(ivySource);
    ModuleDescriptorParser parser = ModuleDescriptorParserRegistry.getInstance().getParser(res);
    Message.verbose("using " + parser + " to parse " + ivySource);
    ModuleDescriptor md = parser.parseDescriptor(settings, ivySource, options.isValidate());
    String revision = options.getRevision();
    if (revision == null && md.getResolvedModuleRevisionId().getRevision() == null) {
        revision = Ivy.getWorkingRevision();
    }
    if (revision != null) {
        md.setResolvedModuleRevisionId(ModuleRevisionId.newInstance(md.getModuleRevisionId(),
            revision));
    }

    return resolve(md, options);
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:27,代码来源:ResolveEngine.java

示例3: parseParentModuleOnFilesystem

import org.apache.ivy.plugins.parser.ModuleDescriptorParser; //导入方法依赖的package包/类
/**
 * Returns the parent module using the location attribute (for dev purpose).
 * 
 * @param location
 *            a given location
 * @throws IOException
 * @throws ParseException
 */
private ModuleDescriptor parseParentModuleOnFilesystem(String location) throws IOException, ParseException {
    if (!"file".equals(getDescriptorURL().getProtocol())) {
        return null;
    }

    File file = new File(location);
    if (!file.isAbsolute()) {
        URL url = getSettings().getRelativeUrlResolver().getURL(getDescriptorURL(), location);
        try {
            file = new File(new URI(url.toExternalForm()));
        } catch (URISyntaxException e) {
            file = new File(url.getPath());
        }
    }

    file = FileUtil.normalize(file.getAbsolutePath());
    if (!file.exists()) {
        Message.verbose("Parent module doesn't exist on the filesystem: " + file.getAbsolutePath());
        return null;
    }

    FileResource res = new FileResource(null, file);
    ModuleDescriptorParser parser = ModuleDescriptorParserRegistry.getInstance().getParser(res);
    return parser.parseDescriptor(getSettings(), file.toURI().toURL(), res, isValidate());
}
 
开发者ID:apache,项目名称:ant-easyant-core,代码行数:34,代码来源:DefaultEasyAntXmlModuleDescriptorParser.java

示例4: readIvyModuleDescriptorFromPom

import org.apache.ivy.plugins.parser.ModuleDescriptorParser; //导入方法依赖的package包/类
private ModuleDescriptor readIvyModuleDescriptorFromPom( DependencyDescriptor depDescriptor )
    throws IOException, ParseException
{
    ModuleRevisionId depId = depDescriptor.getDependencyRevisionId();

    ResolutionRequest request = new ResolutionRequest();
    request.setArtifact( ivy2aether( depId, "pom" ) );
    ResolutionResult result = getResolver().resolve( request );
    Path pomPath = result.getArtifactPath();

    String version;
    ModuleDescriptor module;
    if ( pomPath != null )
    {
        ModuleDescriptorParser parser = PomModuleDescriptorParser.getInstance();
        module = parser.parseDescriptor( getSettings(), pomPath.toFile().toURI().toURL(), false );
        version = resolvedVersion( result );
    }
    else
    {
        module = DefaultModuleDescriptor.newDefaultInstance( depId, depDescriptor.getAllDependencyArtifacts() );
        version = resolveModuleVersion( module );
        if ( version == null )
            return null;
    }

    module.setResolvedModuleRevisionId( ModuleRevisionId.newInstance( depId, version ) );
    return module;
}
 
开发者ID:fedora-java,项目名称:xmvn,代码行数:30,代码来源:IvyResolver.java

示例5: parseModuleDescriptor

import org.apache.ivy.plugins.parser.ModuleDescriptorParser; //导入方法依赖的package包/类
protected ModuleDescriptor parseModuleDescriptor(DependencyResolver resolver, Artifact moduleArtifact, CacheMetadataOptions options, File artifactFile, Resource resource) throws ParseException {
    ModuleRevisionId moduleRevisionId = moduleArtifact.getId().getModuleRevisionId();
    try {
        IvySettings ivySettings = IvyContextualiser.getIvyContext().getSettings();
        ParserSettings parserSettings = new LegacyResolverParserSettings(ivySettings, resolver, moduleRevisionId);
        ModuleDescriptorParser parser = ModuleDescriptorParserRegistry.getInstance().getParser(resource);
        return parser.parseDescriptor(parserSettings, new URL(artifactFile.toURI().toASCIIString()), resource, options.isValidate());
    } catch (IOException e) {
        throw UncheckedException.throwAsUncheckedException(e);
    }
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:12,代码来源:AbstractRepositoryCacheManager.java

示例6: parseParentModuleOnFilesystem

import org.apache.ivy.plugins.parser.ModuleDescriptorParser; //导入方法依赖的package包/类
/**
 * Returns the parent module using the location attribute (for dev purpose).
 *
 * @param location
 *            a given location
 * @throws IOException if something goes wrong
 * @throws ParseException if something goes wrong
 */
private ModuleDescriptor parseParentModuleOnFilesystem(String location) throws IOException,
        ParseException {
    if (!"file".equals(descriptorURL.getProtocol())) {
        return null;
    }

    File file = new File(location);
    if (!file.isAbsolute()) {
        URL url = settings.getRelativeUrlResolver().getURL(descriptorURL, location);
        try {
            file = new File(new URI(url.toExternalForm()));
        } catch (URISyntaxException e) {
            file = new File(url.getPath());
        }
    }

    file = FileUtil.normalize(file.getAbsolutePath());
    if (!file.exists()) {
        Message.verbose("Parent module doesn't exist on the filesystem: "
                + file.getAbsolutePath());
        return null;
    }

    FileResource res = new FileResource(null, file);
    ModuleDescriptorParser parser = ModuleDescriptorParserRegistry.getInstance().getParser(
        res);
    return parser.parseDescriptor(getSettings(), file.toURI().toURL(), res, isValidate());
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:37,代码来源:XmlModuleDescriptorParser.java

示例7: findResourceUsingPattern

import org.apache.ivy.plugins.parser.ModuleDescriptorParser; //导入方法依赖的package包/类
@Override
protected ResolvedResource findResourceUsingPattern(ModuleRevisionId mrid, String pattern,
        Artifact artifact, ResourceMDParser rmdparser, Date date) {
    String name = getName();
    VersionMatcher versionMatcher = getSettings().getVersionMatcher();
    try {
        if (!versionMatcher.isDynamic(mrid) || isAlwaysCheckExactRevision()) {
            String resourceName = IvyPatternHelper.substitute(pattern, mrid, artifact);
            Message.debug("\t trying " + resourceName);
            logAttempt(resourceName);
            Resource res = repository.getResource(resourceName);
            boolean reachable = res.exists();
            if (reachable) {
                String revision;
                if (pattern.contains(IvyPatternHelper.REVISION_KEY)) {
                    revision = mrid.getRevision();
                } else {
                    if ("ivy".equals(artifact.getType()) || "pom".equals(artifact.getType())) {
                        // we can't determine the revision from the pattern, get it
                        // from the module descriptor itself
                        File temp = File.createTempFile("ivy", artifact.getExt());
                        temp.deleteOnExit();
                        repository.get(res.getName(), temp);
                        ModuleDescriptorParser parser = ModuleDescriptorParserRegistry
                                .getInstance().getParser(res);
                        ModuleDescriptor md = parser.parseDescriptor(getParserSettings(), temp
                                .toURI().toURL(), res, false);
                        revision = md.getRevision();
                        if (isNullOrEmpty(revision)) {
                            revision = "[email protected]" + name;
                        }
                    } else {
                        revision = "[email protected]" + name;
                    }
                }
                return new ResolvedResource(res, revision);
            } else if (versionMatcher.isDynamic(mrid)) {
                return findDynamicResourceUsingPattern(rmdparser, mrid, pattern, artifact, date);
            } else {
                Message.debug("\t" + name + ": resource not reachable for " + mrid + ": res="
                        + res);
                return null;
            }
        } else {
            return findDynamicResourceUsingPattern(rmdparser, mrid, pattern, artifact, date);
        }
    } catch (IOException | ParseException ex) {
        throw new RuntimeException(name + ": unable to get resource for " + mrid + ": res="
                + IvyPatternHelper.substitute(pattern, mrid, artifact) + ": " + ex, ex);
    }
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:52,代码来源:RepositoryResolver.java


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