diff --git a/core/src/main/java/hudson/tasks/ArtifactArchiver.java b/core/src/main/java/hudson/tasks/ArtifactArchiver.java index 4f092119e472afa0d391edbec620f156cbe56212..5e903fcba340e7ed801f7861cf5f1bda901ac50c 100644 --- a/core/src/main/java/hudson/tasks/ArtifactArchiver.java +++ b/core/src/main/java/hudson/tasks/ArtifactArchiver.java @@ -41,6 +41,7 @@ import java.io.File; import java.io.IOException; import net.sf.json.JSONObject; +import javax.annotation.Nonnull; /** * Copies the artifacts into an archive directory. @@ -67,14 +68,9 @@ public class ArtifactArchiver extends Recorder { /** * Fail (or not) the build if archiving returns nothing. */ + @Nonnull private Boolean allowEmptyArchive; - /** - * Compatibility for systems using the older setting. - */ - private static final Boolean allowEmptyArchiveSystemProp = - Boolean.getBoolean(ArtifactArchiver.class.getName()+".warnOnEmpty"); - @DataBoundConstructor public ArtifactArchiver(String artifacts, String excludes, boolean latestOnly, boolean allowEmptyArchive) { this.artifacts = artifacts.trim(); @@ -86,7 +82,7 @@ public class ArtifactArchiver extends Recorder { // Backwards compatibility for older builds public Object readResolve() { if (allowEmptyArchive == null) { - this.allowEmptyArchive = allowEmptyArchiveSystemProp; + this.allowEmptyArchive = Boolean.getBoolean(ArtifactArchiver.class.getName()+".warnOnEmpty"); } return this; } diff --git a/core/src/main/resources/hudson/tasks/ArtifactArchiver/config.jelly b/core/src/main/resources/hudson/tasks/ArtifactArchiver/config.jelly index dbce5d776d893d11aa12c04b9578f3ba376ac04f..659b36011d8170ba1084fa432af5548631b39395 100644 --- a/core/src/main/resources/hudson/tasks/ArtifactArchiver/config.jelly +++ b/core/src/main/resources/hudson/tasks/ArtifactArchiver/config.jelly @@ -31,10 +31,10 @@ THE SOFTWARE. - + - + diff --git a/core/src/main/resources/hudson/tasks/ArtifactArchiver/help-allowEmptyArchive.html b/core/src/main/resources/hudson/tasks/ArtifactArchiver/help-allowEmptyArchive.html new file mode 100644 index 0000000000000000000000000000000000000000..2c97f795e4bb822fa384ef9ade5bf6737cf448a1 --- /dev/null +++ b/core/src/main/resources/hudson/tasks/ArtifactArchiver/help-allowEmptyArchive.html @@ -0,0 +1,5 @@ +
+ Normally, a build fails if archiving returns zero artifacts. + This option allows the archiving process to return nothing without failing the build. + Instead, the build will simply throw a warning. +
\ No newline at end of file