List of usage examples for org.apache.maven.artifact Artifact isRelease
boolean isRelease();
From source file:org.apache.marmotta.maven.plugins.repochecker.RepositoryCheckerMojo.java
License:Apache License
private Result lookupArtifact(Artifact artifact, ArtifactRepository rep, DefaultHttpClient client) { if (artifact.isSnapshot() && !rep.getSnapshots().isEnabled()) { return Result.NOT_FOUND; }/* w w w . ja v a 2 s . co m*/ if (artifact.isRelease() && !rep.getReleases().isEnabled()) { return Result.NOT_FOUND; } try { final String baseUrl = rep.getUrl().replaceAll("/$", "") + "/"; if (client.execute(new HttpHead(baseUrl + buildRelUrl(artifact)), fileExistsHandler)) { return Result.FOUND; } if (artifact.isSnapshot()) { // now check for a timestamp version final String fName = client.execute(new HttpGet(baseUrl + buildArtifactDir(artifact) + META_XML), createTimestampHandler(artifact)); if (fName != null && client.execute(new HttpHead(baseUrl + buildArtifactDir(artifact) + fName), fileExistsHandler)) { return Result.FOUND; } else { return Result.NOT_FOUND; } } else { return Result.NOT_FOUND; } } catch (IOException e) { return Result.ERROR; } }
From source file:org.codehaus.mojo.natives.plugin.NativeLinkMojo.java
License:Open Source License
/** * /*from w w w. j av a2 s.co m*/ */ private void attachPrimaryArtifact() { Artifact artifact = this.project.getArtifact(); if (null == this.classifier) { artifact.setFile(new File(this.linkerOutputDirectory + "/" + this.project.getBuild().getFinalName() + "." + this.project.getArtifact().getArtifactHandler().getExtension())); } else { //install primary artifact as a classifier DefaultArtifact clone = new DefaultArtifact(artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersionRange().cloneOf(), artifact.getScope(), artifact.getType(), classifier, artifact.getArtifactHandler(), artifact.isOptional()); clone.setRelease(artifact.isRelease()); clone.setResolvedVersion(artifact.getVersion()); clone.setResolved(artifact.isResolved()); clone.setFile(artifact.getFile()); if (artifact.getAvailableVersions() != null) { clone.setAvailableVersions(new ArrayList(artifact.getAvailableVersions())); } clone.setBaseVersion(artifact.getBaseVersion()); clone.setDependencyFilter(artifact.getDependencyFilter()); if (artifact.getDependencyTrail() != null) { clone.setDependencyTrail(new ArrayList(artifact.getDependencyTrail())); } clone.setDownloadUrl(artifact.getDownloadUrl()); clone.setRepository(artifact.getRepository()); clone.setFile(new File(this.linkerOutputDirectory + "/" + this.project.getBuild().getFinalName() + "." + this.project.getArtifact().getArtifactHandler().getExtension())); project.setArtifact(clone); } }
From source file:org.opennms.maven.plugins.karaf.GenerateFeaturesMavenRepoMojo.java
License:Apache License
Artifact getPom(final Artifact artifact) { final Artifact pomArtifact = factory.createArtifactWithClassifier(artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), "pom", null); pomArtifact.setOptional(artifact.isOptional()); pomArtifact.setRelease(artifact.isRelease()); final File dir = artifact.getFile().getParentFile(); pomArtifact.setFile(new File(dir, MavenUtil.getFileName(pomArtifact))); getLog().info("Artifact: " + artifact + " pom = " + pomArtifact); return pomArtifact; }