for (DirectoryResource folder : this.getWebRootDirectories())
{
folder.mkdirs();
}
MavenPluginFacet plugins = project.getFacet(MavenPluginFacet.class);
DependencyBuilder mvnWarPluginDep = DependencyBuilder.create("org.apache.maven.plugins:maven-war-plugin")
.setVersion("2.1.1");
MavenPlugin plugin;
if (!plugins.hasPlugin(mvnWarPluginDep))
{
plugin = MavenPluginBuilder.create().setDependency(mvnWarPluginDep);
plugins.addPlugin(plugin);
}
else
{
plugin = plugins.getPlugin(mvnWarPluginDep);
}
if (plugin.getConfig() == null)
{
}
if (!plugin.getConfig().hasConfigurationElement("failOnMissingWebXml"))
{
plugin.getConfig().addConfigurationElement(
ConfigurationElementBuilder.create().setName("failOnMissingWebXml").setText("false"));
}
else
{
ConfigurationElementBuilder configElement = ConfigurationElementBuilder.createFromExisting(plugin
.getConfig().getConfigurationElement("failOnMissingWebXml"));
plugin.getConfig().removeConfigurationElement("failOnMissingWebXml");
plugin.getConfig().addConfigurationElement(configElement);
}
plugins.removePlugin(mvnWarPluginDep);
plugins.addPlugin(plugin);
}
return true;
}