當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。