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


Java ModuleDescriptor类代码示例

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


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

示例1: mergeWithOtherModuleDescriptor

import org.apache.ivy.core.module.descriptor.ModuleDescriptor; //导入依赖的package包/类
private void mergeWithOtherModuleDescriptor(List<String> extendTypes, ModuleDescriptor parent) {

            if (extendTypes.contains("all")) {
                mergeAll(parent);
            } else {
                if (extendTypes.contains("info")) {
                    mergeInfo(parent);
                }

                if (extendTypes.contains("configurations")) {
                    mergeConfigurations(parent.getModuleRevisionId(), parent.getConfigurations());
                }

                if (extendTypes.contains("dependencies")) {
                    mergeDependencies(parent.getDependencies());
                }

                if (extendTypes.contains("description")) {
                    mergeDescription(parent.getDescription());
                }
            }
        }
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:23,代码来源:IvyXmlModuleDescriptorParser.java

示例2: mergeInfo

import org.apache.ivy.core.module.descriptor.ModuleDescriptor; //导入依赖的package包/类
private void mergeInfo(ModuleDescriptor parent) {
    ModuleRevisionId parentMrid = parent.getModuleRevisionId();

    DefaultModuleDescriptor descriptor = getMd();
    ModuleRevisionId currentMrid = descriptor.getModuleRevisionId();

    ModuleRevisionId mergedMrid = createModuleRevisionId(
            mergeValue(parentMrid.getOrganisation(), currentMrid.getOrganisation()),
            currentMrid.getName(),
            mergeValue(parentMrid.getBranch(), currentMrid.getBranch()),
            mergeValue(parentMrid.getRevision(), currentMrid.getRevision()),
            mergeValues(parentMrid.getQualifiedExtraAttributes(), currentMrid.getQualifiedExtraAttributes())
    );

    descriptor.setModuleRevisionId(mergedMrid);
    descriptor.setResolvedModuleRevisionId(mergedMrid);

    descriptor.setStatus(mergeValue(parent.getStatus(), descriptor.getStatus()));
    if (descriptor.getNamespace() == null && parent instanceof DefaultModuleDescriptor) {
        Namespace parentNamespace = ((DefaultModuleDescriptor) parent).getNamespace();
        descriptor.setNamespace(parentNamespace);
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:24,代码来源:IvyXmlModuleDescriptorParser.java

示例3: forIvyModuleDescriptor

import org.apache.ivy.core.module.descriptor.ModuleDescriptor; //导入依赖的package包/类
public static ModuleDescriptorState forIvyModuleDescriptor(ModuleDescriptor ivyDescriptor) {
    ModuleRevisionId moduleRevisionId = ivyDescriptor.getModuleRevisionId();
    ModuleComponentIdentifier componentIdentifier = DefaultModuleComponentIdentifier.newId(moduleRevisionId.getOrganisation(), moduleRevisionId.getName(), moduleRevisionId.getRevision());
    MutableModuleDescriptorState state = new MutableModuleDescriptorState(componentIdentifier, ivyDescriptor.getStatus(), ivyDescriptor.isDefault());

    state.setBranch(moduleRevisionId.getBranch());
    state.setDescription(ivyDescriptor.getDescription());
    state.setPublicationDate(ivyDescriptor.getPublicationDate());
    Map<NamespaceId, String> extraInfo = Cast.uncheckedCast(ivyDescriptor.getExtraInfo());
    state.getExtraInfo().putAll(extraInfo);

    for (ExcludeRule excludeRule : ivyDescriptor.getAllExcludeRules()) {
        addExcludeRule(state, excludeRule);
    }

    return state;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:18,代码来源:IvyModuleDescriptorConverter.java

示例4: deployEffectivePom

import org.apache.ivy.core.module.descriptor.ModuleDescriptor; //导入依赖的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

示例5: publishIvyArtifacts

import org.apache.ivy.core.module.descriptor.ModuleDescriptor; //导入依赖的package包/类
private int publishIvyArtifacts(JkIvyPublication publication, Instant date,
        ModuleDescriptor moduleDescriptor) {
    int count = 0;
    for (final DependencyResolver resolver : IvyTranslations.publishResolverOf(this.ivy
            .getSettings())) {
        final JkPublishRepo publishRepo = this.publishRepos.getRepoHavingUrl(IvyTranslations
                .publishResolverUrl(resolver));
        final JkVersionedModule jkModule = IvyTranslations
                .toJkVersionedModule(moduleDescriptor.getModuleRevisionId());
        if (!isMaven(resolver) && publishRepo.filter().accept(jkModule)) {
            JkLog.startln("Publishing for repository " + resolver);
            this.publishIvyArtifacts(resolver, publication, date, moduleDescriptor);
            JkLog.done();
            count++;
        }
    }
    return count;
}
 
开发者ID:jerkar,项目名称:jerkar,代码行数:19,代码来源:IvyPublisher.java

示例6: createIvyFile

import org.apache.ivy.core.module.descriptor.ModuleDescriptor; //导入依赖的package包/类
private Path createIvyFile(ModuleDescriptor moduleDescriptor) {
    try {
        final ModuleRevisionId mrId = moduleDescriptor.getModuleRevisionId();
        final Path file;
        if (this.descriptorOutputDir != null) {
            file = this.descriptorOutputDir.toPath().resolve("published-ivy-" + mrId.getOrganisation()
            + "-" + mrId.getName() + "-" + mrId.getRevision() + ".xml");
        } else {
            file = JkUtilsPath.createTempFile("published-ivy-", ".xml");
        }
        moduleDescriptor.toIvyFile(file.toFile());
        return file;
    } catch (final IOException | ParseException e) {
        throw new RuntimeException(e);
    }

}
 
开发者ID:jerkar,项目名称:jerkar,代码行数:18,代码来源:IvyPublisher.java

示例7: resolveTargetConfigurations

import org.apache.ivy.core.module.descriptor.ModuleDescriptor; //导入依赖的package包/类
public Set<ConfigurationMetaData> resolveTargetConfigurations(DependencyMetaData dependencyMetaData, ConfigurationMetaData fromConfiguration, ComponentResolveMetaData targetComponent) {
    // TODO - resolve directly to config meta data
    ModuleDescriptor targetDescriptor = targetComponent.getDescriptor();
    DependencyDescriptor dependencyDescriptor = dependencyMetaData.getDescriptor();
    Set<String> targetConfigurationNames = new LinkedHashSet<String>();
    for (String config : dependencyDescriptor.getModuleConfigurations()) {
        if (config.equals("*") || config.equals("%")) {
            collectTargetConfiguration(dependencyDescriptor, fromConfiguration, fromConfiguration.getName(), targetDescriptor, targetConfigurationNames);
        } else if (fromConfiguration.getHierarchy().contains(config)) {
            collectTargetConfiguration(dependencyDescriptor, fromConfiguration, config, targetDescriptor, targetConfigurationNames);
        }
    }

    Set<ConfigurationMetaData> targets = new LinkedHashSet<ConfigurationMetaData>();
    for (String targetConfigurationName : targetConfigurationNames) {
        // TODO - move this down below
        if (targetDescriptor.getConfiguration(targetConfigurationName) == null) {
            throw new RuntimeException(String.format("Module version %s, configuration '%s' declares a dependency on configuration '%s' which is not declared in the module descriptor for %s",
                    fromConfiguration.getComponent().getId(), fromConfiguration.getName(),
                    targetConfigurationName, targetComponent.getId()));
        }
        ConfigurationMetaData targetConfiguration = targetComponent.getConfiguration(targetConfigurationName);
        targets.add(targetConfiguration);
    }
    return targets;
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:27,代码来源:DefaultDependencyToConfigurationResolver.java

示例8: collectTargetConfiguration

import org.apache.ivy.core.module.descriptor.ModuleDescriptor; //导入依赖的package包/类
private void collectTargetConfiguration(DependencyDescriptor dependencyDescriptor, ConfigurationMetaData fromConfiguration, String mappingRhs, ModuleDescriptor targetModule, Collection<String> targetConfigs) {
    String[] dependencyConfigurations = dependencyDescriptor.getDependencyConfigurations(mappingRhs, fromConfiguration.getName());
    for (String target : dependencyConfigurations) {
        String candidate = target;
        int startFallback = candidate.indexOf('(');
        if (startFallback >= 0) {
            if (candidate.charAt(candidate.length() - 1) == ')') {
                String preferred = candidate.substring(0, startFallback);
                if (targetModule.getConfiguration(preferred) != null) {
                    targetConfigs.add(preferred);
                    continue;
                }
                candidate = candidate.substring(startFallback + 1, candidate.length() - 1);
            }
        }
        if (candidate.equals("*")) {
            Collections.addAll(targetConfigs, targetModule.getPublicConfigurationsNames());
            continue;
        }
        targetConfigs.add(candidate);
    }
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:23,代码来源:DefaultDependencyToConfigurationResolver.java

示例9: createDependencyDescriptor

import org.apache.ivy.core.module.descriptor.ModuleDescriptor; //导入依赖的package包/类
public EnhancedDependencyDescriptor createDependencyDescriptor(String configuration, ModuleDependency dependency, ModuleDescriptor parent) {
    ModuleRevisionId moduleRevisionId = createModuleRevisionId(dependency);
    ClientModule clientModule = getClientModule(dependency);
    MutableModuleVersionMetaData moduleVersionMetaData = clientModuleMetaDataFactory.createModuleDescriptor(
            moduleRevisionId, clientModule.getDependencies());

    EnhancedDependencyDescriptor dependencyDescriptor = new ClientModuleDependencyDescriptor(
            clientModule,
            parent,
            moduleVersionMetaData,
            moduleRevisionId,
            clientModule.isForce(),
            false,
            clientModule.isTransitive());
    addExcludesArtifactsAndDependencies(configuration, clientModule, dependencyDescriptor);
    return dependencyDescriptor;
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:18,代码来源:ClientModuleIvyDependencyDescriptorFactory.java

示例10: resolveTargetConfigurations

import org.apache.ivy.core.module.descriptor.ModuleDescriptor; //导入依赖的package包/类
public Set<ConfigurationMetaData> resolveTargetConfigurations(DependencyMetaData dependencyMetaData, ConfigurationMetaData fromConfiguration, ComponentMetaData targetComponent) {
    // TODO - resolve directly to config meta data
    ModuleDescriptor targetDescriptor = targetComponent.getDescriptor();
    DependencyDescriptor dependencyDescriptor = dependencyMetaData.getDescriptor();
    Set<String> targetConfigurationNames = new LinkedHashSet<String>();
    for (String config : dependencyDescriptor.getModuleConfigurations()) {
        if (config.equals("*") || config.equals("%")) {
            collectTargetConfiguration(dependencyDescriptor, fromConfiguration, fromConfiguration.getName(), targetDescriptor, targetConfigurationNames);
        } else if (fromConfiguration.getHierarchy().contains(config)) {
            collectTargetConfiguration(dependencyDescriptor, fromConfiguration, config, targetDescriptor, targetConfigurationNames);
        }
    }

    Set<ConfigurationMetaData> targets = new LinkedHashSet<ConfigurationMetaData>();
    for (String targetConfigurationName : targetConfigurationNames) {
        // TODO - move this down below
        if (targetDescriptor.getConfiguration(targetConfigurationName) == null) {
            throw new RuntimeException(String.format("Module version %s, configuration '%s' declares a dependency on configuration '%s' which is not declared in the module descriptor for %s",
                    fromConfiguration.getComponent().getId(), fromConfiguration.getName(),
                    targetConfigurationName, targetComponent.getId()));
        }
        ConfigurationMetaData targetConfiguration = targetComponent.getConfiguration(targetConfigurationName);
        targets.add(targetConfiguration);
    }
    return targets;
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:27,代码来源:DefaultDependencyToConfigurationResolver.java

示例11: gatherInfoFromIvyFile

import org.apache.ivy.core.module.descriptor.ModuleDescriptor; //导入依赖的package包/类
private static MavenArtifactInfo gatherInfoFromIvyFile(File file) {
    MavenArtifactInfo result = null;
    try {
        IvyService ivyService = ContextHelper.get().beanForType(IvyService.class);
        ModuleDescriptor ivyDescriptor = ivyService.parseIvyFile(file);
        if (ivyDescriptor != null) {
            ModuleRevisionId ivyModule = ivyDescriptor.getModuleRevisionId();
            result = new MavenArtifactInfo();
            result.setGroupId(ivyModule.getOrganisation());
            result.setArtifactId(ivyModule.getName());
            result.setVersion(ivyModule.getRevision());
            result.setClassifier("ivy");
            result.setType(MavenArtifactInfo.XML);
        } else {
            log.debug("Failed to read ivy model from '{}'", file.getName());
        }
    } catch (Exception e) {
        log.debug("Failed to read ivy model from '{}'. Cause: {}.", file.getName(), e.getMessage());
    }
    return result;
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:22,代码来源:MavenModelUtils.java

示例12: testEjbType

import org.apache.ivy.core.module.descriptor.ModuleDescriptor; //导入依赖的package包/类
@Test
public void testEjbType() throws Exception {
    ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings,
        getClass().getResource("test-ejb-type.pom"), false);
    assertNotNull(md);

    ModuleRevisionId mrid = ModuleRevisionId.newInstance("org.apache", "test-ejb-type", "1.0");
    assertEquals(mrid, md.getModuleRevisionId());

    DependencyDescriptor[] deps = md.getDependencies();
    assertNotNull(deps);
    assertEquals(1, deps.length);

    DependencyArtifactDescriptor[] artifacts = deps[0].getAllDependencyArtifacts();
    assertNotNull(artifacts);
    assertEquals(1, artifacts.length);
    assertEquals("test", artifacts[0].getName());
    assertEquals("jar", artifacts[0].getExt());
    assertEquals("ejb", artifacts[0].getType());
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:21,代码来源:PomModuleDescriptorParserTest.java

示例13: testNoPublication

import org.apache.ivy.core.module.descriptor.ModuleDescriptor; //导入依赖的package包/类
@Test
public void testNoPublication() throws Exception {
    ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(settings,
        getClass().getResource("test-nopublication.xml"), true);
    assertNotNull(md);
    assertEquals("myorg", md.getModuleRevisionId().getOrganisation());
    assertEquals("mymodule", md.getModuleRevisionId().getName());
    assertEquals("myrev", md.getModuleRevisionId().getRevision());
    assertEquals("integration", md.getStatus());
    Date pubdate = new GregorianCalendar(2004, 10, 1, 11, 0, 0).getTime();
    assertEquals(pubdate, md.getPublicationDate());

    assertNotNull(md.getConfigurations());
    assertEquals(Collections.singletonList(new Configuration("default")),
        Arrays.asList(md.getConfigurations()));

    assertNotNull(md.getArtifacts("default"));
    assertEquals(1, md.getArtifacts("default").length);

    assertNotNull(md.getDependencies());
    assertEquals(1, md.getDependencies().length);
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:23,代码来源:XmlModuleDescriptorParserTest.java

示例14: testResolveWithExcludesArtifacts3

import org.apache.ivy.core.module.descriptor.ModuleDescriptor; //导入依赖的package包/类
@Test
public void testResolveWithExcludesArtifacts3() throws Exception {
    // mod2.3 depends on mod2.1 and excludes artifacts with exact matcher
    ResolveReport report = ivy.resolve(new File(
            "test/repositories/1/org2/mod2.3/ivys/ivy-0.6.3.xml"),
        getResolveOptions(new String[] {"*"}));
    assertNotNull(report);
    ModuleDescriptor md = report.getModuleDescriptor();
    assertNotNull(md);
    ModuleRevisionId mrid = ModuleRevisionId.newInstance("org2", "mod2.3", "0.6.3");
    assertEquals(mrid, md.getModuleRevisionId());

    assertTrue(getResolvedIvyFileInCache(mrid).exists());

    assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org2", "mod2.1", "0.3"))
            .exists());
    assertTrue(getArchiveFileInCache("org2", "mod2.1", "0.3", "art21A", "jar", "jar").exists());
    assertFalse(getArchiveFileInCache("org2", "mod2.1", "0.3", "art21B", "jar", "jar").exists());
    assertFalse(getArchiveFileInCache("org2", "mod2.1", "0.3", "mod2.1", "jar", "jar").exists());
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:21,代码来源:ResolveTest.java

示例15: processFilterNodeFromRoot

import org.apache.ivy.core.module.descriptor.ModuleDescriptor; //导入依赖的package包/类
/**
 * Adds the current node to the toKeep collection and then processes the each of the direct
 * dependencies of this node that appear in the moduleIdMap (indicating that the dependency is
 * part of this BuildList)
 *
 * @param node
 *            the node to be processed
 * @param toKeep
 *            the set of ModuleDescriptors that should be kept
 * @param moduleIdMap
 *            reference mapping of moduleId to ModuleDescriptor that are part of the BuildList
 */
private void processFilterNodeFromRoot(ModuleDescriptor node, Set<ModuleDescriptor> toKeep,
        Map<ModuleId, ModuleDescriptor> moduleIdMap) {
    // toKeep.add(node);
    for (DependencyDescriptor dep : node.getDependencies()) {
        ModuleId id = dep.getDependencyId();
        ModuleDescriptor md = moduleIdMap.get(id);
        // we test if this module id has a module descriptor, and if it isn't already in the
        // toKeep Set, in which there's probably a circular dependency
        if (md != null && !toKeep.contains(md)) {
            toKeep.add(md);
            if (!getOnlydirectdep()) {
                processFilterNodeFromRoot(md, toKeep, moduleIdMap);
            }
        }
    }
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:29,代码来源:IvyBuildList.java


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