Search in sources :

Example 11 with MavenProducerInstaller

use of org.jboss.galleon.universe.maven.MavenProducerInstaller 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 12 with MavenProducerInstaller

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

the class CreateProducerMojo method createProducer.

private void createProducer() throws MavenUniverseException, MojoExecutionException {
    final MavenArtifact producerArtifact = new MavenArtifact().setGroupId(groupId).setArtifactId(artifactId).setVersion(version);
    final MavenProducerInstaller installer = new MavenProducerInstaller(name, SimplisticMavenRepoManager.getInstance(Paths.get(project.getBuild().getDirectory()).resolve("local-repo"), new MavenArtifactRepositoryManager(repoSystem, repoSession, repositories)), producerArtifact, featurePackGroupId, featurePackArtifactId);
    for (String frequency : frequencies) {
        installer.addFrequency(frequency);
    }
    final Set<String> names = new HashSet<>(channels.size());
    for (ChannelDescription channel : channels) {
        if (!names.add(channel.name)) {
            throw new MojoExecutionException("Duplicate channel " + channel.name);
        }
        try {
            installer.addChannel(channel.name, channel.versionRange);
        } catch (MavenUniverseException e) {
            throw new MojoExecutionException("Failed to add channel " + channel.name, e);
        }
    }
    try {
        installer.install();
    } catch (MavenUniverseException e) {
        throw new MojoExecutionException("Failed to create producer", e);
    }
    projectHelper.attachArtifact(project, "jar", producerArtifact.getPath().toFile());
}
Also used : MavenProducerInstaller(org.jboss.galleon.universe.maven.MavenProducerInstaller) 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 13 with MavenProducerInstaller

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

the class MavenUniverseInstallTestCase method doInit.

@Override
protected void doInit() throws Exception {
    universeArtifact = new MavenArtifact();
    universeArtifact.setGroupId(GROUP_ID);
    universeArtifact.setArtifactId("test-universe");
    universeArtifact.setVersion("1.0.0.Final");
    MavenArtifact artifact = new MavenArtifact();
    artifact.setGroupId(GROUP_ID);
    artifact.setArtifactId("producer1");
    artifact.setVersion("1.0.0.Final");
    MavenProducerInstaller producerInstaller = new MavenProducerInstaller("producer1", repo, artifact);
    producerInstaller.addFrequencies("alpha", "beta");
    producerInstaller.install();
    artifact = new MavenArtifact();
    artifact.setGroupId(GROUP_ID);
    artifact.setArtifactId("producer2");
    artifact.setVersion("3.0.0.Final");
    producerInstaller = new MavenProducerInstaller("producer2", repo, artifact);
    producerInstaller.addFrequencies("alpha", "beta");
    producerInstaller.install();
}
Also used : MavenProducerInstaller(org.jboss.galleon.universe.maven.MavenProducerInstaller) MavenArtifact(org.jboss.galleon.universe.maven.MavenArtifact)

Aggregations

MavenProducerInstaller (org.jboss.galleon.universe.maven.MavenProducerInstaller)13 MavenArtifact (org.jboss.galleon.universe.maven.MavenArtifact)11 MavenUniverseInstaller (org.jboss.galleon.universe.maven.MavenUniverseInstaller)6 MavenChannel (org.jboss.galleon.universe.maven.MavenChannel)2 MavenProducer (org.jboss.galleon.universe.maven.MavenProducer)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