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

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

Introduction

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

Prototype

public String getArtifactId() 

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   w  ww  .  j ava2 s .c  o m
            addReposIfNeeded(pom, bom.getRepos());
        }
    }
}

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

private static Element createBom(Element parentList, Bom bom) {
    /*/* ww  w  .  j a v a2  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;
}