Search in sources :

Example 6 with MavenUniverseInstaller

use of org.jboss.galleon.universe.maven.MavenUniverseInstaller in project galleon by wildfly.

the class MvnUniverse method install.

public MavenArtifact install() throws ProvisioningException {
    final MavenArtifact universeArtifact = new MavenArtifact().setGroupId(TestConstants.GROUP_ID).setArtifactId(name).setVersion("1.0.0.Final");
    final MavenUniverseInstaller installer = new MavenUniverseInstaller(repoManager, universeArtifact);
    for (MavenProducerBase p : producers) {
        installer.addProducer(p.getName(), p.getArtifact().setPath(null).setVersionRange("[1.0,)"));
    }
    installer.install();
    return universeArtifact;
}
Also used : MavenProducerBase(org.jboss.galleon.universe.maven.MavenProducerBase) MavenUniverseInstaller(org.jboss.galleon.universe.maven.MavenUniverseInstaller) MavenArtifact(org.jboss.galleon.universe.maven.MavenArtifact)

Example 7 with MavenUniverseInstaller

use of org.jboss.galleon.universe.maven.MavenUniverseInstaller in project galleon by wildfly.

the class SimpleUniverseFactoryLoaderTestCase method doInit.

@Override
public void doInit() throws Exception {
    MavenArtifact artifact = new MavenArtifact().setGroupId(GROUP_ID).setArtifactId("producer-artifact1").setVersion("1.0.0.Final");
    MavenProducerInstaller producerInstaller = new MavenProducerInstaller("producer1", repo, artifact, FP_GROUP_ID, FP_ARTIFACT_ID);
    producerInstaller.addChannel("5", "[5.0,6.0)");
    producerInstaller.addFrequencies("alpha", "beta");
    producerInstaller.install();
    artifact = new MavenArtifact().setGroupId(GROUP_ID).setArtifactId(UNIVERSE_ARTIFACT_ID).setVersion("1.0.0.Final");
    final MavenUniverseInstaller universeInstaller = new MavenUniverseInstaller(repo, artifact);
    universeInstaller.addProducer("producer1", GROUP_ID, "producer-artifact1", "[1.0.0,2.0.0)");
    universeInstaller.install();
}
Also used : MavenProducerInstaller(org.jboss.galleon.universe.maven.MavenProducerInstaller) MavenUniverseInstaller(org.jboss.galleon.universe.maven.MavenUniverseInstaller) MavenArtifact(org.jboss.galleon.universe.maven.MavenArtifact)

Example 8 with MavenUniverseInstaller

use of org.jboss.galleon.universe.maven.MavenUniverseInstaller in project galleon by wildfly.

the class MavenUniverseFeaturePackCreatorTestCase method doInit.

@Override
protected void doInit() throws Exception {
    final MavenProducerInstaller producer1 = new MavenProducerInstaller("producer1", repo, new MavenArtifact().setGroupId("universe.producer.maven.test").setArtifactId("maven-producer1").setVersion("1.0.0.Final"), "universe.feature-pack.maven.test", "feature-pack1").addFrequencies("alpha", "beta").addChannel("1.0", "[1.0.0,2.0.0)").install();
    new MavenUniverseInstaller(repo, new MavenArtifact().setGroupId("universe.maven.test").setArtifactId("maven-universe1").setVersion("1.0.0.Final")).addProducer(producer1.getName(), producer1.getArtifact().setPath(null).setVersionRange("[1.0,2.0-alpha)")).install();
    FeaturePackCreator.getInstance().addArtifactResolver(repo).newFeaturePack().setFPID(FeaturePackLocation.fromString("producer1@" + MavenUniverseFactory.ID + "(universe.maven.test:maven-universe1:[1.0,2.0-alpha)):1.0#1.0.0.Final").getFPID()).newPackage("p1", true).writeContent("p1.txt", "p1 text").getFeaturePack().getCreator().install();
}
Also used : MavenProducerInstaller(org.jboss.galleon.universe.maven.MavenProducerInstaller) MavenUniverseInstaller(org.jboss.galleon.universe.maven.MavenUniverseInstaller) MavenArtifact(org.jboss.galleon.universe.maven.MavenArtifact)

Example 9 with MavenUniverseInstaller

use of org.jboss.galleon.universe.maven.MavenUniverseInstaller in project galleon by wildfly.

the class CreateUniverseMojo method execute.

