use of org.springframework.roo.project.Plugin in project spring-roo by spring-projects.
the class TestOperationsImpl method addIntegrationTestDependencies.
/**
* Add needed dependencies and plugins to run created integration tests.
*
* @param module {@link String} the module name where add dependencies.
*/
private void addIntegrationTestDependencies(String moduleName) {
// Add dependencies if needed
projectOperations.addDependency(moduleName, JUNIT_DEPENDENCY);
projectOperations.addDependency(moduleName, ASSERTJ_CORE_DEPENDENCY);
projectOperations.addDependency(moduleName, SPRING_TEST_DEPENDENCY);
projectOperations.addDependency(moduleName, SPRING_BOOT_TEST_DEPENDENCY);
// Add plugin maven-failsafe-plugin
Pom module = projectOperations.getPomFromModuleName(moduleName);
// Stop if the plugin is already installed
for (final Plugin plugin : module.getBuildPlugins()) {
if (plugin.getArtifactId().equals("maven-failsafe-plugin")) {
return;
}
}
final Element configuration = XmlUtils.getConfiguration(getClass());
final Element plugin = XmlUtils.findFirstElement("/configuration/plugin", configuration);
// Now install the plugin itself
if (plugin != null) {
projectOperations.addBuildPlugin(moduleName, new Plugin(plugin));
}
}
use of org.springframework.roo.project.Plugin in project spring-roo by spring-projects.
the class JpaDataOnDemandCreator method addMavenJarPlugin.
/**
* Add maven-jar-plugin to provided module.
*
* @param moduleName the name of the module.
*/
private void addMavenJarPlugin(String moduleName) {
// Add plugin maven-jar-plugin
Pom module = projectOperations.getPomFromModuleName(moduleName);
// Stop if the plugin is already installed
for (final Plugin plugin : module.getBuildPlugins()) {
if (plugin.getArtifactId().equals(MAVEN_JAR_PLUGIN)) {
return;
}
}
final Element configuration = XmlUtils.getConfiguration(getClass());
final Element plugin = XmlUtils.findFirstElement("/configuration/plugin", configuration);
// Now install the plugin itself
if (plugin != null) {
projectOperations.addBuildPlugin(moduleName, new Plugin(plugin), false);
}
}
use of org.springframework.roo.project.Plugin in project spring-roo by spring-projects.
the class GaeOperationsImpl 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 ("appengine-maven-plugin".equals(buildPlugin.getArtifactId())) {
return true;
}
}
return false;
}
use of org.springframework.roo.project.Plugin in project spring-roo by spring-projects.
the class WsOperationsImpl method includeDependenciesAndPluginsForWsClient.
/**
* This method includes the TracEE and CXF dependencies and includes the CXF
* CodeGen Plugin with the necessary configuration for the new WsClient.
*
* @param wsdlName
* the wsdl name
* @param wsdlModuleName
* the module where the wsdl is located
*/
private void includeDependenciesAndPluginsForWsClient(String wsdlName, String wsdlModuleName) {
// Include CXF property if not exists
getProjectOperations().addProperty("", CXF_PROPERTY);
getProjectOperations().addDependency(wsdlModuleName, CXF_RT_FRONTEND_JAXWS_DEPENDENCY);
getProjectOperations().addDependency(wsdlModuleName, CXF_RT_TRANSPORTS_HTTP_DEPENDENCY);
// Include TracEE dependencies if not exists
getProjectOperations().addProperty("", TRACEE_PROPERTY);
getProjectOperations().addDependency(wsdlModuleName, TRACEE_CXF_DEPENDENCY);
// Include CXF plugin if not exists
final Element configuration = XmlUtils.getConfiguration(getClass());
final List<Element> plugins = XmlUtils.findElements("/configuration/plugins/plugin", configuration);
Plugin cxfPlugin = null;
for (final Element pluginElement : plugins) {
cxfPlugin = new Plugin(pluginElement);
getProjectOperations().addBuildPlugin(wsdlModuleName, cxfPlugin);
break;
}
// Update cxf plugin with the new wsdl
Map<String, String> wsdlLocationProperties = new HashMap<String, String>();
wsdlLocationProperties.put("wsdl", "${project.basedir}/src/main/resources/" + wsdlName);
wsdlLocationProperties.put("wsdlLocation", "classpath:" + wsdlName);
getProjectOperations().addElementToPluginExecution(wsdlModuleName, cxfPlugin, "generate-sources", "wsdlOptions", "wsdlOption", wsdlLocationProperties);
}
use of org.springframework.roo.project.Plugin in project spring-roo by spring-projects.
the class RepositoryJpaOperationsImpl method generateConfiguration.
@SuppressWarnings({ "unchecked", "rawtypes" })
private void generateConfiguration(JavaType interfaceType, JavaType domainType) {
final Element configuration = XmlUtils.getConfiguration(getClass());
// Add querydsl dependency
final List<Element> dependencies;
final List<Element> plugins;
if (getProjectOperations().isMultimoduleProject()) {
dependencies = XmlUtils.findElements("/configuration/multimodule/dependencies/dependency", configuration);
plugins = XmlUtils.findElements("/configuration/multimodule/plugins/plugin", configuration);
// Add database test dependency
getJpaOperations().addDatabaseDependencyWithTestScope(interfaceType.getModule(), null, null);
} else {
dependencies = XmlUtils.findElements("/configuration/monomodule/dependencies/dependency", configuration);
plugins = XmlUtils.findElements("/configuration/monomodule/plugins/plugin", configuration);
}
for (final Element dependencyElement : dependencies) {
getProjectOperations().addDependency(interfaceType.getModule(), new Dependency(dependencyElement));
}
// Add querydsl plugin
Plugin queryDslPlugin = null;
for (final Element pluginElement : plugins) {
Plugin plugin = new Plugin(pluginElement);
if (plugin.getArtifactId().equals("querydsl-maven-plugin")) {
queryDslPlugin = plugin;
}
getProjectOperations().addBuildPlugin(interfaceType.getModule(), plugin);
}
if (getProjectOperations().isMultimoduleProject()) {
if (queryDslPlugin == null) {
throw new RuntimeException("Error: Missing QueryDSL plugin");
}
// Add entity package to find Q classes.
Set<String> packages = new HashSet();
for (ClassOrInterfaceTypeDetails cid : getTypeLocationService().findClassesOrInterfaceDetailsWithAnnotation(RooJavaType.ROO_REPOSITORY_JPA)) {
if (cid.getType().getModule().equals(interfaceType.getModule())) {
JavaType relatedEntity = (JavaType) cid.getAnnotation(RooJavaType.ROO_REPOSITORY_JPA).getAttribute("entity").getValue();
String module = getTypeLocationService().getTypeDetails(relatedEntity).getType().getModule();
if (!packages.contains(module)) {
packages.add(module);
getProjectOperations().addPackageToPluginExecution(interfaceType.getModule(), queryDslPlugin, "generate-qtypes", getProjectOperations().getTopLevelPackage(module).getFullyQualifiedPackageName());
}
}
}
getProjectOperations().addPackageToPluginExecution(interfaceType.getModule(), queryDslPlugin, "generate-qtypes", getProjectOperations().getTopLevelPackage(domainType.getModule()).getFullyQualifiedPackageName());
} else {
// Add querydsl processor repository
List<Element> repositories = XmlUtils.findElements("/configuration/monomodule/repositories/repository", configuration);
for (final Element repositoryElement : repositories) {
getProjectOperations().addRepository(interfaceType.getModule(), new Repository(repositoryElement));
}
}
}
Aggregations