in src/main/java/org/apache/maven/plugins/jarsigner/AbstractJarsignerMojo.java [295:348]
private List<File> findJarfiles() throws MojoExecutionException {
if (this.archive != null) {
// Only process this, but nothing more
return Arrays.asList(this.archive);
}
List<File> archives = new ArrayList<>();
if (processMainArtifact) {
getFileFromArtifact(this.project.getArtifact()).ifPresent(archives::add);
}
if (processAttachedArtifacts) {
Collection<String> includes = new HashSet<>();
if (includeClassifiers != null) {
includes.addAll(Arrays.asList(includeClassifiers));
}
Collection<String> excludes = new HashSet<>();
if (excludeClassifiers != null) {
excludes.addAll(Arrays.asList(excludeClassifiers));
}
for (Artifact artifact : this.project.getAttachedArtifacts()) {
if (!includes.isEmpty() && !includes.contains(artifact.getClassifier())) {
continue;
}
if (excludes.contains(artifact.getClassifier())) {
continue;
}
getFileFromArtifact(artifact).ifPresent(archives::add);
}
} else {
if (verbose) {
getLog().info(getMessage("ignoringAttachments"));
} else {
getLog().debug(getMessage("ignoringAttachments"));
}
}
if (archiveDirectory != null) {
String includeList = (includes != null) ? StringUtils.join(includes, ",") : null;
String excludeList = (excludes != null) ? StringUtils.join(excludes, ",") : null;
try {
archives.addAll(FileUtils.getFiles(archiveDirectory, includeList, excludeList));
} catch (IOException e) {
throw new MojoExecutionException("Failed to scan archive directory for JARs: " + e.getMessage(), e);
}
}
return archives;
}