super.build(kind, monitor);
IMavenProjectFacade facade = getMavenProjectFacade();
IProject project = facade.getProject();
MavenProject mavenProject = facade.getMavenProject(monitor);
EarPluginConfiguration config = new EarPluginConfiguration(mavenProject);
if (!config.isGenerateApplicationXml()) {
return null;
}
IMavenWtpPreferencesManager prefMgr = MavenWtpPlugin.getDefault().getMavenWtpPreferencesManager();
boolean useBuildDirectory = prefMgr.getPreferences(project).isApplicationXmGeneratedInBuildDirectory();
IFolder earResourcesFolder;
if (useBuildDirectory) {
String appResourcesDir = ProjectUtils.getM2eclipseWtpFolder(mavenProject, project).toPortableString()+Path.SEPARATOR+MavenWtpConstants.EAR_RESOURCES_FOLDER;
earResourcesFolder = project.getFolder(appResourcesDir);
} else {
earResourcesFolder = project.getFolder(config.getEarContentDirectory(project));
}
if (!earResourcesFolder.getFile("META-INF/application.xml").exists()) { //$NON-NLS-1$
DeploymentDescriptorManagement.INSTANCE.updateConfiguration(project, mavenProject, config , useBuildDirectory, monitor);
}