當前位置: 首頁>>代碼示例>>Java>>正文


Java Artifact.isSnapshot方法代碼示例

本文整理匯總了Java中org.eclipse.aether.artifact.Artifact.isSnapshot方法的典型用法代碼示例。如果您正苦於以下問題:Java Artifact.isSnapshot方法的具體用法?Java Artifact.isSnapshot怎麽用?Java Artifact.isSnapshot使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.aether.artifact.Artifact的用法示例。


在下文中一共展示了Artifact.isSnapshot方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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

示例2: resolve

import org.eclipse.aether.artifact.Artifact; //導入方法依賴的package包/類
public @Override File resolve(Artifact artifact) {
    if (!artifact.getExtension().equals(NbMavenProject.TYPE_POM)) {
        return null;
    }
    if (!artifact.getClassifier().isEmpty()) {
        return null;
    }
    ArtifactRepository local = EmbedderFactory.getProjectEmbedder().getLocalRepository();
    if (local.getLayout() != null) { // #189807: for unknown reasons, there is no layout when running inside MavenCommandLineExecutor.run
        
        //the special snapshot handling is important in case of SNAPSHOT or x-SNAPSHOT versions, for some reason aether has slightly different
        //handling of baseversion compared to maven artifact. we need to manually set the baseversion here..
        boolean isSnapshot = artifact.isSnapshot();
        DefaultArtifact art = new DefaultArtifact(artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), null, artifact.getExtension(), artifact.getClassifier(), new DefaultArtifactHandler(artifact.getExtension()));
        if (isSnapshot) {
            art.setBaseVersion(artifact.getBaseVersion());
        }
        String path = local.pathOf(art);
        if (new File(local.getBasedir(), path).exists()) {
            return null; // for now, we prefer the repository version when available
        }
    }
    //#234586
    Set<String> gavSet = gav.get();
    if (gavSet == null) {
        gavSet = new HashSet<String>();
        gav.set(gavSet);
    }
    String id = artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getVersion();

    if (!gavSet.contains(id)) {
        try {
            gavSet.add(id); //#234586
            File pom = MavenFileOwnerQueryImpl.getInstance().getOwnerPOM(artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion());
            if (pom != null) {
                //instead of workarounds down the road, we set the artifact's file here.
                // some stacktraces to maven/aether do set it after querying our code, but some don't for reasons unknown to me.
                artifact.setFile(pom);
                return pom;
            }
        } finally {
            gavSet.remove(id); //#234586
            if (gavSet.isEmpty()) {
                gav.remove();
            }
        }
    } else {
        LOG.log(Level.INFO, "Cycle in NbArtifactFixer resolution (issue #234586): {0}", Arrays.toString(gavSet.toArray()));
    }
    
    try {
        File f = createFallbackPOM(artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion());
        //instead of workarounds down the road, we set the artifact's file here.
        // some stacktraces to maven/aether do set it after querying our code, but some don't for reasons unknown to me.
        artifact.setFile(f);
        return f;
    } catch (IOException x) {
        Exceptions.printStackTrace(x);
        return null;
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:62,代碼來源:NbArtifactFixer.java


注:本文中的org.eclipse.aether.artifact.Artifact.isSnapshot方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。