63
64
* Just keep the last successful artifact set, no more.
65
66
private final boolean latestOnly;
67
private static final Boolean allowEmptyArchive =
68
Boolean.getBoolean(ArtifactArchiver.class.getName()+".warnOnEmpty");
69
* Fail (or not) the build if archiving returns nothing.
72
private Boolean allowEmptyArchive;
74
public ArtifactArchiver(String artifacts, String excludes, boolean latestOnly) {
75
this(artifacts, excludes, latestOnly, false);
70
78
@DataBoundConstructor
71
public ArtifactArchiver(String artifacts, String excludes, boolean latestOnly) {
79
public ArtifactArchiver(String artifacts, String excludes, boolean latestOnly, boolean allowEmptyArchive) {
72
80
this.artifacts = artifacts.trim();
73
81
this.excludes = Util.fixEmptyAndTrim(excludes);
74
82
this.latestOnly = latestOnly;
83
this.allowEmptyArchive = allowEmptyArchive;
86
// Backwards compatibility for older builds
87
public Object readResolve() {
88
if (allowEmptyArchive == null) {
89
this.allowEmptyArchive = Boolean.getBoolean(ArtifactArchiver.class.getName()+".warnOnEmpty");
77
94
public String getArtifacts() {
85
102
public boolean isLatestOnly() {
86
103
return latestOnly;
106
public boolean getAllowEmptyArchive() {
107
return allowEmptyArchive;
89
110
private void listenerWarnOrError(BuildListener listener, String message) {
90
111
if (allowEmptyArchive) {
136
157
Util.displayIOException(e,listener);
137
158
e.printStackTrace(listener.error(
138
159
Messages.ArtifactArchiver_FailedToArchive(artifacts)));
160
build.setResult(Result.FAILURE);