Search in sources :

Example 21 with ArtifactRef

use of org.commonjava.maven.atlas.ident.ref.ArtifactRef in project pom-manipulation-ext by release-engineering.

the class DependencyRemovalManipulator method scanDependencies.

private boolean scanDependencies(HashMap<ArtifactRef, Dependency> resolvedDependencies, List<ProjectRef> dependenciesToRemove, List<Dependency> dependencies) {
    boolean result = false;
    if (dependencies != null) {
        for (ArtifactRef pvr : resolvedDependencies.keySet()) {
            if (dependenciesToRemove.contains(pvr.asProjectRef())) {
                logger.debug("Removing {} ", resolvedDependencies.get(pvr));
                dependencies.remove(resolvedDependencies.get(pvr));
                result = true;
            }
        }
    }
    return result;
}
Also used : ArtifactRef(org.commonjava.maven.atlas.ident.ref.ArtifactRef)

Example 22 with ArtifactRef

use of org.commonjava.maven.atlas.ident.ref.ArtifactRef in project pom-manipulation-ext by release-engineering.

the class PluginState method setRemoteRESTOverrides.

public void setRemoteRESTOverrides(Map<ArtifactRef, String> overrides) {
    for (ArtifactRef a : overrides.keySet()) {
        Plugin p = new Plugin();
        p.setGroupId(a.getGroupId());
        p.setArtifactId(a.getArtifactId());
        p.setVersion(overrides.get(a));
        remoteRESTplugins.add(p);
    }
}
Also used : ArtifactRef(org.commonjava.maven.atlas.ident.ref.ArtifactRef) Plugin(org.apache.maven.model.Plugin)

Example 23 with ArtifactRef

use of org.commonjava.maven.atlas.ident.ref.ArtifactRef in project pom-manipulation-ext by release-engineering.

the class ProjectInheritanceTest method testVerifyProjectVersion.

@Test
public void testVerifyProjectVersion() throws Exception {
    final ManipulationSession session = new ManipulationSession();
    final File projectroot = new File(TestUtils.resolveFileResource(RESOURCE_BASE, "").getParentFile().getParentFile().getParentFile().getParentFile(), "integration-test/src/it/project-inheritance/pom.xml");
    PomIO pomIO = new PomIO();
    List<Project> projects = pomIO.parseProject(projectroot);
    for (Project p : projects) {
        if (p.getPom().equals(projectroot)) {
            HashMap<ArtifactRef, Dependency> deps = p.getResolvedManagedDependencies(session);
            for (ArtifactRef a : deps.keySet()) {
                assertFalse(a.getVersionString().contains("project.version"));
            }
            deps = p.getResolvedDependencies(session);
            assertTrue(deps.size() == 1);
            for (ArtifactRef a : deps.keySet()) {
                assertFalse(a.getVersionString().contains("project.version"));
            }
            assertFalse(deps.containsKey("org.mockito:mockito-all:jar:*"));
            deps = p.getAllResolvedDependencies(session);
            assertTrue(deps.size() == 3);
            for (ArtifactRef a : deps.keySet()) {
                assertFalse(a.getVersionString().contains("project.version"));
                if (a.getGroupId().equals("org.mockito")) {
                    assertTrue(a.getVersionString().contains("*"));
                }
            }
            assertTrue(deps.containsKey(SimpleArtifactRef.parse("org.mockito:mockito-all:jar:*")));
        }
    }
}
Also used : Project(org.commonjava.maven.ext.common.model.Project) ManipulationSession(org.commonjava.maven.ext.core.ManipulationSession) Dependency(org.apache.maven.model.Dependency) File(java.io.File) PomIO(org.commonjava.maven.ext.io.PomIO) SimpleArtifactRef(org.commonjava.maven.atlas.ident.ref.SimpleArtifactRef) ArtifactRef(org.commonjava.maven.atlas.ident.ref.ArtifactRef) Test(org.junit.Test)

Example 24 with ArtifactRef

use of org.commonjava.maven.atlas.ident.ref.ArtifactRef in project pom-manipulation-ext by release-engineering.

the class PropertyInterpolatorTest method testResolveProjectDependencies.

@Test
public void testResolveProjectDependencies() throws Exception {
    final Model model = TestUtils.resolveModelResource(RESOURCE_BASE, "infinispan-bom-8.2.0.Final.pom");
    final Project project = new Project(model);
    HashMap<ArtifactRef, Dependency> deps = project.getResolvedManagedDependencies(new ManipulationSession());
    assertTrue(deps.size() == 66);
}
Also used : Project(org.commonjava.maven.ext.common.model.Project) Model(org.apache.maven.model.Model) ManipulationSession(org.commonjava.maven.ext.core.ManipulationSession) Dependency(org.apache.maven.model.Dependency) ArtifactRef(org.commonjava.maven.atlas.ident.ref.ArtifactRef) Test(org.junit.Test)

Aggregations

ArtifactRef (org.commonjava.maven.atlas.ident.ref.ArtifactRef)24 SimpleArtifactRef (org.commonjava.maven.atlas.ident.ref.SimpleArtifactRef)17 Dependency (org.apache.maven.model.Dependency)8 HashMap (java.util.HashMap)7 LinkedHashMap (java.util.LinkedHashMap)6 ManipulationException (org.commonjava.maven.ext.common.ManipulationException)6 Project (org.commonjava.maven.ext.common.model.Project)6 Profile (org.apache.maven.model.Profile)5 ProjectVersionRef (org.commonjava.maven.atlas.ident.ref.ProjectVersionRef)5 File (java.io.File)4 HashSet (java.util.HashSet)4 ProjectRef (org.commonjava.maven.atlas.ident.ref.ProjectRef)4 SimpleScopedArtifactRef (org.commonjava.maven.ext.common.model.SimpleScopedArtifactRef)4 ArrayList (java.util.ArrayList)3 InvalidRefException (org.commonjava.maven.atlas.ident.ref.InvalidRefException)3 SimpleProjectRef (org.commonjava.maven.atlas.ident.ref.SimpleProjectRef)3 ManipulationSession (org.commonjava.maven.ext.core.ManipulationSession)3 DependencyState (org.commonjava.maven.ext.core.state.DependencyState)3 Test (org.junit.Test)3 URI (java.net.URI)2