diff --git a/src/main/java/org/jenkinsci/plugins/artifactdeployer/ArtifactDeployerBuilder.java b/src/main/java/org/jenkinsci/plugins/artifactdeployer/ArtifactDeployerBuilder.java index af0d944..3f72005 100644 --- a/src/main/java/org/jenkinsci/plugins/artifactdeployer/ArtifactDeployerBuilder.java +++ b/src/main/java/org/jenkinsci/plugins/artifactdeployer/ArtifactDeployerBuilder.java @@ -126,10 +126,39 @@ private Map> processDeployment(final AbstractB ArtifactDeployerManager deployerManager = new ArtifactDeployerManager(); FilePath basedirFilePath = deployerManager.getBasedirFilePath(workspace, basedir); List results = basedirFilePath.act(deployerCopy); + + if (isFailNoFilesDeploy(results, entry)) { + throw new ArtifactDeployerException("Can't find any artifacts to deploy with the following configuration :" + + printConfiguration(includes, excludes, basedirFilePath.getRemote(), outputPath)); + } + deployedArtifacts.put(entry.getUniqueId(), results); return deployedArtifacts; } + private boolean isFailNoFilesDeploy(List results, ArtifactDeployerEntry entry) { + return ((results == null || results.size() == 0) && entry.isFailNoFilesDeploy()); + } + + private String printConfiguration(String includes, String excludes, String basedir, String outputPath) { + StringBuffer sb = new StringBuffer(); + + if (includes != null) { + sb.append(",includes:").append(includes); + } + if (excludes != null) { + sb.append(",excludes:").append(excludes); + } + + sb.append(",basedir:").append(basedir); + sb.append(",outPath:").append(outputPath); + sb.append("]"); + + sb = sb.replace(0, 1, "["); + + return sb.toString(); + } + @SuppressWarnings("unused") public ArtifactDeployerEntry getEntry() { return entry; diff --git a/src/main/resources/org/jenkinsci/plugins/artifactdeployer/ArtifactDeployerBuilder/config.jelly b/src/main/resources/org/jenkinsci/plugins/artifactdeployer/ArtifactDeployerBuilder/config.jelly index 73dd6ed..30bc1f6 100644 --- a/src/main/resources/org/jenkinsci/plugins/artifactdeployer/ArtifactDeployerBuilder/config.jelly +++ b/src/main/resources/org/jenkinsci/plugins/artifactdeployer/ArtifactDeployerBuilder/config.jelly @@ -48,6 +48,12 @@ THE SOFTWARE. + + + + +