in src/main/java/org/apache/maven/plugins/source/AbstractSourceJarMojo.java [336:381]
protected void archiveProjectContent(MavenProject p, Archiver archiver) throws MojoExecutionException {
if (includePom) {
try {
archiver.addFile(p.getFile(), p.getFile().getName());
} catch (ArchiverException e) {
throw new MojoExecutionException("Error adding POM file to target jar file.", e);
}
}
for (String s : getSources(p)) {
File sourceDirectory = new File(s);
if (sourceDirectory.exists()) {
addDirectory(archiver, sourceDirectory, getCombinedIncludes(null), getCombinedExcludes(null));
}
}
// MAPI: this should be taken from the resources plugin
for (Resource resource : getResources(p)) {
File sourceDirectory = new File(resource.getDirectory());
if (!sourceDirectory.exists()) {
continue;
}
List<String> resourceIncludes = resource.getIncludes();
String[] combinedIncludes = getCombinedIncludes(resourceIncludes);
List<String> resourceExcludes = resource.getExcludes();
String[] combinedExcludes = getCombinedExcludes(resourceExcludes);
String targetPath = resource.getTargetPath();
if (targetPath != null) {
if (!targetPath.trim().endsWith("/")) {
targetPath += "/";
}
addDirectory(archiver, sourceDirectory, targetPath, combinedIncludes, combinedExcludes);
} else {
addDirectory(archiver, sourceDirectory, combinedIncludes, combinedExcludes);
}
}
}