Package org.springframework.roo.project.maven

Examples of org.springframework.roo.project.maven.Pom


        if (pAddJsr160Proxy) {
            pDependencyElements.addAll(pJsr160DepElements);
        } else {
            // Check, whether there is already a jsr160 dependency present. If so, add it again
            // so that it gets properly update if an dep update operation is performed.
            Pom pom = projectOperations.getFocusedModule();
            for (Element jsr160DepElement : pJsr160DepElements) {
                Dependency jsr160Dep = new Dependency(jsr160DepElement);
                for (Dependency dep: pom.getDependencies()) {
                    if (dep.hasSameCoordinates(jsr160Dep)) {
                        pDependencyElements.add(jsr160DepElement);
                    }
                }               
            }
View Full Code Here


            }
        }
    }

    private void addRepository(Element configuration) {
        Pom pom = projectOperations.getFocusedModule();
        // Check whether we are a snapshot version, if so, we are adding our snapshot repository
        List<Element> versions =
                XmlUtils.findElements("/configuration/jolokia/dependencies/dependency/version", configuration);
        boolean isSnapshot = false;
        for (Element version : versions) {
            if (version.getTextContent().matches(".*SNAPSHOT$")) {
                isSnapshot = true;
                break;
            }
        }

        List<Element> repositories =
                isSnapshot ?
                        XmlUtils.findElements("/configuration/jolokia/snapshots-repositories/repository", configuration) :
                        XmlUtils.findElements("/configuration/jolokia/repositories/repository", configuration);

        for (Element repositoryElement : repositories) {
            Repository repository = new Repository(repositoryElement);
            projectOperations.addRepository(pom.getModuleName(),repository);
        }
    }
View Full Code Here

    private static final String ROOT_MID = PROJECT_MID_PREFIX;

    @Test
    public void testConstructorForLevelTwoModule() {
        // Set up
        final Pom mockPom = mock(Pom.class);
        when(mockPom.getModuleName()).thenReturn(LEVEL_TWO_MODULE);

        // Invoke
        final ProjectMetadata projectMetadata = new ProjectMetadata(mockPom);

        // Check
View Full Code Here

        return FeatureNames.SECURITY;
    }

    @Override
    public boolean isInstalledInModule(String moduleName) {
        final Pom pom = projectOperations.getPomFromModuleName(moduleName);
        if (pom == null) {
            return false;
        }
        for (final Dependency dependency : pom.getDependencies()) {
            if ("spring-security-core".equals(dependency.getArtifactId())) {
                return true;
            }
        }
        return false;
View Full Code Here

            throw new AssertionFailedError(e.getMessage());
        }
    }

    private Pom getMockPom(final String moduleName, final String canonicalPath) {
        final Pom mockPom = mock(Pom.class);
        when(mockPom.getModuleName()).thenReturn(moduleName);
        when(mockPom.getPath()).thenReturn(canonicalPath);
        when(
                mockPomFactory.getInstance(any(Element.class),
                        eq(canonicalPath), eq(moduleName))).thenReturn(mockPom);
        return mockPom;
    }
View Full Code Here

        final String canonicalPath = getCanonicalPath("single/pom.xml");
        when(
                mockFileMonitorService
                        .getDirtyFiles(PomManagementServiceImpl.class.getName()))
                .thenReturn(Arrays.asList(canonicalPath));
        final Pom mockPom = getMockPom(ROOT_MODULE_NAME, canonicalPath);

        // Invoke
        final Collection<Pom> poms = service.getPoms();

        // Check
View Full Code Here

        when(
                mockFileMonitorService
                        .getDirtyFiles(PomManagementServiceImpl.class.getName()))
                .thenReturn(dirtyFiles);

        final Pom mockRootPom = getMockPom(ROOT_MODULE_NAME,
                rootPomCanonicalPath);
        final String childModuleName = "foo-child";
        final Pom mockChildPom = getMockPom(childModuleName,
                childPomCanonicalPath);

        when(mockFileManager.getInputStream(rootPomCanonicalPath)).thenReturn(
                getClass().getResourceAsStream(rootPom));
        when(mockFileManager.getInputStream(childPomCanonicalPath)).thenReturn(
View Full Code Here

        when(
                mockFileMonitorService
                        .getDirtyFiles(PomManagementServiceImpl.class.getName()))
                .thenReturn(dirtyFiles);

        final Pom mockRootPom = getMockPom(ROOT_MODULE_NAME,
                rootPomCanonicalPath);
        final String childModuleName = "foo-child";
        final Pom mockChildPom = getMockPom(childModuleName,
                childPomCanonicalPath);

        when(mockFileManager.getInputStream(rootPomCanonicalPath)).thenReturn(
                getClass().getResourceAsStream(rootPom));
        when(mockFileManager.getInputStream(childPomCanonicalPath)).thenReturn(
View Full Code Here

            }
            return result;
        }

        String topLevelPath;
        Pom module = projectOperations.getFocusedModule();

        if (value.contains(MODULE_PATH_SEPARATOR)) {
            final String moduleName = value.substring(0,
                    value.indexOf(MODULE_PATH_SEPARATOR));
            module = projectOperations.getPomFromModuleName(moduleName);
View Full Code Here

            final List<Completion> completions, final String existingData,
            final String optionContext) {
        if (!projectOperations.isFocusedProjectAvailable()) {
            return;
        }
        final Pom targetModule;
        final String heading;
        final String prefix;
        final String formattedPrefix;
        final String typeName;
        if (existingData.contains(MODULE_PATH_SEPARATOR)) {
            // Looking for a type in another module
            final String targetModuleName = existingData.substring(0,
                    existingData.indexOf(MODULE_PATH_SEPARATOR));
            targetModule = projectOperations
                    .getPomFromModuleName(targetModuleName);
            heading = "";
            prefix = targetModuleName + MODULE_PATH_SEPARATOR;
            formattedPrefix = decorate(
                    targetModuleName + MODULE_PATH_SEPARATOR, FG_CYAN);
            typeName = StringUtils.substringAfterLast(existingData,
                    MODULE_PATH_SEPARATOR);
        }
        else {
            // Looking for a type in the currently focused module
            targetModule = projectOperations.getFocusedModule();
            heading = targetModule.getModuleName();
            prefix = "";
            formattedPrefix = "";
            typeName = existingData;
        }
        final String topLevelPackage = typeLocationService
                .getTopLevelPackageForModule(targetModule);
        final String basePackage = resolveTopLevelPackageSymbol(typeName,
                topLevelPackage);

        addCompletionsForOtherModuleNames(completions, targetModule);

        if (!"pom".equals(targetModule.getPackaging())) {
            addCompletionsForTypesInTargetModule(completions, optionContext,
                    targetModule, heading, prefix, formattedPrefix,
                    topLevelPackage, basePackage);
        }
    }
View Full Code Here

TOP

Related Classes of org.springframework.roo.project.maven.Pom

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.