Example usage for org.springframework.ide.eclipse.boot.core Bom getGroupId

List of usage examples for org.springframework.ide.eclipse.boot.core Bom getGroupId

Introduction

In this page you can find the example usage for org.springframework.ide.eclipse.boot.core Bom getGroupId.

Prototype

public String getGroupId() 

Source Link

Usage

From source file:org.springframework.ide.eclipse.boot.core.internal.MavenSpringBootProject.java

private void createBomIfNeeded(Document pom, Bom bom) {
    if (bom != null) {
        Element bomList = ensureDependencyMgmtSection(pom);
        Element existing = PomEdits.findChild(bomList, DEPENDENCY, childEquals(GROUP_ID, bom.getGroupId()),
                childEquals(ARTIFACT_ID, bom.getArtifactId()));
        if (existing == null) {
            createBom(bomList, bom);//from   ww  w .  j a va2  s  .  c om
            addReposIfNeeded(pom, bom.getRepos());
        }
    }
}

From source file:org.springframework.ide.eclipse.boot.core.internal.MavenSpringBootProject.java

private static Element createBom(Element parentList, Bom bom) {
    /*/*from w  w  w.j a  v  a  2 s .  c o m*/
    <dependencyManagement>
    <dependencies> <---- parentList
       <dependency> <---- create and return
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-parent</artifactId>
    <version>Brixton.M3</version>
    <type>pom</type>
    <scope>import</scope>
       </dependency>
    </dependencies>
    </dependencyManagement>
     */

    String groupId = bom.getGroupId();
    String artifactId = bom.getArtifactId();
    String version = bom.getVersion();
    String classifier = bom.getClassifier();
    String type = "pom";
    String scope = "import";

    Element dep = createElement(parentList, DEPENDENCY);

    if (groupId != null) {
        createElementWithText(dep, GROUP_ID, groupId);
    }
    createElementWithText(dep, ARTIFACT_ID, artifactId);
    if (version != null) {
        createElementWithText(dep, VERSION, version);
    }
    createElementWithText(dep, TYPE, type);
    if (scope != null && !scope.equals("compile")) {
        createElementWithText(dep, SCOPE, scope);
    }
    if (classifier != null) {
        createElementWithText(dep, CLASSIFIER, classifier);
    }
    format(dep);
    return dep;
}