本文整理汇总了Java中org.apache.ivy.core.report.ArtifactDownloadReport.setLocalFile方法的典型用法代码示例。如果您正苦于以下问题:Java ArtifactDownloadReport.setLocalFile方法的具体用法?Java ArtifactDownloadReport.setLocalFile怎么用?Java ArtifactDownloadReport.setLocalFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ivy.core.report.ArtifactDownloadReport
的用法示例。
在下文中一共展示了ArtifactDownloadReport.setLocalFile方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: download
import org.apache.ivy.core.report.ArtifactDownloadReport; //导入方法依赖的package包/类
public DownloadReport download(Artifact[] artifacts, DownloadOptions options) {
// Not much to do here - downloads are not required for workspace projects.
DownloadReport dr = new DownloadReport();
for (Artifact artifact : artifacts) {
ArtifactDownloadReport adr = new ArtifactDownloadReport(artifact);
dr.addArtifactReport(adr);
URL url = artifact.getUrl();
if (url == null || !url.getProtocol().equals("file")) {
// this is not an artifact managed by this resolver
adr.setDownloadStatus(DownloadStatus.FAILED);
return dr;
}
File f;
try {
f = new File(url.toURI());
} catch (URISyntaxException e) {
f = new File(url.getPath());
}
adr.setLocalFile(f);
adr.setDownloadStatus(DownloadStatus.NO);
adr.setSize(0);
Message.verbose("\t[IN WORKSPACE] " + artifact);
}
return dr;
}
示例2: download
import org.apache.ivy.core.report.ArtifactDownloadReport; //导入方法依赖的package包/类
@Override
public DownloadReport download(Artifact[] artifacts, DownloadOptions options) {
ensureConfigured();
clearArtifactAttempts();
DownloadReport dr = new DownloadReport();
for (Artifact artifact : artifacts) {
final ArtifactDownloadReport adr = new ArtifactDownloadReport(artifact);
dr.addArtifactReport(adr);
ResolvedResource artifactRef = getArtifactRef(artifact, null);
if (artifactRef != null) {
Message.verbose("\t[NOT REQUIRED] " + artifact);
ArtifactOrigin origin = new ArtifactOrigin(artifact, true, artifactRef
.getResource().getName());
File archiveFile = ((FileResource) artifactRef.getResource()).getFile();
adr.setDownloadStatus(DownloadStatus.NO);
adr.setSize(archiveFile.length());
adr.setArtifactOrigin(origin);
adr.setLocalFile(archiveFile);
} else {
adr.setDownloadStatus(DownloadStatus.FAILED);
}
}
return dr;
}
示例3: download
import org.apache.ivy.core.report.ArtifactDownloadReport; //导入方法依赖的package包/类
@Override
public DownloadReport download( Artifact[] artifacts, DownloadOptions options )
{
DownloadReport report = new DownloadReport();
for ( Artifact artifact : artifacts )
{
ArtifactDownloadReport artifactReport = new ArtifactDownloadReport( artifact );
ResolutionRequest request = new ResolutionRequest();
request.setArtifact( ivy2aether( artifact ) );
ResolutionResult result = getResolver().resolve( request );
Path artifactPath = result.getArtifactPath();
if ( artifactPath != null )
{
artifactReport.setArtifactOrigin( new ArtifactOrigin( artifact, false, artifactPath.toString() ) );
artifactReport.setLocalFile( artifactPath.toFile() );
artifactReport.setDownloadStatus( DownloadStatus.SUCCESSFUL );
}
else
{
artifactReport.setDownloadStatus( DownloadStatus.FAILED );
}
report.addArtifactReport( artifactReport );
}
return report;
}
示例4: artifactDownloadReport
import org.apache.ivy.core.report.ArtifactDownloadReport; //导入方法依赖的package包/类
private ArtifactDownloadReport artifactDownloadReport(File localFile) {
ArtifactDownloadReport report = new ArtifactDownloadReport(null);
report.setLocalFile(localFile);
return report;
}