use of org.apache.ivy.core.module.descriptor.Artifact in project gradle by gradle.
the class DefaultArtifactPomTest method initWithCustomPomSettings.
@Test
public void initWithCustomPomSettings() {
Artifact mainArtifact = createTestArtifact("someName", null, "mainPackaging");
File mainFile = new File("someFile");
testPom.setArtifactId("customArtifactId");
testPom.setGroupId("customGroupId");
testPom.setVersion("customVersion");
testPom.setPackaging("customPackaging");
artifactPom.addArtifact(mainArtifact, mainFile);
assertThat(artifactPom.getArtifact().getName(), equalTo("customArtifactId"));
assertThat(artifactPom.getArtifact().getExtension(), equalTo("mainPackaging"));
assertThat(artifactPom.getArtifact().getType(), equalTo("mainPackaging"));
assertThat(artifactPom.getArtifact().getClassifier(), nullValue());
assertThat(artifactPom.getArtifact().getFile(), equalTo(mainFile));
assertThat(artifactPom.getPom().getGroupId(), equalTo("customGroupId"));
assertThat(artifactPom.getPom().getArtifactId(), equalTo("customArtifactId"));
assertThat(artifactPom.getPom().getVersion(), equalTo("customVersion"));
assertThat(artifactPom.getPom().getPackaging(), equalTo("mainPackaging"));
}
use of org.apache.ivy.core.module.descriptor.Artifact in project gradle by gradle.
the class DefaultArtifactPomTest method pomWithMainArtifact.
@Test
public void pomWithMainArtifact() {
Artifact mainArtifact = createTestArtifact("someName", null, "mainPackaging");
File mainFile = new File("someFile");
artifactPom.addArtifact(mainArtifact, mainFile);
assertThat(artifactPom.getArtifact().getName(), equalTo("someName"));
assertThat(artifactPom.getArtifact().getExtension(), equalTo("mainPackaging"));
assertThat(artifactPom.getArtifact().getType(), equalTo("mainPackaging"));
assertThat(artifactPom.getArtifact().getClassifier(), nullValue());
assertThat(artifactPom.getArtifact().getFile(), equalTo(mainFile));
assertThat(artifactPom.getPom().getGroupId(), equalTo("org"));
assertThat(artifactPom.getPom().getArtifactId(), equalTo("someName"));
assertThat(artifactPom.getPom().getVersion(), equalTo("1.0"));
assertThat(artifactPom.getPom().getPackaging(), equalTo("mainPackaging"));
}
use of org.apache.ivy.core.module.descriptor.Artifact in project gradle by gradle.
the class DefaultArtifactPomTest method pomWithMainArtifactAndClassifierArtifacts.
@Test
public void pomWithMainArtifactAndClassifierArtifacts() {
Artifact mainArtifact = createTestArtifact("someName", null, "mainPackaging");
File mainFile = new File("someFile");
Artifact classifierArtifact = createTestArtifact("otherName", "javadoc", "zip");
File classifierFile = new File("someClassifierFile");
artifactPom.addArtifact(mainArtifact, mainFile);
artifactPom.addArtifact(classifierArtifact, classifierFile);
assertThat(artifactPom.getArtifact().getName(), equalTo("someName"));
assertThat(artifactPom.getArtifact().getExtension(), equalTo("mainPackaging"));
assertThat(artifactPom.getArtifact().getType(), equalTo("mainPackaging"));
assertThat(artifactPom.getArtifact().getClassifier(), nullValue());
assertThat(artifactPom.getArtifact().getFile(), equalTo(mainFile));
PublishArtifact artifact = singleItem(artifactPom.getAttachedArtifacts());
assertThat(artifact.getName(), equalTo("someName"));
assertThat(artifact.getExtension(), equalTo("zip"));
assertThat(artifact.getType(), equalTo("zip"));
assertThat(artifact.getClassifier(), equalTo("javadoc"));
assertThat(artifact.getFile(), equalTo(classifierFile));
assertThat(artifactPom.getPom().getGroupId(), equalTo("org"));
assertThat(artifactPom.getPom().getArtifactId(), equalTo("someName"));
assertThat(artifactPom.getPom().getVersion(), equalTo("1.0"));
assertThat(artifactPom.getPom().getPackaging(), equalTo("mainPackaging"));
}
use of org.apache.ivy.core.module.descriptor.Artifact in project gradle by gradle.
the class DefaultArtifactPomTest method addClassifierTwiceShouldThrowInvalidUserDataEx.
@Test(expected = InvalidUserDataException.class)
public void addClassifierTwiceShouldThrowInvalidUserDataEx() {
File classifierFile = new File("someClassifierFile");
Artifact classifierArtifact = createTestArtifact("someName", "javadoc");
artifactPom.addArtifact(classifierArtifact, classifierFile);
artifactPom.addArtifact(classifierArtifact, classifierFile);
}
use of org.apache.ivy.core.module.descriptor.Artifact in project gradle by gradle.
the class AbstractMavenResolver method publish.
public void publish(IvyModulePublishMetadata moduleVersion) {
for (IvyModuleArtifactPublishMetadata artifactMetadata : moduleVersion.getArtifacts()) {
IvyArtifactName artifact = artifactMetadata.getArtifactName();
ModuleRevisionId moduleRevisionId = IvyUtil.createModuleRevisionId(artifactMetadata.getId().getComponentIdentifier());
Map<String, String> attributes = Collections.singletonMap("classifier", artifact.getClassifier());
Artifact ivyArtifact = new DefaultArtifact(moduleRevisionId, null, artifact.getName(), artifact.getType(), artifact.getExtension(), attributes);
collectArtifact(ivyArtifact, artifactMetadata.getFile());
}
publish();
}
Aggregations