本文整理汇总了Java中org.apache.ivy.core.module.id.ModuleRevisionId类的典型用法代码示例。如果您正苦于以下问题:Java ModuleRevisionId类的具体用法?Java ModuleRevisionId怎么用?Java ModuleRevisionId使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ModuleRevisionId类属于org.apache.ivy.core.module.id包,在下文中一共展示了ModuleRevisionId类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mergeInfo
import org.apache.ivy.core.module.id.ModuleRevisionId; //导入依赖的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);
}
}
示例2: forIvyModuleDescriptor
import org.apache.ivy.core.module.id.ModuleRevisionId; //导入依赖的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;
}
示例3: deployEffectivePom
import org.apache.ivy.core.module.id.ModuleRevisionId; //导入依赖的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 );
}
}
示例4: populateModuleDescriptorWithPublication
import org.apache.ivy.core.module.id.ModuleRevisionId; //导入依赖的package包/类
static void populateModuleDescriptorWithPublication(DefaultModuleDescriptor descriptor,
JkMavenPublication publication, Instant publishDate) {
final ModuleRevisionId moduleRevisionId = descriptor.getModuleRevisionId();
final String artifactName = moduleRevisionId.getName();
final Artifact mavenMainArtifact = toPublishedMavenArtifact(publication.mainArtifactFiles()
.get(0), artifactName, null, moduleRevisionId, publishDate);
final String mainConf = "default";
populateDescriptorWithMavenArtifact(descriptor, mainConf, mavenMainArtifact);
for (final JkClassifiedFileArtifact artifactEntry : publication.classifiedArtifacts()) {
final Path file = artifactEntry.file();
final String classifier = artifactEntry.classifier();
final Artifact mavenArtifact = toPublishedMavenArtifact(file, artifactName, classifier,
descriptor.getModuleRevisionId(), publishDate);
populateDescriptorWithMavenArtifact(descriptor, classifier, mavenArtifact);
}
}
示例5: createIvyFile
import org.apache.ivy.core.module.id.ModuleRevisionId; //导入依赖的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);
}
}
示例6: setModuleRevId
import org.apache.ivy.core.module.id.ModuleRevisionId; //导入依赖的package包/类
public void setModuleRevId(String group, String module, String version) {
String effectiveVersion = version;
if (version != null) {
Matcher matcher = TIMESTAMP_PATTERN.matcher(version);
if (matcher.matches()) {
effectiveVersion = matcher.group(1) + "-SNAPSHOT";
}
}
this.mrid = ModuleRevisionId.newInstance(group, module, effectiveVersion);
ivyModuleDescriptor.setModuleRevisionId(mrid);
if (effectiveVersion != null && effectiveVersion.endsWith("SNAPSHOT")) {
ivyModuleDescriptor.setStatus("integration");
} else {
ivyModuleDescriptor.setStatus("release");
}
}
示例7: create
import org.apache.ivy.core.module.id.ModuleRevisionId; //导入依赖的package包/类
public DependencyDescriptor create(DependencyDescriptor source, ModuleRevisionId targetId) {
if (!(source instanceof DefaultDependencyDescriptor)) {
throw new IllegalArgumentException("I can only create descriptors out of DefaultDependencyDescriptor");
}
DefaultDependencyDescriptor out = new DefaultDependencyDescriptor(moduleDescriptor(source), targetId, source.getDynamicConstraintDependencyRevisionId(), source.isForce(), source.isChanging(), source.isTransitive());
setProperty(out, "parentId", getProperty(source, "parentId"));
setProperty(out, "namespace", source.getNamespace());
((Map) getProperty(out, "confs")).putAll((Map) getProperty(source, "confs"));
Map sourceExcludeRules = (Map) getProperty(source, "excludeRules");
setProperty(out, "excludeRules", sourceExcludeRules == null? null: new LinkedHashMap(sourceExcludeRules));
Map sourceIncludeRules = (Map) getProperty(source, "includeRules");
setProperty(out, "includeRules", sourceIncludeRules == null ? null : new LinkedHashMap(sourceIncludeRules));
Map dependencyArtifacts = (Map) getProperty(source, "dependencyArtifacts");
setProperty(out, "dependencyArtifacts", dependencyArtifacts == null? null: new LinkedHashMap(dependencyArtifacts));
setProperty(out, "sourceModule", source.getSourceModule());
return out;
}
示例8: publish
import org.apache.ivy.core.module.id.ModuleRevisionId; //导入依赖的package包/类
public void publish(IvyNormalizedPublication publication, PublicationAwareRepository repository) {
ModuleVersionPublisher publisher = repository.createPublisher();
IvyPublicationIdentity projectIdentity = publication.getProjectIdentity();
ModuleRevisionId moduleRevisionId = IvyUtil.createModuleRevisionId(projectIdentity.getOrganisation(), projectIdentity.getModule(), projectIdentity.getRevision());
ModuleVersionIdentifier moduleVersionIdentifier = DefaultModuleVersionIdentifier.newId(moduleRevisionId);
DefaultIvyModulePublishMetaData publishMetaData = new DefaultIvyModulePublishMetaData(moduleVersionIdentifier);
try {
for (IvyArtifact publishArtifact : publication.getArtifacts()) {
Artifact ivyArtifact = createIvyArtifact(publishArtifact, moduleRevisionId);
publishMetaData.addArtifact(ivyArtifact, publishArtifact.getFile());
}
Artifact artifact = DefaultArtifact.newIvyArtifact(moduleRevisionId, null);
publishMetaData.addArtifact(artifact, publication.getDescriptorFile());
publisher.publish(publishMetaData);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
示例9: publish
import org.apache.ivy.core.module.id.ModuleRevisionId; //导入依赖的package包/类
public void publish(ModuleVersionPublishMetaData moduleVersion) throws IOException {
boolean successfullyPublished = false;
try {
ModuleVersionIdentifier id = moduleVersion.getId();
ModuleRevisionId ivyId = IvyUtil.createModuleRevisionId(id.getGroup(), id.getName(), id.getVersion());
resolver.beginPublishTransaction(ivyId, true);
for (ModuleVersionArtifactPublishMetaData artifactMetaData : moduleVersion.getArtifacts()) {
Artifact artifact = artifactMetaData.toIvyArtifact();
File artifactFile = artifactMetaData.getFile();
resolver.publish(artifact, artifactFile, true);
}
resolver.commitPublishTransaction();
successfullyPublished = true;
} finally {
if (!successfullyPublished) {
resolver.abortPublishTransaction();
}
}
}
示例10: getDependency
import org.apache.ivy.core.module.id.ModuleRevisionId; //导入依赖的package包/类
public void getDependency(DependencyMetaData dependency, BuildableModuleVersionMetaDataResolveResult result) {
DependencyMetaData forced = dependency.withChanging();
delegate.getDependency(forced, result);
switch (result.getState()) {
case Missing:
ModuleRevisionId dependencyRevisionId = dependency.getDescriptor().getDependencyRevisionId();
ModuleVersionIdentifier moduleVersionIdentifier = DefaultModuleVersionIdentifier.newId(dependencyRevisionId);
moduleMetaDataCache.cacheMissing(delegate, moduleVersionIdentifier);
break;
case Resolved:
MutableModuleVersionMetaData metaData = result.getMetaData();
ModuleSource moduleSource = result.getModuleSource();
ModuleMetaDataCache.CachedMetaData cachedMetaData = moduleMetaDataCache.cacheMetaData(delegate, metaData, moduleSource);
metadataProcessor.process(metaData);
result.setModuleSource(new CachingModuleSource(cachedMetaData.getDescriptorHash(), dependency.isChanging() || metaData.isChanging(), moduleSource));
break;
case Failed:
break;
default:
throw new IllegalStateException("Unexpected resolve state: " + result.getState());
}
}
示例11: createIvyArtifact
import org.apache.ivy.core.module.id.ModuleRevisionId; //导入依赖的package包/类
public Artifact createIvyArtifact(PublishArtifact publishArtifact, ModuleRevisionId moduleRevisionId) {
Map<String, String> extraAttributes = new HashMap<String, String>();
if (GUtil.isTrue(publishArtifact.getClassifier())) {
extraAttributes.put(Dependency.CLASSIFIER, publishArtifact.getClassifier());
}
String name = publishArtifact.getName();
if (!GUtil.isTrue(name)) {
name = moduleRevisionId.getName();
}
return new DefaultArtifact(
moduleRevisionId,
publishArtifact.getDate(),
name,
publishArtifact.getType(),
publishArtifact.getExtension(),
extraAttributes);
}
示例12: createDependencyDescriptor
import org.apache.ivy.core.module.id.ModuleRevisionId; //导入依赖的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;
}
示例13: gatherInfoFromIvyFile
import org.apache.ivy.core.module.id.ModuleRevisionId; //导入依赖的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;
}
示例14: findUniqueSnapshotVersion
import org.apache.ivy.core.module.id.ModuleRevisionId; //导入依赖的package包/类
private TimestampedModuleSource findUniqueSnapshotVersion(ModuleRevisionId moduleRevisionId) {
ModuleVersionIdentifier moduleVersionIdentifier = DefaultModuleVersionIdentifier.newId(moduleRevisionId);
ModuleVersionArtifactIdentifier artifactId = new DefaultModuleVersionArtifactIdentifier(moduleVersionIdentifier, moduleVersionIdentifier.getName(), "pom", "pom");
DefaultModuleVersionArtifactMetaData pomArtifact = new DefaultModuleVersionArtifactMetaData(artifactId);
String metadataLocation = toResourcePattern(getWholePattern()).toModuleVersionPath(pomArtifact) + "/maven-metadata.xml";
MavenMetadata mavenMetadata = parseMavenMetadata(metadataLocation);
if (mavenMetadata.timestamp != null) {
// we have found a timestamp, so this is a snapshot unique version
String rev = moduleRevisionId.getRevision();
rev = rev.substring(0, rev.length() - "SNAPSHOT".length());
rev = rev + mavenMetadata.timestamp + "-" + mavenMetadata.buildNumber;
return new TimestampedModuleSource(rev);
}
return null;
}
示例15: publish
import org.apache.ivy.core.module.id.ModuleRevisionId; //导入依赖的package包/类
public void publish(IvyNormalizedPublication publication, PublicationAwareRepository repository) {
ModuleVersionPublisher publisher = repository.createPublisher();
IvyPublicationIdentity projectIdentity = publication.getProjectIdentity();
ModuleRevisionId moduleRevisionId = IvyUtil.createModuleRevisionId(projectIdentity.getOrganisation(), projectIdentity.getModule(), projectIdentity.getRevision());
ModuleVersionIdentifier moduleVersionIdentifier = DefaultModuleVersionIdentifier.newId(moduleRevisionId);
DefaultModuleVersionPublishMetaData publishMetaData = new DefaultModuleVersionPublishMetaData(moduleVersionIdentifier);
try {
for (IvyArtifact publishArtifact : publication.getArtifacts()) {
Artifact ivyArtifact = createIvyArtifact(publishArtifact, moduleRevisionId);
publishMetaData.addArtifact(ivyArtifact, publishArtifact.getFile());
}
Artifact artifact = DefaultArtifact.newIvyArtifact(moduleRevisionId, null);
publishMetaData.addArtifact(artifact, publication.getDescriptorFile());
publisher.publish(publishMetaData);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}