public void publish(IvyNormalizedPublication publication, PublicationAwareRepository repository) {
ModuleVersionPublisher publisher = repository.createPublisher();
IvyPublicationIdentity projectIdentity = publication.getProjectIdentity();
ModuleRevisionId moduleRevisionId = IvyUtil.createModuleRevisionId(projectIdentity.getOrganisation(), projectIdentity.getModule(), projectIdentity.getRevision());
ModuleVersionIdentifier moduleVersionIdentifier = DefaultModuleVersionIdentifier.newId(moduleRevisionId);
DefaultIvyModulePublishMetaData publishMetaData = new DefaultIvyModulePublishMetaData(moduleVersionIdentifier);
try {
for (IvyArtifact publishArtifact : publication.getArtifacts()) {
Artifact ivyArtifact = createIvyArtifact(publishArtifact, moduleRevisionId);
publishMetaData.addArtifact(ivyArtifact, publishArtifact.getFile());
}
Artifact artifact = DefaultArtifact.newIvyArtifact(moduleRevisionId, null);
publishMetaData.addArtifact(artifact, publication.getDescriptorFile());
publisher.publish(publishMetaData);
} catch (IOException e) {
throw new UncheckedIOException(e);
}