@Override
public void execute() throws MojoExecutionException, MojoFailureException {
    if (skip) {
        getLog().info("Skipping the create-universe goal.");
        return;
    }
    final MavenArtifact universeArtifact = new MavenArtifact().setGroupId(groupId).setArtifactId(artifactId).setVersion(version);
    final MavenUniverseInstaller installer = new MavenUniverseInstaller(SimplisticMavenRepoManager.getInstance(Paths.get(project.getBuild().getDirectory()).resolve("local-repo"), new MavenArtifactRepositoryManager(repoSystem, repoSession, repositories)), universeArtifact);
    final Set<String> names = new HashSet<>(producers.size());
    for (ProducerSpec producer : producers) {
        if (!names.add(producer.name)) {
            throw new MojoExecutionException("Duplicate producer " + producer.name);
        }
        try {
            installer.addProducer(producer.name, producer.groupId, producer.artifactId, producer.versionRange);
        } catch (MavenUniverseException e) {
            throw new MojoExecutionException("Failed to add producer " + producer.name, e);
        }
    }
    try {
        installer.install();
    } catch (MavenUniverseException e) {
        throw new MojoExecutionException("Failed to create universe", e);
    }
    projectHelper.attachArtifact(project, "jar", universeArtifact.getPath().toFile());
}
Also used : MavenUniverseInstaller(org.jboss.galleon.universe.maven.MavenUniverseInstaller) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) MavenArtifactRepositoryManager(org.jboss.galleon.maven.plugin.util.MavenArtifactRepositoryManager) MavenArtifact(org.jboss.galleon.universe.maven.MavenArtifact) MavenUniverseException(org.jboss.galleon.universe.maven.MavenUniverseException) HashSet(java.util.HashSet)

Example 10 with MavenUniverseInstaller

use of org.jboss.galleon.universe.maven.MavenUniverseInstaller in project galleon by wildfly.

the class MavenUniverseExtendAndInstallTestCase method testMain.

@Test
public void testMain() throws Exception {
    MavenUniverseInstaller universeInstaller = new MavenUniverseInstaller(repo, universe100Artifact);
    universeInstaller.addProducer("producer1", GROUP_ID, "producer1", "[1.0.0,2.0.0)");
    universeInstaller.addProducer("producer2", GROUP_ID, "producer2", "[3.0.0,4.0.0)");
    universeInstaller.install();
    universeInstaller = new MavenUniverseInstaller(repo, universe101Artifact);
    universeInstaller.extendUniverse(universe100Artifact);
    universeInstaller.addProducer("producer3", GROUP_ID, "producer3", "[2.0.0,3.0.0)");
    universeInstaller.removeProducer("producer2");
    universeInstaller.install();
    universe101Artifact.setPath(null);
    final MavenUniverse universe = new MavenUniverse(repo, universe101Artifact);
    Assert.assertTrue(universe.hasProducer("producer1"));
    MavenProducer producer = universe.getProducer("producer1");
    Assert.assertEquals(GROUP_ID, producer.getArtifact().getGroupId());
    Assert.assertEquals("producer1", producer.getArtifact().getArtifactId());
    Assert.assertEquals("[1.0.0,2.0.0)", producer.getArtifact().getVersionRange());
    Assert.assertFalse(universe.hasProducer("producer2"));
    Assert.assertEquals(2, universe.getProducers().size());
    Assert.assertTrue(universe.hasProducer("producer3"));
    producer = universe.getProducer("producer3");
    Assert.assertEquals(GROUP_ID, producer.getArtifact().getGroupId());
    Assert.assertEquals("producer3", producer.getArtifact().getArtifactId());
    Assert.assertEquals("[2.0.0,3.0.0)", producer.getArtifact().getVersionRange());
}
Also used : MavenUniverse(org.jboss.galleon.universe.maven.MavenUniverse) MavenUniverseInstaller(org.jboss.galleon.universe.maven.MavenUniverseInstaller) MavenProducer(org.jboss.galleon.universe.maven.MavenProducer) Test(org.junit.Test)

Aggregations

MavenUniverseInstaller (org.jboss.galleon.universe.maven.MavenUniverseInstaller)10 MavenArtifact (org.jboss.galleon.universe.maven.MavenArtifact)8 MavenProducerInstaller (org.jboss.galleon.universe.maven.MavenProducerInstaller)6 MavenProducer (org.jboss.galleon.universe.maven.MavenProducer)2 MavenUniverse (org.jboss.galleon.universe.maven.MavenUniverse)2 MavenUniverseException (org.jboss.galleon.universe.maven.MavenUniverseException)2 Test (org.junit.Test)2 HashSet (java.util.HashSet)1 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1 MavenArtifactRepositoryManager (org.jboss.galleon.maven.plugin.util.MavenArtifactRepositoryManager)1 MavenProducerBase (org.jboss.galleon.universe.maven.MavenProducerBase)1