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;
}
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();
}
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();
}
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());
}
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());
}
Aggregations