本文整理汇总了Java中org.apache.ivy.core.module.descriptor.Artifact.getModuleRevisionId方法的典型用法代码示例。如果您正苦于以下问题:Java Artifact.getModuleRevisionId方法的具体用法?Java Artifact.getModuleRevisionId怎么用?Java Artifact.getModuleRevisionId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ivy.core.module.descriptor.Artifact
的用法示例。
在下文中一共展示了Artifact.getModuleRevisionId方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findArtifactRef
import org.apache.ivy.core.module.descriptor.Artifact; //导入方法依赖的package包/类
@Override
public ResolvedResource findArtifactRef(Artifact artifact, Date date) {
ensureConfigured(getSettings());
ModuleRevisionId mrid = artifact.getModuleRevisionId();
if (isM2compatible()) {
mrid = convertM2IdForResourceSearch(mrid);
}
final String revision = artifact.getId().getRevision();
final MavenTimedSnapshotVersionMatcher.MavenSnapshotRevision snapshotRevision = MavenTimedSnapshotVersionMatcher.computeIfSnapshot(revision);
if (snapshotRevision != null) {
final ResolvedResource rres = findSnapshotArtifact(artifact, date, mrid, snapshotRevision);
if (rres != null) {
return rres;
}
}
return findResourceUsingPatterns(mrid, getArtifactPatterns(), artifact,
getDefaultRMDParser(artifact.getModuleRevisionId().getModuleId()), date);
}
示例2: publish
import org.apache.ivy.core.module.descriptor.Artifact; //导入方法依赖的package包/类
public void publish(Artifact artifact, File src, boolean overwrite) throws IOException {
String destPattern;
if ("ivy".equals(artifact.getType()) && !getIvyPatterns().isEmpty()) {
destPattern = getIvyPatterns().get(0);
} else if (!getArtifactPatterns().isEmpty()) {
destPattern = getArtifactPatterns().get(0);
} else {
throw new IllegalStateException("impossible to publish " + artifact + " using " + this
+ ": no artifact pattern defined");
}
// Check for m2 compatibility
ModuleRevisionId mrid = artifact.getModuleRevisionId();
if (isM2compatible()) {
mrid = convertM2IdForResourceSearch(mrid);
}
String dest = getDestination(destPattern, artifact, mrid);
put(artifact, src, dest, overwrite);
Message.info("\tpublished " + artifact.getName() + " to "
+ hidePassword(repository.standardize(dest)));
}
示例3: findArtifactRef
import org.apache.ivy.core.module.descriptor.Artifact; //导入方法依赖的package包/类
@Override
public ResolvedResource findArtifactRef(Artifact artifact, Date date) {
ModuleRevisionId mrid = artifact.getModuleRevisionId();
if (isM2compatible()) {
mrid = convertM2IdForResourceSearch(mrid);
}
return findResourceUsingPatterns(mrid, artifactPatterns, artifact,
getDefaultRMDParser(artifact.getModuleRevisionId().getModuleId()), date);
}
示例4: withExtension
import org.apache.ivy.core.module.descriptor.Artifact; //导入方法依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
private static Artifact withExtension(Artifact ar, String ext) {
return new DefaultArtifact(ar.getModuleRevisionId(), ar.getPublicationDate(), ar.getName(),
ar.getType(), ext, ar.getUrl(), new HashMap(ar.getExtraAttributes()));
}
示例5: download
import org.apache.ivy.core.module.descriptor.Artifact; //导入方法依赖的package包/类
public EnhancedArtifactDownloadReport download(Artifact artifact, ArtifactResourceResolver resourceResolver,
ResourceDownloader resourceDownloader, CacheDownloadOptions options) {
EnhancedArtifactDownloadReport adr = new EnhancedArtifactDownloadReport(artifact);
DownloadListener listener = options.getListener();
if (listener != null) {
listener.needArtifact(this, artifact);
}
long start = System.currentTimeMillis();
try {
ResolvedResource artifactRef = resourceResolver.resolve(artifact);
if (artifactRef != null) {
final Resource resource = artifactRef.getResource();
ArtifactOrigin origin = new ArtifactOrigin(artifact, resource.isLocal(), resource.getName());
if (listener != null) {
listener.startArtifactDownload(this, artifactRef, artifact, origin);
}
ModuleRevisionId moduleRevisionId = artifact.getModuleRevisionId();
ModuleComponentIdentifier componentIdentifier = DefaultModuleComponentIdentifier.newId(moduleRevisionId.getOrganisation(), moduleRevisionId.getName(), moduleRevisionId.getRevision());
File artifactFile = downloadAndCacheArtifactFile(new DefaultModuleVersionArtifactMetaData(componentIdentifier, artifact), artifact, resourceDownloader, artifactRef.getResource());
adr.setDownloadTimeMillis(System.currentTimeMillis() - start);
adr.setSize(artifactFile.length());
adr.setDownloadStatus(DownloadStatus.SUCCESSFUL);
adr.setArtifactOrigin(origin);
adr.setLocalFile(artifactFile);
} else {
adr.setDownloadTimeMillis(System.currentTimeMillis() - start);
adr.setDownloadStatus(DownloadStatus.FAILED);
adr.setDownloadDetails(ArtifactDownloadReport.MISSING_ARTIFACT);
}
} catch (Throwable throwable) {
adr.setDownloadTimeMillis(System.currentTimeMillis() - start);
adr.failed(throwable);
}
if (listener != null) {
listener.endArtifactDownload(this, artifact, adr, adr.getLocalFile());
}
return adr;
}
示例6: buildIvyURI
import org.apache.ivy.core.module.descriptor.Artifact; //导入方法依赖的package包/类
public static URI buildIvyURI(Artifact artifact) {
ModuleRevisionId mrid = artifact.getModuleRevisionId();
return asIvyURI(mrid.getOrganisation(), mrid.getName(), mrid.getBranch(),
mrid.getRevision(), artifact.getType(), artifact.getName(), artifact.getExt());
}
示例7: findArtifactRef
import org.apache.ivy.core.module.descriptor.Artifact; //导入方法依赖的package包/类
public synchronized ResolvedResource findArtifactRef(Artifact artifact, Date date) {
// For our special packager.xml file, defer to superclass
if (PACKAGER_ARTIFACT_NAME.equals(artifact.getName())
&& PACKAGER_ARTIFACT_TYPE.equals(artifact.getType())
&& PACKAGER_ARTIFACT_EXT.equals(artifact.getExt())) {
return super.findArtifactRef(artifact, date);
}
// Check the cache
ModuleRevisionId mr = artifact.getModuleRevisionId();
PackagerCacheEntry entry = packagerCache.get(mr);
// Ignore invalid entries
if (entry != null && !entry.isBuilt()) {
packagerCache.remove(mr);
entry.cleanup();
entry = null;
}
// Build the artifacts (if not done already)
if (entry == null) {
ResolvedResource packager = findArtifactRef(new DefaultArtifact(mr, null,
PACKAGER_ARTIFACT_NAME, PACKAGER_ARTIFACT_TYPE, PACKAGER_ARTIFACT_EXT), date);
if (packager == null) {
return null;
}
entry = new PackagerCacheEntry(mr, this.buildRoot, this.resourceCache,
this.resourceURL, this.validate, this.preserve, this.restricted, this.verbose,
this.quiet);
try {
entry.build(packager.getResource(), properties);
} catch (IOException e) {
throw new RuntimeException("can't build artifact " + artifact, e);
}
packagerCache.put(mr, entry);
}
// Return reference to desired artifact
return entry.getBuiltArtifact(artifact);
}
示例8: checkProjectDependencies
import org.apache.ivy.core.module.descriptor.Artifact; //导入方法依赖的package包/类
public boolean checkProjectDependencies() {
execute();
try {
ResolutionCacheManager cacheMgr = getIvyInstance().getResolutionCacheManager();
String[] confs = splitConfs(getConf());
String resolveId = getResolveId();
if (resolveId == null) {
resolveId = ResolveOptions.getDefaultResolveId(getResolvedModuleId());
}
XmlReportParser parser = new XmlReportParser();
for (String conf : confs) {
File report = cacheMgr.getConfigurationResolveReportInCache(resolveId, conf);
parser.parse(report);
Artifact[] artifacts = parser.getArtifacts();
for (Artifact artifact : artifacts) {
ModuleRevisionId mrid = artifact.getModuleRevisionId();
if (mrid.getOrganisation().equals(getOrganisationToFind())) {
if (mrid.getName().equals(getModuleToFind())) {
log(mrid.getOrganisation() + "#" + mrid.getName() + " found in project dependencies !",
Project.MSG_DEBUG);
// use this version
loadCachePath(getOrganisationToFind(), getModuleToFind(), mrid.getRevision(),
getConfToFind(), getSettingsReference());
return true;
} else {
// if only organization is found in project
// dependencies use the same version with the
// required module
log("Only organisation : " + mrid.getOrganisation()
+ " was found in project dependencies !", Project.MSG_DEBUG);
loadCachePath(mrid.getOrganisation(), getModuleToFind(), mrid.getRevision(),
getConfToFind(), getSettingsReference());
return true;
}
}
}
}
} catch (Exception ex) {
throw new BuildException("impossible to check project dependencies: " + ex, ex);
}
return false;
}