1 Reply Latest reply on Apr 25, 2015 11:44 AM by jyothiprasadb

    How to add Parent POM to an existing POM using Forge API

    jyothiprasadb

      I'm creating an addon that updates the existing POM, I'm able to add dependencies, repository, and various other information using DependencyFacet, MavenFacet etc., However, I'm unable to figure out how to add a parent POM. Following is the code I tried and it didn't work. Any help is appreciated as to which facet I can use and what is the syntax to use it.

       

           Parent p = new Parent();
           p.setGroupId("org.codehaus.griffon");
           p.setArtifactId("application-master-pom");
           p.setVersion("1.1.0");
           MavenFacet mavenFacet = getFaceted().getFacet(MavenFacet.class);
           mavenFacet.getModel().setParent(p);


        • 1. Re: How to add Parent POM to an existing POM using Forge API
          jyothiprasadb

          I found the answer after some trail and errors...

           

           

              Parent p = new Parent();
              p.setGroupId("org.codehaus.griffon");
              p.setArtifactId("application-master-pom");
              p.setVersion("1.0.0");
              MavenFacet mavenFacet = getFaceted().getFacet(MavenFacet.class);
              Model model = mavenFacet.getModel();
              model.setParent(p);
              mavenFacet.setModel(model);