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


Java Artifact.getFile方法代码示例

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


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

示例1: moveToTargetDir

import org.eclipse.aether.artifact.Artifact; //导入方法依赖的package包/类
/**
 * move artifact to target directory, return the moved artifact file path
 *
 * @param targetDirectory
 * @param artifact
 *
 * @return
 */
private Path moveToTargetDir(Path targetDirectory, Artifact artifact) {
    final File artifactFile = artifact.getFile();
    final String artifactFileName = artifactFile.getName();
    final Path targetFile = targetDirectory.resolve(artifactFileName);
    log.debug("copy {} to {}", artifactFileName, targetFile);
    if (!targetDirectory.toFile().exists()) {
        targetDirectory.toFile().mkdirs();
    }
    try {
        Files.copy(artifactFile.toPath(), targetFile, StandardCopyOption.REPLACE_EXISTING);
    } catch (IOException e) {
        final String message = String.format(
                "dependency %s:%s:%s resolved but cannot be moved to target dir: %s",
                artifact.getGroupId(),
                artifact.getArtifactId(),
                artifact.getVersion(),
                e.getMessage()
        );
        throw new DependencyResolveException(message, e);
    }
    return targetFile;
}
 
开发者ID:dshell-io,项目名称:dshell,代码行数:31,代码来源:DefaultDependencyResolver.java

示例2: resolveModel

import org.eclipse.aether.artifact.Artifact; //导入方法依赖的package包/类
@Override
public ModelSource resolveModel(String groupId, String artifactId, String version)
        throws UnresolvableModelException {
    Artifact pomArtifact = new DefaultArtifact(groupId, artifactId, "", "pom", version);

    try {
        ArtifactRequest request = new ArtifactRequest(pomArtifact, repositories, null);
        pomArtifact = system.resolveArtifact(session, request).getArtifact();
    } catch (org.eclipse.aether.resolution.ArtifactResolutionException ex) {
        throw new UnresolvableModelException(ex.getMessage(), groupId, artifactId, version, ex);
    } 

    File pomFile = pomArtifact.getFile();

    return new FileModelSource(pomFile);
}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:17,代码来源:SimpleModelResolver.java

示例3: serialize

import org.eclipse.aether.artifact.Artifact; //导入方法依赖的package包/类
@Override
public void serialize(Artifact value, JsonGenerator generator, SerializerProvider provider) throws IOException {
	generator.writeStartObject();
	generator.writeStringField(GROUP_ID, value.getGroupId());
	generator.writeStringField(ARTIFACT_ID, value.getArtifactId());
	generator.writeStringField(CLASSIFIER, value.getClassifier());
	generator.writeStringField(EXTENSION, value.getExtension());
	generator.writeStringField(VERSION, value.getVersion());
	if (value.getFile() != null) {
		generator.writeStringField(FILE, value.getFile().getPath());
	}
	if (value.getProperties() != null) {
		generator.writeFieldName(PROPERTIES);
		generator.writeStartObject();
		for (Map.Entry<String, String> entry : value.getProperties().entrySet()) {
			generator.writeStringField(entry.getKey(), entry.getValue());
		}
		generator.writeEndObject();
	}
	generator.writeEndObject();
}
 
开发者ID:maenu,项目名称:kowalski,代码行数:22,代码来源:ArtifactSerializer.java

示例4: read

import org.eclipse.aether.artifact.Artifact; //导入方法依赖的package包/类
@Override
public Page<Artifact, Artifact> read()
		throws UnexpectedInputException, ParseException, NonTransientResourceException, Exception {
	MDC.remove(PATIENT);
	Page<Artifact, Artifact> page = super.read();
	while (page != null) {
		Artifact patient = page.getKey().get();
		if (patient.getFile() == null) {
			LOGGER.info("Skip {} as it is not fetched", patient);
			page = super.read();
			continue;
		}
		if (!patient.getExtension().equals("jar")) {
			LOGGER.info("Skip {} as it is not packaged as jar", patient);
			page = super.read();
			continue;
		}
		if (patient.isSnapshot()) {
			LOGGER.info("Skip {} as it is snapshot", patient);
			page = super.read();
			continue;
		}
		LOGGER.info("Processing {}...", patient);
		MDC.put(PATIENT, patient.toString());
		return page;
	}
	return null;
}
 
开发者ID:maenu,项目名称:kowalski,代码行数:29,代码来源:Reader.java

示例5: visitEnter

import org.eclipse.aether.artifact.Artifact; //导入方法依赖的package包/类
public boolean visitEnter(final DependencyNode node) {

            final Artifact artifact = node.getArtifact();
            final File artifact_file = artifact.getFile();
            return files.add(artifact_file);
        }
 
开发者ID:stacs-srg,项目名称:shabdiz,代码行数:7,代码来源:MavenDependencyResolver.java

示例6: isOsgiReady

import org.eclipse.aether.artifact.Artifact; //导入方法依赖的package包/类
private boolean isOsgiReady(Artifact artifact) throws Exception {
    JarFile jar = new JarFile(artifact.getFile());
    Attributes attrs = jar.getManifest().getMainAttributes();
    return attrs.getValue("Bundle-SymbolicName") != null &&
            attrs.getValue("Bundle-Version") != null;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:7,代码来源:AetherResolver.java


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