use of org.apache.ivy.core.cache.ArtifactOrigin in project ant-ivy by apache.
the class PomModuleDescriptorBuilder method addMainArtifact.
public void addMainArtifact(String artifactId, String packaging) {
String ext;
/*
* TODO: we should make packaging to ext mapping configurable, since it's not possible to
* cover all cases.
*/
if ("pom".equals(packaging)) {
// no artifact defined! Add the default artifact if it exist.
DependencyResolver resolver = parserSettings.getResolver(mrid);
if (resolver != null) {
DefaultArtifact artifact = new DefaultArtifact(mrid, new Date(), artifactId, "jar", "jar");
ArtifactOrigin artifactOrigin = resolver.locate(artifact);
if (!ArtifactOrigin.isUnknown(artifactOrigin)) {
mainArtifact = artifact;
ivyModuleDescriptor.addArtifact("master", mainArtifact);
}
}
return;
} else if (JAR_PACKAGINGS.contains(packaging)) {
ext = "jar";
} else if ("pear".equals(packaging)) {
ext = "phar";
} else {
ext = packaging;
}
mainArtifact = new DefaultArtifact(mrid, new Date(), artifactId, packaging, ext);
ivyModuleDescriptor.addArtifact("master", mainArtifact);
}
Aggregations