use of org.jboss.galleon.universe.maven.MavenArtifact in project wildfly-maven-plugin by wildfly.
the class LocalCLIExecutor method resolveCLI.
private static URL resolveCLI(MavenRepoManager artifactResolver) throws Exception {
final URL[] cp = new URL[1];
MavenArtifact mavenArtifact = new MavenArtifact();
mavenArtifact.setGroupId(CLI_GROUP_ID);
mavenArtifact.setArtifactId(CLI_ARTIFACT_ID);
String version = retrieveCoreVersion(artifactResolver);
mavenArtifact.setVersion(version);
mavenArtifact.setClassifier(CLI_CLASSIFIER);
mavenArtifact.setExtension(CLI_TYPE);
artifactResolver.resolve(mavenArtifact);
return mavenArtifact.getPath().toUri().toURL();
}
use of org.jboss.galleon.universe.maven.MavenArtifact in project galleon by wildfly.
the class MavenProducerSpecXmlWriter method toElement.
@Override
protected ElementNode toElement(MavenProducerBase producer) throws XMLStreamException {
final ElementNode producerEl = addElement(null, Element.PRODUCER);
addAttribute(producerEl, Attribute.NAME, producer.getName());
final MavenArtifact artifact = producer.getArtifact();
String value = artifact.getGroupId();
if (value == null) {
throw new XMLStreamException("Producer " + producer.getName() + " is missing groupId");
}
addElement(producerEl, Element.GROUP_ID).addChild(new TextNode(value));
value = artifact.getArtifactId();
if (value == null) {
throw new XMLStreamException("Producer " + producer.getName() + " is missing artifactId");
}
addElement(producerEl, Element.ARTIFACT_ID).addChild(new TextNode(value));
value = artifact.getVersionRange();
if (value == null) {
throw new XMLStreamException("Producer " + producer.getName() + " is missing version-range");
}
addElement(producerEl, Element.VERSION_RANGE).addChild(new TextNode(value));
return producerEl;
}
use of org.jboss.galleon.universe.maven.MavenArtifact in project galleon by wildfly.
the class FeaturePackLocationResolverTestCase method testResolutionLocalPathInstalled.
@Test
public void testResolutionLocalPathInstalled() throws Exception {
FeaturePackLocation fpl = FeaturePackLocation.fromString("producer1@" + MavenUniverseFactory.ID + '(' + universeArt.getCoordsAsString() + "):5#5.0.0.Final");
MavenArtifact artifact = new MavenArtifact().setGroupId(FP_GROUP_ID).setArtifactId(PRODUCER1_FP_ARTIFACT_ID).setExtension("zip").setVersion("5.0.0.Final");
FeaturePackCreator.getInstance().addArtifactResolver(repo).newFeaturePack().setFPID(fpl.getFPID()).getCreator().install();
Path path = resolver.resolve(fpl);
Assert.assertEquals(artifact.getArtifactFileName(), path.getFileName().toString());
Path externalPath = repoHome.resolve("external").resolve(path.getFileName().toString());
IoUtils.copy(path, externalPath);
IoUtils.recursiveDelete(path);
try {
resolver.resolve(fpl);
Assert.fail(String.format("The %s artifact is still installed in the local repository", artifact.getCoordsAsString()));
} catch (ProvisioningException e) {
// Expected exception
}
UniverseResolver resolver = UniverseResolver.builder().addArtifactResolver(repo).addLocalFeaturePack(externalPath).build();
try {
path = resolver.resolve(fpl);
Assert.assertEquals(artifact.getArtifactFileName(), path.getFileName().toString());
} catch (ProvisioningException e) {
Assert.fail(String.format("Cannot resolve %s artifact using a resolved with a local feature pack location", artifact.getCoordsAsString()));
}
}
use of org.jboss.galleon.universe.maven.MavenArtifact in project galleon by wildfly.
the class FeaturePackLocationResolverTestCase method testMain.
@Test
public void testMain() throws Exception {
try {
resolver.resolve(FeaturePackLocation.fromString("producer1@" + MavenUniverseFactory.ID + '(' + universeArt.getCoordsAsString() + "):5/alpha"));
Assert.fail("Artifact does not exist");
} catch (ProvisioningException e) {
final MavenArtifact artifact = new MavenArtifact();
artifact.setGroupId(FP_GROUP_ID);
artifact.setArtifactId(PRODUCER1_FP_ARTIFACT_ID);
artifact.setExtension("zip");
artifact.setVersionRange("[5.0-alpha,6.0-alpha)");
Assert.assertEquals(MavenErrors.artifactNotFound(artifact, repoHome).getLocalizedMessage(), e.getLocalizedMessage());
}
installFp(FeaturePackLocation.fromString("producer1@" + MavenUniverseFactory.ID + '(' + universeArt.getCoordsAsString() + "):5#5.1.0.Alpha1"));
try {
resolver.resolve(FeaturePackLocation.fromString("producer1@" + MavenUniverseFactory.ID + '(' + universeArt.getCoordsAsString() + "):5"));
Assert.fail("No final releases yet");
} catch (ProvisioningException e) {
// ignore
}
MavenArtifact artifact = new MavenArtifact().setGroupId(FP_GROUP_ID).setArtifactId(PRODUCER1_FP_ARTIFACT_ID).setExtension("zip").setVersion("5.1.0.Alpha1");
Path path = resolver.resolve(FeaturePackLocation.fromString("producer1@" + MavenUniverseFactory.ID + '(' + universeArt.getCoordsAsString() + "):5/alpha"));
Assert.assertEquals(artifact.getArtifactFileName(), path.getFileName().toString());
installFp(FeaturePackLocation.fromString("producer1@" + MavenUniverseFactory.ID + '(' + universeArt.getCoordsAsString() + "):4#4.1.0.Beta2"));
path = resolver.resolve(FeaturePackLocation.fromString("producer1@" + MavenUniverseFactory.ID + '(' + universeArt.getCoordsAsString() + "):5/alpha"));
Assert.assertEquals(artifact.getArtifactFileName(), path.getFileName().toString());
installFp(FeaturePackLocation.fromString("producer1@" + MavenUniverseFactory.ID + '(' + universeArt.getCoordsAsString() + "):5#5.2.0.Final"));
artifact.setVersion("5.2.0.Final");
path = resolver.resolve(FeaturePackLocation.fromString("producer1@" + MavenUniverseFactory.ID + '(' + universeArt.getCoordsAsString() + "):5/alpha"));
Assert.assertEquals(artifact.getArtifactFileName(), path.getFileName().toString());
path = resolver.resolve(FeaturePackLocation.fromString("producer1@" + MavenUniverseFactory.ID + '(' + universeArt.getCoordsAsString() + "):5"));
Assert.assertEquals(artifact.getArtifactFileName(), path.getFileName().toString());
installFp(FeaturePackLocation.fromString("producer1@" + MavenUniverseFactory.ID + '(' + universeArt.getCoordsAsString() + "):5#5.2.1.Beta1"));
artifact.setVersion("5.2.1.Beta1");
path = resolver.resolve(FeaturePackLocation.fromString("producer1@" + MavenUniverseFactory.ID + '(' + universeArt.getCoordsAsString() + "):5/alpha"));
Assert.assertEquals(artifact.getArtifactFileName(), path.getFileName().toString());
path = resolver.resolve(FeaturePackLocation.fromString("producer1@" + MavenUniverseFactory.ID + '(' + universeArt.getCoordsAsString() + "):5/beta"));
Assert.assertEquals(artifact.getArtifactFileName(), path.getFileName().toString());
path = resolver.resolve(FeaturePackLocation.fromString("producer1@" + MavenUniverseFactory.ID + '(' + universeArt.getCoordsAsString() + "):5"));
artifact.setVersion("5.2.0.Final");
Assert.assertEquals(artifact.getArtifactFileName(), path.getFileName().toString());
installFp(FeaturePackLocation.fromString("producer1@" + MavenUniverseFactory.ID + '(' + universeArt.getCoordsAsString() + "):6#6.0.0.Alpha1"));
path = resolver.resolve(FeaturePackLocation.fromString("producer1@" + MavenUniverseFactory.ID + '(' + universeArt.getCoordsAsString() + "):5"));
Assert.assertEquals(artifact.getArtifactFileName(), path.getFileName().toString());
path = resolver.resolve(FeaturePackLocation.fromString("producer1@" + MavenUniverseFactory.ID + '(' + universeArt.getCoordsAsString() + "):5/alpha"));
artifact.setVersion("5.2.1.Beta1");
Assert.assertEquals(artifact.getArtifactFileName(), path.getFileName().toString());
installFp(FeaturePackLocation.fromString("producer1@" + MavenUniverseFactory.ID + '(' + universeArt.getCoordsAsString() + "):6#6.0.0.Final"));
path = resolver.resolve(FeaturePackLocation.fromString("producer1@" + MavenUniverseFactory.ID + '(' + universeArt.getCoordsAsString() + "):5"));
artifact.setVersion("5.2.0.Final");
Assert.assertEquals(artifact.getArtifactFileName(), path.getFileName().toString());
artifact.setVersion("5.1.0.Alpha1");
path = resolver.resolve(FeaturePackLocation.fromString("producer1@" + MavenUniverseFactory.ID + '(' + universeArt.getCoordsAsString() + "):5#5.1.0.Alpha1"));
Assert.assertEquals(artifact.getArtifactFileName(), path.getFileName().toString());
artifact.setVersion("4.1.0.Beta2");
path = resolver.resolve(FeaturePackLocation.fromString("producer1@" + MavenUniverseFactory.ID + '(' + universeArt.getCoordsAsString() + "):5#4.1.0.Beta2"));
Assert.assertEquals(artifact.getArtifactFileName(), path.getFileName().toString());
}
use of org.jboss.galleon.universe.maven.MavenArtifact in project galleon by wildfly.
the class FeaturePackLocationResolverTestCase method doInit.
@Override
public void doInit() throws Exception {
final MavenArtifact artifact = new MavenArtifact().setGroupId(GROUP_ID).setArtifactId(PRODUCER1_ARTIFACT_ID).setVersion("1.0.0.Final");
MavenProducerInstaller producerInstaller = new MavenProducerInstaller("producer1", repo, artifact, FP_GROUP_ID, PRODUCER1_FP_ARTIFACT_ID);
producerInstaller.addChannel("6", "[6.0-alpha,7.0-alpha)");
producerInstaller.addChannel("5", "[5.0-alpha,6.0-alpha)");
producerInstaller.addChannel("4", "[4.0-alpha,5.0-alpha)");
producerInstaller.addFrequencies("alpha", "beta");
producerInstaller.install();
universeArt = new MavenArtifact().setGroupId(GROUP_ID).setArtifactId("universe1-artifact").setVersion("1.0.0.Final");
final MavenUniverseInstaller universeInstaller = new MavenUniverseInstaller(repo, universeArt);
universeInstaller.addProducer("producer1", GROUP_ID, PRODUCER1_ARTIFACT_ID, "[1.0.0,2.0.0)");
universeInstaller.install();
resolver = UniverseResolver.builder().addArtifactResolver(repo).build();
}
Aggregations