Search in sources :

Example 6 with Parent

use of org.apache.maven.model.Parent in project intellij-community by JetBrains.

the class Maven3AetherModelConverter method convertModelWithAetherDependencyTree.

@NotNull
public static MavenModel convertModelWithAetherDependencyTree(Model model, List<String> sources, List<String> testSources, Collection<Artifact> dependencies, Collection<DependencyNode> dependencyTree, Collection<Artifact> extensions, File localRepository) throws RemoteException {
    MavenModel result = new MavenModel();
    result.setMavenId(new MavenId(model.getGroupId(), model.getArtifactId(), model.getVersion()));
    Parent parent = model.getParent();
    if (parent != null) {
        result.setParent(new MavenParent(new MavenId(parent.getGroupId(), parent.getArtifactId(), parent.getVersion()), parent.getRelativePath()));
    }
    result.setPackaging(model.getPackaging());
    result.setName(model.getName());
    result.setProperties(model.getProperties() == null ? new Properties() : model.getProperties());
    result.setPlugins(convertPlugins(model));
    Map<Artifact, MavenArtifact> convertedArtifacts = new THashMap<Artifact, MavenArtifact>();
    result.setExtensions(convertArtifacts(extensions, convertedArtifacts, localRepository));
    result.setDependencyTree(convertAetherDependencyNodes(null, dependencyTree, convertedArtifacts, localRepository));
    result.setDependencies(convertArtifacts(dependencies, convertedArtifacts, localRepository));
    result.setRemoteRepositories(convertRepositories(model.getRepositories()));
    result.setProfiles(convertProfiles(model.getProfiles()));
    result.setModules(model.getModules());
    convertBuild(result.getBuild(), model.getBuild(), sources, testSources);
    return result;
}
Also used : THashMap(gnu.trove.THashMap) Parent(org.apache.maven.model.Parent) Artifact(org.apache.maven.artifact.Artifact) NotNull(org.jetbrains.annotations.NotNull)

Example 7 with Parent

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

the class InstallMojo method copyParentPoms.

/**
     * Installs all parent POMs of the specified POM file that are available in the local repository.
     *
     * @param pomFile The path to the POM file whose parents should be installed, must not be <code>null</code>.
     * @throws MojoExecutionException If any (existing) parent POM could not be installed.
     */
private void copyParentPoms(File pomFile) throws MojoExecutionException {
    Model model = PomUtils.loadPom(pomFile);
    Parent parent = model.getParent();
    if (parent != null) {
        copyParentPoms(parent.getGroupId(), parent.getArtifactId(), parent.getVersion());
    }
}
Also used : Parent(org.apache.maven.model.Parent) Model(org.apache.maven.model.Model)

Example 8 with Parent

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

the class DeployFileMojoUnitTest method setUp.

public void setUp() {
    Model pomModel = new Model();
    pomModel.setPackaging(null);
    parent = new Parent();
    parent.setGroupId("parentGroup");
    parent.setArtifactId("parentArtifact");
    parent.setVersion("parentVersion");
    mojo = new MockDeployFileMojo(pomModel);
}
Also used : Parent(org.apache.maven.model.Parent) Model(org.apache.maven.model.Model)

Aggregations

Parent (org.apache.maven.model.Parent)8 Model (org.apache.maven.model.Model)5 Artifact (org.apache.maven.artifact.Artifact)3 THashMap (gnu.trove.THashMap)2 Properties (java.util.Properties)2 Build (org.apache.maven.model.Build)2 MavenKey (org.eclipse.che.maven.data.MavenKey)2 MavenModel (org.eclipse.che.maven.data.MavenModel)2 MavenParent (org.eclipse.che.maven.data.MavenParent)2 NotNull (org.jetbrains.annotations.NotNull)2 ImmutableMap (com.google.common.collect.ImmutableMap)1 File (java.io.File)1 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 CiManagement (org.apache.maven.model.CiManagement)1 Contributor (org.apache.maven.model.Contributor)1 Dependency (org.apache.maven.model.Dependency)1 DependencyManagement (org.apache.maven.model.DependencyManagement)1