emptyBehavior = we;
}
public void execute() {
validate();
final Resource targetArchive = getDest();
if (!targetArchive.isExists()) {
// force create mode
mode = new Mode();
mode.setValue(Mode.FORCE_CREATE);
}
Collection sourceResources;
try {
sourceResources = findSources();
} catch (IOException ioex) {
throw new BuildException("Failed to read sources", ioex);
}
if (sourceResources.size() == 0) {
if (WhenEmpty.SKIP.equals(emptyBehavior.getValue())) {
log(NO_SOURCES_MSG, Project.MSG_WARN);
} else {
throw new BuildException(NO_SOURCES_MSG);
}
} else {
File copyOfDest = maybeCopyTarget();
Resource destOrCopy = copyOfDest == null
? targetArchive
: new FileResource(copyOfDest);
ArchiveFileSet existingEntries =
fileSetBuilder.buildFileSet(destOrCopy);
existingEntries.setProject(getProject());