// add resources
for (Resource resource : pomFile.getResources()) {
archive.addAsResource(resource.getSource(), resource.getTargetPath());
}
WarPluginConfiguration warConfiguration = new WarPluginConfiguration(pomFile);
if (Validate.isReadable(warConfiguration.getWarSourceDirectory())) {
WebArchive webapp = ShrinkWrap.create(ExplodedImporter.class, "webapp.war")
.importDirectory(warConfiguration.getWarSourceDirectory(), createFilter(warConfiguration))
.as(WebArchive.class);
archive = archive.merge(webapp);
}
// add dependencies
this.session = AddAllDeclaredDependenciesTask.INSTANCE.execute(session);
final Collection<MavenResolvedArtifact> artifacts = session.resolveDependencies(strategy);
for (MavenResolvedArtifact artifact : artifacts) {
archive.addAsLibrary(artifact.asFile());
}
// set manifest
Manifest manifest = warConfiguration.getArchiveConfiguration().asManifest();
archive.setManifest(new ManifestAsset(manifest));
// filter via includes/excludes
archive = ArchiveFilteringUtils.filterArchiveContent(archive, WebArchive.class, warConfiguration.getIncludes(),
warConfiguration.getExcludes());
return this;
}