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);
}
}
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;
}
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);
}
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;
}
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);
}
Aggregations