}
private Xpp3Dom customize(Xpp3Dom originalConfiguration, Collection<File> contextFolders,
File originalDestinationFolder, File originalJsDestinationFolder,
File originalCssDestinationFolder, File originalGroupNameMappingFile) throws IOException, CoreException {
IMavenProjectFacade facade = getMavenProjectFacade();
if (!"war".equals(facade.getPackaging())) {
// Not a war project, we don't know how to customize that
return originalConfiguration;
}
Xpp3Dom customConfiguration = new Xpp3Dom("configuration");
Xpp3DomUtils.mergeXpp3Dom(customConfiguration, originalConfiguration);
IProject project = facade.getProject();
String target = facade.getMavenProject().getBuild().getDirectory();
IPath relativeTargetPath = MavenProjectUtils.getProjectRelativePath(project, target);
if (relativeTargetPath == null) {
// target folder not under the project directory, we bail
return customConfiguration;
}
IFolder m2eWtpFolder = project.getFolder(relativeTargetPath.append("m2e-wtp"));
if (!m2eWtpFolder.exists() || isWtpIntegrationDisabled(facade.getMavenProject(new NullProgressMonitor()))) {
// Not a m2e-wtp project, we don't know how to customize either
// TODO Try to support Sonatype's webby instead?
return customConfiguration;
}
IFolder webResourcesFolder = m2eWtpFolder.getFolder("web-resources");
IPath fullTargetPath = new Path(target);
IPath defaultOutputPathPrefix = fullTargetPath.append(facade.getMavenProject().getBuild().getFinalName());
fixContextFolders(customConfiguration, contextFolders);
customizeLocation(originalDestinationFolder, webResourcesFolder,
defaultOutputPathPrefix, customConfiguration, DESTINATION_FOLDER);