当前位置: 首页>>代码示例>>Java>>正文


Java Pom类代码示例

本文整理汇总了Java中org.springframework.roo.project.maven.Pom的典型用法代码示例。如果您正苦于以下问题:Java Pom类的具体用法?Java Pom怎么用?Java Pom使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Pom类属于org.springframework.roo.project.maven包,在下文中一共展示了Pom类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isInstalledInModule

import org.springframework.roo.project.maven.Pom; //导入依赖的package包/类
/**
 * Returns true if gvNIX Web MVC dependency is installed in current project.
 * 
 * @param moduleName feature name to check in current project
 * @return true if given feature name is installed, otherwise returns false
 */
public boolean isInstalledInModule(final String moduleName) {
    final Pom pom = getProjectOperations().getPomFromModuleName(moduleName);
    if (pom == null) {
        return false;
    }

    // Look for gvnix web mvc dependency
    for (final Dependency dependency : pom.getDependencies()) {
        if ("org.gvnix.addon.web.mvc.annotations".equals(dependency
                .getArtifactId())) {
            return true;
        }
    }
    return false;
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:22,代码来源:MvcOperationsImpl.java

示例2: addModuleDependency

import org.springframework.roo.project.maven.Pom; //导入依赖的package包/类
public void addModuleDependency(final String moduleToDependUpon) {
    if (StringUtils.isBlank(moduleToDependUpon)) {
        return; // No need to ever add a dependency upon the root POM
    }
    final Pom focusedModule = getFocusedModule();
    if (focusedModule != null
            && StringUtils.isNotBlank(focusedModule.getModuleName())
            && !moduleToDependUpon.equals(focusedModule.getModuleName())) {
        final ProjectMetadata dependencyProject = getProjectMetadata(moduleToDependUpon);
        if (dependencyProject != null) {
            final Pom dependencyPom = dependencyProject.getPom();
            if (!dependencyPom.getPath().equals(focusedModule.getPath())) {
                final Dependency dependency = dependencyPom
                        .asDependency(COMPILE);
                if (!focusedModule
                        .hasDependencyExcludingVersion(dependency)) {
                    addDependency(focusedModule.getModuleName(), dependency);
                    detectCircularDependency(focusedModule, dependencyPom);
                }
            }
        }
    }
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:24,代码来源:AbstractProjectOperations.java

示例3: addResource

import org.springframework.roo.project.maven.Pom; //导入依赖的package包/类
public void addResource(final String moduleName, final Resource resource) {
    Validate.isTrue(isProjectAvailable(moduleName),
            "Resource modification prohibited at this time");
    Validate.notNull(resource, "Resource to add required");
    final Pom pom = getPomFromModuleName(moduleName);
    Validate.notNull(pom,
            "The pom is not available, so resource addition cannot be performed");
    if (pom.isResourceRegistered(resource)) {
        return;
    }

    final Document document = XmlUtils.readXml(fileManager
            .getInputStream(pom.getPath()));
    final Element buildElement = XmlUtils.findFirstElement(
            "/project/build", document.getDocumentElement());
    final Element resourcesElement = DomUtils.createChildIfNotExists(
            "resources", buildElement, document);
    resourcesElement.appendChild(resource.getElement(document));
    final String descriptionOfChange = highlight(ADDED + " resource") + " "
            + resource.getSimpleDescription();

    fileManager.createOrUpdateTextFileIfRequired(pom.getPath(),
            XmlUtils.nodeToString(document), descriptionOfChange, false);
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:25,代码来源:AbstractProjectOperations.java

示例4: dependenciesRegistered

import org.springframework.roo.project.maven.Pom; //导入依赖的package包/类
/**
 * Check if all dependencies are registered in project (pom.xml).
 * 
 * @param type Web service type
 * @return true if all dependencies are registed already
 */
protected boolean dependenciesRegistered(WsType type) {

    // Get project to check installed dependencies
    ProjectMetadata project = (ProjectMetadata) getMetadataService().get(
            ProjectMetadata.getProjectIdentifier(getProjectOperations()
                    .getFocusedModuleName()));
    if (project == null) {
        return false;
    }

    // Iterate all dependencies
    for (Element dependency : getDependencies(type)) {

        // Some dependency not registered: all dependencies not installed
        Pom pom = project.getPom();
        if (!pom.isDependencyRegistered(new Dependency(dependency))) {
            return false;
        }
    }

    // All dependencies are installed
    return true;
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:30,代码来源:WSConfigServiceImpl.java

示例5: updateBuildPlugin

import org.springframework.roo.project.maven.Pom; //导入依赖的package包/类
public void updateBuildPlugin(final String moduleName, final Plugin plugin) {
    final Pom pom = getPomFromModuleName(moduleName);
    Validate.notNull(pom,
            "The pom is not available, so plugins cannot be modified at this time");
    Validate.notNull(plugin, "Plugin required");
    for (final Plugin existingPlugin : pom.getBuildPlugins()) {
        if (existingPlugin.equals(plugin)) {
            // Already exists, so just quit
            return;
        }
    }

    // Delete any existing plugin with a different version
    removeBuildPlugin(moduleName, plugin);

    // Add the plugin
    addBuildPlugin(moduleName, plugin);
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:19,代码来源:AbstractProjectOperations.java

示例6: updateProjectType

import org.springframework.roo.project.maven.Pom; //导入依赖的package包/类
public void updateProjectType(final String moduleName,
        final ProjectType projectType) {
    Validate.notNull(projectType, "Project type required");
    final Pom pom = getPomFromModuleName(moduleName);
    Validate.notNull(pom,
            "The pom is not available, so the project type cannot be changed");

    final Document document = XmlUtils.readXml(fileManager
            .getInputStream(pom.getPath()));
    final Element packaging = DomUtils.createChildIfNotExists("packaging",
            document.getDocumentElement(), document);
    if (packaging.getTextContent().equals(projectType.getType())) {
        return;
    }

    packaging.setTextContent(projectType.getType());
    final String descriptionOfChange = highlight(UPDATED + " project type")
            + " to " + projectType.getType();

    fileManager.createOrUpdateTextFileIfRequired(pom.getPath(),
            XmlUtils.nodeToString(document), descriptionOfChange, false);
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:23,代码来源:AbstractProjectOperations.java

示例7: getModuleForFileIdentifier

import org.springframework.roo.project.maven.Pom; //导入依赖的package包/类
public Pom getModuleForFileIdentifier(final String fileIdentifier) {
    updatePomCache();
    String startingPoint = FileUtils.getFirstDirectory(fileIdentifier);
    String pomPath = FileUtils.ensureTrailingSeparator(startingPoint)
            + DEFAULT_POM_NAME;
    File pom = new File(pomPath);
    while (!pom.exists()) {
        if (startingPoint.equals(SEPARATOR)) {
            break;
        }
        startingPoint = StringUtils.removeEnd(startingPoint, SEPARATOR);
        
        if (startingPoint.lastIndexOf(SEPARATOR) < 0) {
        	break;
        }
        startingPoint = startingPoint.substring(0,
                startingPoint.lastIndexOf(SEPARATOR));
        startingPoint = StringUtils.removeEnd(startingPoint, SEPARATOR);

        pomPath = FileUtils.ensureTrailingSeparator(startingPoint)
                + DEFAULT_POM_NAME;
        pom = new File(pomPath);
    }
    return getPomFromPath(pomPath);
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:26,代码来源:PomManagementServiceImpl.java

示例8: isInstalledInModule

import org.springframework.roo.project.maven.Pom; //导入依赖的package包/类
/**
 * Returns true if the given feature is installed in current project.
 * 
 * @param moduleName feature name to check in current project
 * @return true if given feature name is installed, otherwise returns false
 */
public boolean isInstalledInModule(final String moduleName) {
    final Pom pom = getProjectOperations().getPomFromModuleName(moduleName);
    if (pom == null) {
        return false;
    }

    // Look for gvnix jpa dependency
    for (final Dependency dependency : pom.getDependencies()) {
        if ("org.gvnix.addon.jpa.annotations".equals(dependency
                .getArtifactId())) {
            return true;
        }
    }
    return false;
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:22,代码来源:JpaOperationsImpl.java

示例9: testConvertTopLevelPackageWithOneModulePrefix

import org.springframework.roo.project.maven.Pom; //导入依赖的package包/类
@Test
public void testConvertTopLevelPackageWithOneModulePrefix() {
    // Set up
    final String moduleName = "web";
    final Pom mockWebPom = mock(Pom.class);
    when(mockProjectOperations.getPomFromModuleName(moduleName))
            .thenReturn(mockWebPom);
    final String topLevelPackage = "com.example.app.mvc";
    when(mockTypeLocationService.getTopLevelPackageForModule(mockWebPom))
            .thenReturn(topLevelPackage);

    // Invoke
    final JavaType result = converter.convertFromText(moduleName
            + MODULE_PATH_SEPARATOR + topLevelPackage, null, null);

    // Check
    assertNull(result);
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:19,代码来源:JavaTypeConverterTest.java

示例10: testGetPomOfSingleModuleProjectWhenParentHasNoRelativePath

import org.springframework.roo.project.maven.Pom; //导入依赖的package包/类
@Test
public void testGetPomOfSingleModuleProjectWhenParentHasNoRelativePath()
        throws Exception {
    // Set up
    setUpWorkingDirectory("single");
    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
    assertEquals(1, poms.size());
    assertEquals(mockPom, poms.iterator().next());
    verifyProjectMetadataNotification(ROOT_MODULE_NAME);
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:21,代码来源:PomManagementServiceImplTest.java

示例11: testGetPomsWhenOneEmptyPomIsDirty

import org.springframework.roo.project.maven.Pom; //导入依赖的package包/类
@Test
public void testGetPomsWhenOneEmptyPomIsDirty() throws Exception {
    // Set up
    final Collection<String> dirtyFiles = Arrays
            .asList(getCanonicalPath("empty/pom.xml"));
    when(
            mockFileMonitorService
                    .getDirtyFiles(PomManagementServiceImpl.class.getName()))
            .thenReturn(dirtyFiles);

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

    // Check
    assertEquals(0, poms.size());
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:17,代码来源:PomManagementServiceImplTest.java

示例12: addCompletionsForTypesInTargetModule

import org.springframework.roo.project.maven.Pom; //导入依赖的package包/类
private void addCompletionsForTypesInTargetModule(
        final List<Completion> completions, final String optionContext,
        final Pom targetModule, final String heading, final String prefix,
        final String formattedPrefix, final String topLevelPackage,
        final String basePackage) {
    final Collection<JavaType> typesInModule = getTypesForModule(
            optionContext, targetModule);
    if (typesInModule.isEmpty()) {
        completions.add(new Completion(prefix + targetModule.getGroupId(),
                formattedPrefix + targetModule.getGroupId(), heading, 1));
    }
    else {
        completions.add(new Completion(prefix + topLevelPackage,
                formattedPrefix + topLevelPackage, heading, 1));
        for (final JavaType javaType : typesInModule) {
            String type = javaType.getFullyQualifiedTypeName();
            if (type.startsWith(basePackage)) {
                type = StringUtils.replace(type, topLevelPackage,
                        TOP_LEVEL_PACKAGE_SYMBOL, 1);
                completions.add(new Completion(prefix + type,
                        formattedPrefix + type, heading, 1));
            }
        }
    }
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:26,代码来源:JavaTypeConverter.java

示例13: assertIdentifier

import org.springframework.roo.project.maven.Pom; //导入依赖的package包/类
/**
 * Asserts that calling
 * {@link MavenPathResolvingStrategy#getIdentifier(LogicalPath, String)}
 * with the given parameters results in the given expected identifier.
 * 
 * @param pom the POM that the mock {@link PomManagementService} should
 *            return for the given module name (can be <code>null</code>)
 * @param module the module to be returned by the {@link LogicalPath}
 * @param relativePath cannot be <code>null</code>
 * @param expectedIdentifier
 */
private void assertIdentifier(final Pom pom, final String module,
        final String relativePath, final String expectedIdentifier) {
    // Set up
    final LogicalPath mockContextualPath = getMockContextualPath(module,
            pom);
    when(mockPomManagementService.getPomFromModuleName(module)).thenReturn(
            pom);

    // Invoke
    final String identifier = strategy.getIdentifier(mockContextualPath,
            relativePath);

    // Check
    assertEquals(expectedIdentifier, identifier.replaceFirst("[A-Z]:", ""));
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:27,代码来源:MavenPathResolvingStrategyTest.java

示例14: isInstalledInModule

import org.springframework.roo.project.maven.Pom; //导入依赖的package包/类
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 ("com.force.sdk".equals(buildPlugin.getArtifactId())) {
            return true;
        }
    }
    return false;
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:20,代码来源:DatabaseDotComOperationsImpl.java

示例15: isInstalledInModule

import org.springframework.roo.project.maven.Pom; //导入依赖的package包/类
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;
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:20,代码来源:GaeOperationsImpl.java


注:本文中的org.springframework.roo.project.maven.Pom类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。