Search in sources :

Example 26 with Parent

use of org.apache.maven.model.Parent in project maven-archetype by apache.

the class DefaultPomManager method addParent.

public void addParent(File pom, File parentPom) throws IOException, XmlPullParserException {
    Model generatedModel = readPom(pom);
    if (null != generatedModel.getParent()) {
        getLogger().info("Parent element not overwritten in " + pom);
        return;
    }
    Model parentModel = readPom(parentPom);
    Parent parent = new Parent();
    parent.setGroupId(parentModel.getGroupId());
    if (parent.getGroupId() == null) {
        parent.setGroupId(parentModel.getParent().getGroupId());
    }
    parent.setArtifactId(parentModel.getArtifactId());
    parent.setVersion(parentModel.getVersion());
    if (parent.getVersion() == null) {
        parent.setVersion(parentModel.getParent().getVersion());
    }
    generatedModel.setParent(parent);
    writePom(generatedModel, pom, pom);
}
Also used : Parent(org.apache.maven.model.Parent) Model(org.apache.maven.model.Model)

Aggregations

Parent (org.apache.maven.model.Parent)26 Model (org.apache.maven.model.Model)13 Build (org.apache.maven.model.Build)5 File (java.io.File)4 Properties (java.util.Properties)4 Test (org.junit.Test)4 Artifact (org.apache.maven.artifact.Artifact)3 Dependency (org.apache.maven.model.Dependency)3 SimpleProjectVersionRef (org.commonjava.maven.atlas.ident.ref.SimpleProjectVersionRef)3 ArtifactCoordinates (com.itemis.maven.aether.ArtifactCoordinates)2 ReleasePhase (com.itemis.maven.plugins.unleash.ReleasePhase)2 THashMap (gnu.trove.THashMap)2 IOException (java.io.IOException)2 InputStream (java.io.InputStream)2 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 DependencyManagement (org.apache.maven.model.DependencyManagement)2 ProjectVersionRef (org.commonjava.maven.atlas.ident.ref.ProjectVersionRef)2 MavenKey (org.eclipse.che.maven.data.MavenKey)2 MavenModel (org.eclipse.che.maven.data.MavenModel)2