use of org.springframework.roo.project.Plugin 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);
}
use of org.springframework.roo.project.Plugin in project spring-roo by spring-projects.
the class DatabaseDotComOperationsImpl method isInstalledInModule.
public boolean isInstalledInModule(final String moduleName) {
if (projectOperations == null) {
projectOperations = getProjectOperations();
}
Validate.notNull(projectOperations, "ProjectOperations is required");
final Pom pom = projectOperations.getPomFromModuleName(moduleName);
if (pom == null) {
return false;
}
for (final Plugin buildPlugin : pom.getBuildPlugins()) {
if ("com.force.sdk".equals(buildPlugin.getArtifactId())) {
return true;
}
}
return false;
}
use of org.springframework.roo.project.Plugin in project spring-roo by spring-projects.
the class SeleniumOperationsImpl method installMavenPlugin.
private void installMavenPlugin() {
// Stop if the plugin is already installed
for (final Plugin plugin : projectOperations.getFocusedModule().getBuildPlugins()) {
if (plugin.getArtifactId().equals("selenium-maven-plugin")) {
return;
}
}
final Element configuration = XmlUtils.getConfiguration(getClass());
final Element plugin = XmlUtils.findFirstElement("/configuration/selenium/plugin", configuration);
// Now install the plugin itself
if (plugin != null) {
projectOperations.addBuildPlugin(projectOperations.getFocusedModuleName(), new Plugin(plugin));
}
}
use of org.springframework.roo.project.Plugin in project spring-roo by spring-projects.
the class Pom method isPluginRegisteredInPluginManagement.
/**
* Indicates whether the given plugin is registered in pluginManagement without checking plugin version
* , by checking the result of {@link Plugin#equals(Object)}.
*
* @param plugin
* the plugin to check (can be <code>null</code>)
* @return <code>false</code> if a <code>null</code> dependency is given
*/
public boolean isPluginRegisteredInPluginManagement(final Plugin plugin, boolean checkVersion) {
if (checkVersion) {
return plugin != null && pluginsInPluginManagement.contains(plugin);
}
boolean registered = false;
Iterator<Plugin> it = pluginsInPluginManagement.iterator();
while (it.hasNext()) {
Plugin dp = it.next();
if (plugin.getGroupId().equals(dp.getGroupId()) && plugin.getArtifactId().equals(dp.getArtifactId())) {
registered = true;
break;
}
}
return plugin != null && registered;
}
use of org.springframework.roo.project.Plugin in project spring-roo by spring-projects.
the class Pom method getBuildPluginsExcludingVersion.
/**
* Returns any build plugins with the same groupId and artifactId as the
* given plugin. This is useful for upgrade cases.
*
* @param plugin to locate (required; note the version number is ignored in
* comparisons)
* @return any matching plugins (never returns null, but may return an empty
* {@link Set})
*/
public Set<Plugin> getBuildPluginsExcludingVersion(final Plugin plugin) {
Validate.notNull(plugin, "Plugin to locate is required");
final Set<Plugin> result = new HashSet<Plugin>();
for (final Plugin p : buildPlugins) {
if (plugin.getArtifactId().equals(p.getArtifactId()) && plugin.getGroupId().equals(p.getGroupId())) {
result.add(p);
}
}
return result;
}
Aggregations