use of org.springframework.roo.project.Configuration in project spring-roo by spring-projects.
the class CloudFoundryProvider method updatePlugins.
/**
* This method update plugins with the added to configuration.xml file
*
* @param configuration
* @param moduleName
* @param projectOperations
*/
public static void updatePlugins(String pluginConfiguration, ProjectOperations projectOperations) {
Configuration conf = null;
// Generating configuration if necessary
if (StringUtils.isNotBlank(pluginConfiguration)) {
try {
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
Document doc = docBuilder.newDocument();
Element configElement = doc.createElement("configuration");
// Getting all configurations
String[] configurationTags = pluginConfiguration.split(",");
for (String configurationTag : configurationTags) {
String[] keyValue = configurationTag.split("=");
if (keyValue.length == 2) {
Element element = doc.createElement(keyValue[0]);
element.setTextContent(keyValue[1]);
configElement.appendChild(element);
}
}
conf = new Configuration(configElement);
} catch (Exception e) {
LOGGER.log(Level.WARNING, "[ERROR] " + e);
}
}
// Generate Plugin
Plugin cloudFoundryMvnPlugin = new Plugin("org.cloudfoundry", "cf-maven-plugin", "1.0.4", conf, null, null);
// Adding plugin
projectOperations.addBuildPlugin(projectOperations.getFocusedModuleName(), cloudFoundryMvnPlugin);
}
Aggregations