Search in sources :

Example 71 with Pom

use of org.springframework.roo.project.maven.Pom in project spring-roo by spring-projects.

the class PomManagementServiceImpl method updateProjectMetadataForModules.

private void updateProjectMetadataForModules(final Iterable<Pom> newPoms) {
    for (final Pom pom : newPoms) {
        final String projectMetadataId = ProjectMetadata.getProjectIdentifier(pom.getModuleName());
        getMetadataService().evictAndGet(projectMetadataId);
        getMetadataDependencyRegistry().notifyDownstream(projectMetadataId);
    }
}
Also used : Pom(org.springframework.roo.project.maven.Pom)

Example 72 with Pom

use of org.springframework.roo.project.maven.Pom in project spring-roo by spring-projects.

the class MavenPathResolvingStrategyTest method getMockPom.

private Pom getMockPom(final String rootPath) {
    final Pom mockPom = mock(Pom.class);
    when(mockPom.getRoot()).thenReturn(rootPath);
    return mockPom;
}
Also used : Pom(org.springframework.roo.project.maven.Pom)

Example 73 with Pom

use of org.springframework.roo.project.maven.Pom in project spring-roo by spring-projects.

the class MavenPathResolvingStrategyTest method testGetIdentifierForNewModuleWithEmptyRelativePath.

@Test
public void testGetIdentifierForNewModuleWithEmptyRelativePath() {
    final Pom mockParentPom = getMockPom(POM_PATH);
    when(mockPomManagementService.getFocusedModule()).thenReturn(mockParentPom);
    final String expectedIdentifier = FileUtils.getSystemDependentPath(POM_PATH, NEW_MODULE, PATH_RELATIVE_TO_POM) + File.separator;
    assertIdentifier(null, NEW_MODULE, "", expectedIdentifier);
}
Also used : Pom(org.springframework.roo.project.maven.Pom) Test(org.junit.Test)

Example 74 with Pom

use of org.springframework.roo.project.maven.Pom in project spring-roo by spring-projects.

the class MavenPathResolvingStrategy method getApplicablePhysicalPath.

/**
 * Locates the first {@link PhysicalPath} which can be construed as a parent
 * of the presented identifier.
 *
 * @param identifier to locate the parent of (required)
 * @return the first matching parent, or null if not found
 */
@Override
protected PhysicalPath getApplicablePhysicalPath(final String identifier) {
    Validate.notNull(identifier, "Identifier required");
    PhysicalPath physicalPath = null;
    int longest = 0;
    for (final Pom pom : pomManagementService.getPoms()) {
        if (removeTrailingSeparator(identifier).startsWith(removeTrailingSeparator(pom.getRoot())) && removeTrailingSeparator(pom.getRoot()).length() > longest) {
            longest = removeTrailingSeparator(pom.getRoot()).length();
            int nextLongest = 0;
            for (final PhysicalPath thisPhysicalPath : pom.getPhysicalPaths()) {
                String possibleParent = new FileDetails(thisPhysicalPath.getLocation(), null).getCanonicalPath();
                if (!possibleParent.endsWith(File.separator)) {
                    possibleParent = possibleParent.concat(File.separator);
                }
                if (removeTrailingSeparator(identifier).startsWith(possibleParent) && possibleParent.length() > nextLongest) {
                    nextLongest = possibleParent.length();
                    physicalPath = thisPhysicalPath;
                }
            }
        }
    }
    return physicalPath;
}
Also used : FileDetails(org.springframework.roo.file.monitor.event.FileDetails) Pom(org.springframework.roo.project.maven.Pom)

Example 75 with Pom

use of org.springframework.roo.project.maven.Pom in project spring-roo by spring-projects.

the class MailOperationsImpl method isInstalledInModule.

@Override
public boolean isInstalledInModule(String moduleName) {
    Pom currentPom = getProjectOperations().getPomFromModuleName(moduleName);
    List<Dependency> dependencies = new ArrayList<Dependency>();
    dependencies.add(DEPENDENCY_SPRING_BOOT_STARTER_MAIL);
    dependencies.add(DEPENDENCY_SPRINGLETS_STARTER_MAIL);
    return currentPom.isAllDependenciesRegistered(dependencies);
}
Also used : ArrayList(java.util.ArrayList) Dependency(org.springframework.roo.project.Dependency) Pom(org.springframework.roo.project.maven.Pom)

Aggregations

Pom (org.springframework.roo.project.maven.Pom)86 Element (org.w3c.dom.Element)19 JavaType (org.springframework.roo.model.JavaType)16 Document (org.w3c.dom.Document)16 Test (org.junit.Test)14 ArrayList (java.util.ArrayList)10 ClassOrInterfaceTypeDetails (org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails)9 ClassOrInterfaceTypeDetailsBuilder (org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder)9 AnnotationMetadataBuilder (org.springframework.roo.classpath.details.annotations.AnnotationMetadataBuilder)9 Dependency (org.springframework.roo.project.Dependency)9 RooJavaType (org.springframework.roo.model.RooJavaType)7 InvalidSyntaxException (org.osgi.framework.InvalidSyntaxException)5 ServiceReference (org.osgi.framework.ServiceReference)5 ControllerMVCResponseService (org.springframework.roo.addon.web.mvc.controller.addon.responses.ControllerMVCResponseService)5 JavaPackage (org.springframework.roo.model.JavaPackage)5 List (java.util.List)4 Plugin (org.springframework.roo.project.Plugin)4 Completion (org.springframework.roo.shell.Completion)4 HashMap (java.util.HashMap)3 DataOnDemandCreatorProvider (org.springframework.roo.addon.test.providers.DataOnDemandCreatorProvider)3