/** * Returns this module as a Dependency with the given scope and type * * @param scope the DependencyScope to use * @param type the DependencyType to use * @return a non-<code>null</code> instance */ public Dependency asDependency(final DependencyScope scope, final DependencyType type) { return new Dependency(gav, type, scope); }
/** * Adds the given exclusion to this dependency * * @param exclusionGroupId the groupId of the dependency to exclude * (required) * @param exclusionArtifactId the artifactId of the dependency to exclude * (required) */ public void addExclusion(final String exclusionGroupId, final String exclusionArtifactId) { Validate.notBlank(exclusionGroupId, "Excluded groupId required"); Validate.notBlank(exclusionArtifactId, "Excluded artifactId required"); exclusions.add(new Dependency(exclusionGroupId, exclusionArtifactId, "ignored")); }
/** * Returns this module as a Dependency with the given scope * * @param scope the DependencyScope to use * @return a non-<code>null</code> instance */ public Dependency asDependency(final DependencyScope scope) { return new Dependency(gav, DependencyType.valueOfTypeCode(packaging), scope); }
private List<Dependency> getDependencies(final String xPathExpression, final Element configuration) { final List<Dependency> dependencies = new ArrayList<Dependency>(); for (final Element dependencyElement : XmlUtils.findElements(xPathExpression + "/dependencies/dependency", configuration)) { final Dependency dependency = new Dependency(dependencyElement); dependencies.add(dependency); } return dependencies; }
public final void removeDependency(final String moduleName, final String groupId, final String artifactId, final String version, final String classifier) { Validate.isTrue(isProjectAvailable(moduleName), "Dependency modification prohibited at this time"); Validate.notNull(groupId, "Group ID required"); Validate.notNull(artifactId, "Artifact ID required"); Validate.notBlank(version, "Version required"); final Dependency dependency = new Dependency(groupId, artifactId, version, DependencyType.JAR, COMPILE, classifier); removeDependency(moduleName, dependency); }
@Override public final Dependency addDependency(final String moduleName, final String groupId, final String artifactId, final String version, DependencyScope scope, final String classifier, boolean addToDependencyManagement) { Validate.isTrue(isProjectAvailable(moduleName), "Dependency modification prohibited at this time"); Validate.notNull(groupId, "Group ID required"); Validate.notNull(artifactId, "Artifact ID required"); Validate.notBlank(version, "Version required"); if (scope == null) { scope = COMPILE; } final Dependency dependency = new Dependency(groupId, artifactId, version, DependencyType.JAR, scope, classifier); return addDependency(moduleName, dependency, addToDependencyManagement, false); }
/** * Gets database dependency from config file and adds it with test scope * * @param moduleName * the module which dependency should be added * @param databaseConfigPrefix * the prefix name for choosing the dependency to add * @param configuration * the configuration file with the dependencies to copy from */ private void addTestScopedDependency(String moduleName, String databaseConfigPrefix, final Element configuration) { final List<Element> databaseDependencies = XmlUtils.findElements(databaseConfigPrefix + "/dependencies/dependency", configuration); for (final Element dependencyElement : databaseDependencies) { // Change scope from provided to test NodeList childNodes = dependencyElement.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { final Node node = childNodes.item(i); if (node != null && node.getNodeType() == Node.ELEMENT_NODE && node.getNodeName().equals("scope")) { node.setTextContent("test"); } } // Add dependency getProjectOperations().addDependency(moduleName, new Dependency(dependencyElement)); } }
/** * Add Spring Cache starter to provided module. * * @param module the Pom where the starter should be installed. */ private void addSpringCacheDependency(Pom module) { // Parse the configuration.xml file final Element configuration = XmlUtils.getConfiguration(getClass()); final List<Dependency> dependencies = new ArrayList<Dependency>(); final List<Element> auditDependencies = XmlUtils.findElements("/configuration/cache/dependencies/dependency", configuration); for (final Element dependencyElement : auditDependencies) { dependencies.add(new Dependency(dependencyElement)); } getProjectOperations().addDependencies(module.getModuleName(), dependencies); }
exclusions.add(new Dependency(exclusionId, exclusionArtifactId, "ignored"));
@Override public boolean isInstalledInModule(String moduleName) { Pom module = getProjectOperations().getPomFromModuleName(moduleName); for (JavaType javaType : getTypeLocationService().findTypesWithAnnotation( RooJavaType.ROO_WEB_MVC_CONFIGURATION)) { if (javaType.getModule().equals(moduleName) && module.hasDependencyExcludingVersion(new Dependency("org.springframework.boot", "spring-boot-starter-web", null))) { return true; } } return false; }
private void installApplicationConfiguration(String moduleName) { // Add Spring Boot dependences final Element configuration = XmlUtils.getConfiguration(getClass()); final List<Dependency> requiredDependencies = new ArrayList<Dependency>(); final List<Element> dependencies = XmlUtils.findElements("/configuration/dependencies/dependency", configuration); for (final Element dependencyElement : dependencies) { requiredDependencies.add(new Dependency(dependencyElement)); } getProjectOperations().addDependencies(moduleName, requiredDependencies); // Add Plugins List<Element> plugins = XmlUtils.findElements("/configuration/plugins/plugin", configuration); for (Element element : plugins) { Plugin plugin = new Plugin(element); getProjectOperations().addBuildPlugin(moduleName, plugin); } }
for (final Iterator<Element> iter = existingDependencyElements.iterator(); iter.hasNext();) { final Element candidate = iter.next(); final Dependency candidateDependency = new Dependency(candidate); if (candidateDependency.equals(dependencyToRemove)) {
/** * FEATURE Methods */ public boolean isInstalledInModule(final String moduleName) { Pom pom = getProjectOperations().getPomFromModuleName(moduleName); if (pom == null) { return false; } // Check if spring-boot-starter-data-jpa has been included Set<Dependency> dependencies = pom.getDependencies(); Dependency starter = new Dependency("org.springframework.boot", "spring-boot-starter-data-jpa", ""); boolean hasStarter = dependencies.contains(starter); // Check existing application profiles boolean existsSpringConfigProfileInModule = false; List<String> applicationProfiles = getApplicationConfigService().getApplicationProfiles(moduleName); for (String profile : applicationProfiles) { if (getApplicationConfigService().existsSpringConfigFile(moduleName, profile)) { existsSpringConfigProfileInModule = true; break; } } return existsSpringConfigProfileInModule && hasStarter; }
final Element dependenciesElement = XmlUtils.findFirstElement(containingPath, root); for (final Element candidate : XmlUtils.findElements(path, root)) { if (dependency.equals(new Dependency(candidate))) { dependenciesElement.removeChild(candidate); descriptionOfChange =
final String version = DomUtils.getTextContent(versionElement, ""); final Dependency dependency = new Dependency(groupId, artifactId, version);
@Override public void newEmbeddableClass(final JavaType name, final boolean serializable) { Validate.notNull(name, "Embeddable name required"); final String declaredByMetadataId = PhysicalTypeIdentifier.createIdentifier(name, getPathResolver().getFocusedPath(Path.SRC_MAIN_JAVA)); final List<AnnotationMetadataBuilder> annotations = new ArrayList<AnnotationMetadataBuilder>(Arrays.asList(new AnnotationMetadataBuilder( ROO_JAVA_BEAN), new AnnotationMetadataBuilder(ROO_TO_STRING), new AnnotationMetadataBuilder(EMBEDDABLE))); if (serializable) { annotations.add(new AnnotationMetadataBuilder(ROO_SERIALIZABLE)); } final int modifier = Modifier.PUBLIC; final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(declaredByMetadataId, modifier, name, PhysicalTypeCategory.CLASS); cidBuilder.setAnnotations(annotations); getTypeManagementService().createOrUpdateTypeOnDisk(cidBuilder.build()); getProjectOperations().addDependency(name.getModule(), new Dependency("org.springframework.boot", "spring-boot-starter-data-jpa", null)); }
new Dependency("org.springframework.boot", "spring-boot-starter-data-jpa", null))) { List<Dependency> dependencies = new ArrayList<Dependency>(); dependencies.add(new Dependency("org.springframework", "spring-aspects", null)); dependencies.add(new Dependency("org.springframework", "spring-context", null)); dependencies.add(new Dependency("org.springframework.data", "spring-data-jpa", null)); dependencies.add(new Dependency("org.springframework.data", "spring-data-commons", null)); dependencies.add(new Dependency("org.eclipse.persistence", "javax.persistence", null)); getProjectOperations().addDependencies(getProjectOperations().getFocusedModuleName(), dependencies);
projectOperations.addDependency(path.getModule(), new Dependency("javax.validation", "validation-api", null));
projectOperations.addDependency(implType.getModule(), new Dependency("org.springframework", "spring-tx", "", DependencyType.JAR, DependencyScope.COMPILE));
projectOperations.addDependency(interfaceType.getModule(), new Dependency("io.springlets", "springlets-data-commons", null));