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


Java DefaultModuleDescriptor.addConfiguration方法代码示例

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


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

示例1: testTransitiveAttributeForNonTransitiveConfs

import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor; //导入方法依赖的package包/类
/**
 * Test that the transitive attribute is written for non-transitive configurations.
 *
 * <code>&lt;conf ... transitive="false" ... /&gt;</code>
 *
 * @throws Exception if something goes wrong
 * @see <a href="https://issues.apache.org/jira/browse/IVY-1207">IVY-1207</a>
 */
@Test
public void testTransitiveAttributeForNonTransitiveConfs() throws Exception {
    // Given a ModuleDescriptor with a non-transitive configuration
    DefaultModuleDescriptor md = new DefaultModuleDescriptor(new ModuleRevisionId(new ModuleId(
            "myorg", "myname"), "1.0"), "integration", new Date());
    Configuration conf = new Configuration("conf", PUBLIC, "desc", null, false, null);
    md.addConfiguration(conf);

    // When the ModuleDescriptor is written
    XmlModuleDescriptorWriter.write(md, LICENSE, dest);

    // Then the transitive attribute must be set to false
    String output = FileUtil.readEntirely(dest);
    String writtenConf = output.substring(output.indexOf("<configurations>") + 16,
        output.indexOf("</configurations>")).trim();
    assertTrue("Transitive attribute not set to false: " + writtenConf,
            writtenConf.contains("transitive=\"false\""));
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:27,代码来源:XmlModuleDescriptorWriterTest.java

示例2: testTransitiveAttributeNotWrittenForTransitiveConfs

import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor; //导入方法依赖的package包/类
/**
 * Test that the transitive attribute is not written when the configuration IS transitive.
 *
 * This is the default and writing it will only add noise and cause a deviation from the known
 * behavior (before fixing IVY-1207).
 *
 * @throws Exception if something goes wrong
 * @see <a href="https://issues.apache.org/jira/browse/IVY-1207">IVY-1207</a>
 */
@Test
public void testTransitiveAttributeNotWrittenForTransitiveConfs() throws Exception {
    // Given a ModuleDescriptor with a transitive configuration
    DefaultModuleDescriptor md = new DefaultModuleDescriptor(new ModuleRevisionId(new ModuleId(
            "myorg", "myname"), "1.0"), "integration", new Date());
    Configuration conf = new Configuration("conf", PUBLIC, "desc", null, true, null);
    md.addConfiguration(conf);

    // When the ModuleDescriptor is written
    XmlModuleDescriptorWriter.write(md, LICENSE, dest);

    // Then the transitive attribute must NOT be written
    String output = FileUtil.readEntirely(dest);
    String writtenConf = output.substring(output.indexOf("<configurations>") + 16,
        output.indexOf("</configurations>")).trim();
    assertFalse("Transitive attribute set: " + writtenConf,
            writtenConf.contains("transitive="));
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:28,代码来源:XmlModuleDescriptorWriterTest.java

示例3: mergeConfigurations

import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor; //导入方法依赖的package包/类
private void mergeConfigurations(ModuleRevisionId sourceMrid, Configuration[] configurations) {
    DefaultModuleDescriptor md = getMd();
    for (Configuration configuration : configurations) {
        LOGGER.debug("Merging configuration with: {}", configuration.getName());
        //copy configuration from parent descriptor
        md.addConfiguration(new Configuration(configuration, sourceMrid));
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:9,代码来源:IvyXmlModuleDescriptorParser.java

示例4: populateDescriptorWithMavenArtifact

import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor; //导入方法依赖的package包/类
private static void populateDescriptorWithMavenArtifact(DefaultModuleDescriptor descriptor,
        String conf, Artifact artifact) {
    if (descriptor.getConfiguration(conf) == null) {
        descriptor.addConfiguration(new Configuration(conf));
    }
    descriptor.addArtifact(conf, artifact);
    descriptor.addExtraAttributeNamespace(EXTRA_PREFIX, EXTRA_NAMESPACE);
}
 
开发者ID:jerkar,项目名称:jerkar,代码行数:9,代码来源:IvyTranslations.java

示例5: createModuleDescriptor

import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor; //导入方法依赖的package包/类
public MutableModuleVersionMetaData createModuleDescriptor(ModuleRevisionId moduleRevisionId, Set<ModuleDependency> dependencies) {
    DefaultModuleDescriptor moduleDescriptor = new DefaultModuleDescriptor(moduleRevisionId,
            "release", null);
    moduleDescriptor.addConfiguration(new Configuration(Dependency.DEFAULT_CONFIGURATION));
    addDependencyDescriptors(moduleDescriptor, dependencies, dependencyDescriptorFactory);
    moduleDescriptor.addArtifact(Dependency.DEFAULT_CONFIGURATION,
            new DefaultArtifact(moduleRevisionId, null, moduleRevisionId.getName(), "jar", "jar"));
    return new ModuleDescriptorAdapter(moduleDescriptor);
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:10,代码来源:DefaultClientModuleMetaDataFactory.java

示例6: buildResolvedCapabilityMd

import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor; //导入方法依赖的package包/类
private MDResolvedResource buildResolvedCapabilityMd(DependencyDescriptor dd,
        ModuleDescriptor md) {
    String org = dd.getDependencyRevisionId().getOrganisation();
    String name = dd.getDependencyRevisionId().getName();
    String rev = md.getExtraInfoContentByTagName(BundleInfoAdapter.EXTRA_INFO_EXPORT_PREFIX
            + name);
    ModuleRevisionId capabilityRev = ModuleRevisionId.newInstance(org, name, rev,
        Collections.singletonMap(CAPABILITY_EXTRA_ATTR, md.getModuleRevisionId().toString()));

    DefaultModuleDescriptor capabilityMd = new DefaultModuleDescriptor(capabilityRev,
            getSettings().getStatusManager().getDefaultStatus(), new Date());

    String useConf = BundleInfoAdapter.CONF_USE_PREFIX + dd.getDependencyRevisionId().getName();

    capabilityMd.addConfiguration(BundleInfoAdapter.CONF_DEFAULT);
    capabilityMd.addConfiguration(BundleInfoAdapter.CONF_OPTIONAL);
    capabilityMd.addConfiguration(BundleInfoAdapter.CONF_TRANSITIVE_OPTIONAL);
    capabilityMd.addConfiguration(new Configuration(useConf));

    DefaultDependencyDescriptor capabilityDD = new DefaultDependencyDescriptor(
            md.getModuleRevisionId(), false);
    capabilityDD.addDependencyConfiguration(BundleInfoAdapter.CONF_NAME_DEFAULT,
        BundleInfoAdapter.CONF_NAME_DEFAULT);
    capabilityDD.addDependencyConfiguration(BundleInfoAdapter.CONF_NAME_OPTIONAL,
        BundleInfoAdapter.CONF_NAME_OPTIONAL);
    capabilityDD.addDependencyConfiguration(BundleInfoAdapter.CONF_NAME_TRANSITIVE_OPTIONAL,
        BundleInfoAdapter.CONF_NAME_TRANSITIVE_OPTIONAL);
    capabilityDD.addDependencyConfiguration(useConf, useConf);
    capabilityMd.addDependency(capabilityDD);

    MetadataArtifactDownloadReport report = new MetadataArtifactDownloadReport(null);
    report.setDownloadStatus(DownloadStatus.NO);
    report.setSearched(true);
    ResolvedModuleRevision rmr = new ResolvedModuleRevision(this, this, capabilityMd, report);
    return new MDResolvedResource(null, capabilityMd.getRevision(), rmr);
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:37,代码来源:AbstractOSGiResolver.java

示例7: requirementAsDependency

import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor; //导入方法依赖的package包/类
private static void requirementAsDependency(DefaultModuleDescriptor md, BundleInfo bundleInfo,
        Set<String> exportedPkgNames) {
    for (BundleRequirement requirement : bundleInfo.getRequirements()) {
        String type = requirement.getType();
        String name = requirement.getName();

        if (BundleInfo.PACKAGE_TYPE.equals(type) && exportedPkgNames.contains(name)) {
            // don't declare package exported by the current bundle
            continue;
        }

        if (BundleInfo.EXECUTION_ENVIRONMENT_TYPE.equals(type)) {
            // execution environment are handled elsewhere
            continue;
        }

        ModuleRevisionId ddmrid = asMrid(type, name, requirement.getVersion());
        DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(ddmrid, false);

        String conf = CONF_NAME_DEFAULT;
        if (BundleInfo.PACKAGE_TYPE.equals(type)) {
            // declare the configuration for the package
            conf = CONF_USE_PREFIX + name;
            md.addConfiguration(new Configuration(CONF_USE_PREFIX + name, PUBLIC,
                    "Exported package " + name, new String[] {CONF_NAME_DEFAULT}, true, null));
            dd.addDependencyConfiguration(conf, conf);
        }

        if ("optional".equals(requirement.getResolution())) {
            dd.addDependencyConfiguration(CONF_NAME_OPTIONAL, conf);
            dd.addDependencyConfiguration(CONF_NAME_TRANSITIVE_OPTIONAL,
                CONF_NAME_TRANSITIVE_OPTIONAL);
        } else {
            dd.addDependencyConfiguration(CONF_NAME_DEFAULT, conf);
        }

        md.addDependency(dd);
    }

}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:41,代码来源:BundleInfoAdapter.java

示例8: cloneMd

import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor; //导入方法依赖的package包/类
private DefaultModuleDescriptor cloneMd(ModuleDescriptor md, Artifact af) {

        DefaultModuleDescriptor newMd = new DefaultModuleDescriptor(md.getModuleRevisionId(),
                "release", null, true);
        newMd.addConfiguration(new Configuration(ModuleDescriptor.DEFAULT_CONFIGURATION));
        newMd.setLastModified(System.currentTimeMillis());

        newMd.setDescription(md.getDescription());
        newMd.setHomePage(md.getHomePage());
        newMd.setLastModified(md.getLastModified());
        newMd.setPublicationDate(md.getPublicationDate());
        newMd.setResolvedPublicationDate(md.getResolvedPublicationDate());
        newMd.setStatus(md.getStatus());

        Configuration[] allConfs = md.getConfigurations();
        if (allConfs.length == 0) {
            newMd.addArtifact(ModuleDescriptor.DEFAULT_CONFIGURATION, af);
        } else {
            for (Configuration conf : allConfs) {
                newMd.addConfiguration(conf);
                newMd.addArtifact(conf.getName(), af);
            }
        }

        for (DependencyDescriptor dependency : md.getDependencies()) {
            newMd.addDependency(dependency);
        }

        for (ExcludeRule excludeRule : md.getAllExcludeRules()) {
            newMd.addExcludeRule(excludeRule);
        }

        newMd.getExtraInfos().addAll(md.getExtraInfos());

        for (License license : md.getLicenses()) {
            newMd.addLicense(license);
        }

        return newMd;
    }
 
开发者ID:apache,项目名称:ant-ivyde,代码行数:41,代码来源:WorkspaceResolver.java

示例9: addConfigurations

import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor; //导入方法依赖的package包/类
public void addConfigurations(DefaultModuleDescriptor moduleDescriptor, Iterable<? extends Configuration> configurations) {
    for (Configuration configuration : configurations) {
        moduleDescriptor.addConfiguration(getIvyConfiguration(configuration));
    }
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:6,代码来源:DefaultConfigurationsToModuleDescriptorConverter.java

示例10: resolveComponentMetaData

import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor; //导入方法依赖的package包/类
@Override
public void resolveComponentMetaData(ModuleComponentIdentifier moduleComponentIdentifier, ComponentOverrideMetadata requestMetaData,
		BuildableModuleComponentMetaDataResolveResult result) {
	LOG.trace("resolveComponentMetaData");
	try {
		ModuleId moduleId = new ModuleId(moduleComponentIdentifier.getGroup(), moduleComponentIdentifier.getModule());
		String revision = moduleComponentIdentifier.getVersion();
		ModuleRevisionId id = new ModuleRevisionId(moduleId, revision);
		String status = "release";
		Date pubDate = null;
		String config = "default";
		LOG.trace("configuration {}", config);
		String artifactId = moduleComponentIdentifier.getModule();
		String gradleVersionRangeString = moduleComponentIdentifier.getVersion();
		String osgiVersionRangeString = gradleToOsgiVersion(gradleVersionRangeString);

		URI fileUri = this.fetchArtifact(artifactId, osgiVersionRangeString);

		try (JarFile bundle = new JarFile(new File(fileUri))) {
			DefaultModuleDescriptor moduleDescriptor = new DefaultModuleDescriptor(id, status, pubDate);
			moduleDescriptor.addConfiguration(new Configuration(config));
			this.addArtifact(moduleDescriptor, moduleComponentIdentifier.getModule(), "jar", "jar", Collections.<String, String> emptyMap(), config);
			this.addDependencies(moduleDescriptor, moduleComponentIdentifier.getGroup(), bundle.getManifest());
			LOG.trace("Status {}", moduleDescriptor.getStatus());
			P2ModuleResolveMetaData metaData = new P2ModuleResolveMetaData(moduleDescriptor);

			metaData.setArtifacts(Arrays.asList( metaData.artifact("jar", "jar", null)) );
			ModuleSource source = new P2ModuleSource();
			metaData.setSource(source);


			LOG.info("Resolved {} to {}", artifactId, fileUri);
			if (null != fileUri) {
				result.attempted(this.getRepositoryUri().toString());

				result.resolved(metaData);

				if (!result.hasResult()) {
					result.failed(new ModuleVersionResolveException(metaData.getComponentId(),
							String.format("Cannot locate %s for '%s' in repository '%s'", "jar", artifactId, this.getRepositoryUri())));
				}
			}

			LOG.trace("result.getState() {}", result.getState());
			LOG.trace("resolveComponentMetaData - resolved");
		}
	} catch (Throwable e) {
		LOG.error("Cannont resolveComponentMetaData for "+moduleComponentIdentifier.getModule()+":"+moduleComponentIdentifier.getVersion(), e);
		result.attempted(this.getRepositoryUri().toString());
		result.failed(new ModuleVersionResolveException(moduleComponentIdentifier,
						"Cannont resolveComponentMetaData for "+moduleComponentIdentifier.getModule()+":"+moduleComponentIdentifier.getVersion()));
	}

	LOG.trace("resolveComponentMetaData - end");
}
 
开发者ID:dhakehurst,项目名称:net.akehurst.build.gradle,代码行数:56,代码来源:AbstractP2RepositoryAccess.java

示例11: doExecute

import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor; //导入方法依赖的package包/类
public void doExecute() throws BuildException {
    prepareAndCheck();

    ModuleDescriptor originalModuleDescriptor = getResolvedReport().getModuleDescriptor();
    // clone module descriptor
    DefaultModuleDescriptor latestModuleDescriptor = new DefaultModuleDescriptor(
            originalModuleDescriptor.getModuleRevisionId(),
            originalModuleDescriptor.getStatus(), originalModuleDescriptor.getPublicationDate());
    // copy configurations
    for (Configuration configuration : originalModuleDescriptor.getConfigurations()) {
        latestModuleDescriptor.addConfiguration(configuration);
    }
    // clone dependency and add new one with the requested revisionToCheck
    for (DependencyDescriptor dependencyDescriptor : originalModuleDescriptor.getDependencies()) {
        ModuleRevisionId upToDateMrid = ModuleRevisionId.newInstance(
            dependencyDescriptor.getDependencyRevisionId(), revisionToCheck);
        latestModuleDescriptor.addDependency(dependencyDescriptor.clone(upToDateMrid));
    }

    // resolve
    ResolveOptions resolveOptions = new ResolveOptions();
    resolveOptions.setDownload(isDownload());
    resolveOptions.setLog(getLog());
    resolveOptions.setConfs(splitToArray(getConf()));
    resolveOptions.setCheckIfChanged(checkIfChanged);

    ResolveReport latestReport;
    try {
        latestReport = getIvyInstance().getResolveEngine().resolve(latestModuleDescriptor,
            resolveOptions);

        displayDependencyUpdates(getResolvedReport(), latestReport);
        if (showTransitive) {
            displayNewDependencyOnLatest(getResolvedReport(), latestReport);
            displayMissingDependencyOnLatest(getResolvedReport(), latestReport);
        }

    } catch (ParseException | IOException e) {
        throw new BuildException("impossible to resolve dependencies:\n\t" + e, e);
    }

}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:43,代码来源:IvyDependencyUpdateChecker.java

示例12: doExecute

import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor; //导入方法依赖的package包/类
@Override
public void doExecute() throws BuildException {
    prepareAndCheck();
    DefaultModuleDescriptor md = (DefaultModuleDescriptor) getResolvedReport().getModuleDescriptor();

    // this is a published artifact
    String artName = getSettings().substitute(getName());
    artName = artName == null ? md.getModuleRevisionId().getName() : artName;
    String artType = getSettings().substitute(getType());
    artType = artType == null ? "jar" : artType;
    String artExt = getSettings().substitute(getExt());
    artExt = artExt != null ? artExt : artType;
    Map<String, String> extraAttributes = new HashMap<String, String>();
    if (getClassifier() != null) {
        md.addExtraAttributeNamespace("m", "http://ant.apache.org/ivy/maven");
        extraAttributes.put("m:classifier", getClassifier());
    }
    MDArtifact artifact = new MDArtifact(md, artName, artType, artExt, null, extraAttributes);
    String[] configurations = getConfs().split(",");
    for (String configuration : configurations) {
        if ("*".equals(configuration)) {
            String[] declaredConfs = md.getConfigurationsNames();
            for (String declaredConf : declaredConfs) {
                artifact.addConfiguration(declaredConf);
                md.addArtifact(declaredConf, artifact);
            }
        } else {
            // create configuration if it doesn't exist
            if (md.getConfiguration(configuration) == null) {
                Configuration generatedConfiguration = new Configuration(configuration);
                md.addConfiguration(generatedConfiguration);
            }
            artifact.addConfiguration(configuration);
            md.addArtifact(configuration, artifact);
        }
    }

    ResolutionCacheManager cacheManager = getSettings().getResolutionCacheManager();
    File ivyFileInCache = cacheManager.getResolvedIvyFileInCache(md.getResolvedModuleRevisionId());
    try {
        XmlModuleDescriptorWriter.write(md, ivyFileInCache);
    } catch (IOException e) {
        throw new BuildException("Can't register specified artifact", e);
    }

}
 
开发者ID:apache,项目名称:ant-easyant-core,代码行数:47,代码来源:RegisterArtifact.java


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