mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-21 15:55:40 +00:00
Making artifacts available for downloads.
This commit is contained in:
1 parent
f53bb92f94
commit
cee86fbb73
5 files changed
+105
-3
No files matched your search
@@ -25,7 +25,6 @@ package hudson.maven;
|
||||
|
||||
import hudson.FilePath;
|
||||
import hudson.EnvVars;
|
||||
import hudson.maven.reporters.MavenArtifact;
|
||||
import hudson.maven.reporters.MavenArtifactRecord;
|
||||
import hudson.maven.reporters.SurefireArchiver;
|
||||
import hudson.slaves.WorkspaceList;
|
||||
@@ -184,6 +183,14 @@ public class MavenBuild extends AbstractMavenBuild<MavenModule,MavenBuild> {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Information about artifacts produced by Maven.
|
||||
*/
|
||||
@Exported
|
||||
public MavenArtifactRecord getMavenArtifacts() {
|
||||
return getAction(MavenArtifactRecord.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Exposes {@code MAVEN_OPTS} to forked processes.
|
||||
*
|
||||
|
||||
@@ -374,6 +374,14 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
|
||||
return super.getDynamic(token,req,rsp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Information about artifacts produced by Maven.
|
||||
*/
|
||||
@Exported
|
||||
public MavenAggregatedArtifactRecord getMavenArtifacts() {
|
||||
return getAction(MavenAggregatedArtifactRecord.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes the latest module builds that correspond to this build.
|
||||
* (when indivudual modules are built, a new ModuleSetBuild is not created,
|
||||
|
||||
@@ -31,7 +31,7 @@ import hudson.model.BuildListener;
|
||||
import hudson.model.FingerprintMap;
|
||||
import hudson.model.Hudson;
|
||||
|
||||
import org.apache.maven.RepositoryUtils;
|
||||
import hudson.util.HttpResponses;
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.factory.ArtifactFactory;
|
||||
import org.apache.maven.artifact.handler.ArtifactHandler;
|
||||
@@ -39,6 +39,8 @@ import org.apache.maven.artifact.handler.DefaultArtifactHandler;
|
||||
import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import org.kohsuke.stapler.AncestorInPath;
|
||||
import org.kohsuke.stapler.HttpResponse;
|
||||
import org.kohsuke.stapler.export.Exported;
|
||||
import org.kohsuke.stapler.export.ExportedBean;
|
||||
|
||||
@@ -46,6 +48,7 @@ import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.net.URL;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@@ -101,7 +104,7 @@ public final class MavenArtifact implements Serializable {
|
||||
*/
|
||||
@Exported
|
||||
public final String md5sum;
|
||||
|
||||
|
||||
public MavenArtifact(Artifact a) throws IOException {
|
||||
this.groupId = a.getGroupId();
|
||||
this.artifactId = a.getArtifactId();
|
||||
@@ -194,6 +197,15 @@ public final class MavenArtifact implements Serializable {
|
||||
return f;
|
||||
}
|
||||
|
||||
/**
|
||||
* Serve the file.
|
||||
*
|
||||
* TODO: figure out how to make this URL more discoverable to the remote API.
|
||||
*/
|
||||
public HttpResponse doFile(@AncestorInPath MavenArtifactRecord parent) throws IOException {
|
||||
return HttpResponses.staticResource(getFile(parent.parent));
|
||||
}
|
||||
|
||||
private FilePath getArtifactArchivePath(MavenBuildProxy build, String groupId, String artifactId, String version) {
|
||||
return build.getArtifactsDir().child(groupId).child(artifactId).child(version).child(fileName);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user