Do not attempt to publish if no artifacts are present

Ivy transactional publishing will abort if no artifacts
are published, either because the temporary directory is
not being created, or because Ivy will detect an anomalous
condition.

Therefore, skip publishing altogether if there is
nothing to publish to begin with.
This commit is contained in:
Antonio Cunei 2014-04-30 14:35:04 +02:00
parent f77c8fb949
commit be3ff51f0a
1 changed files with 12 additions and 10 deletions

View File

@ -255,16 +255,18 @@ object IvyActions
def publish(module: ModuleDescriptor, artifacts: Seq[(IArtifact, File)], resolver: DependencyResolver, overwrite: Boolean): Unit =
{
checkFilesPresent(artifacts)
try {
resolver.beginPublishTransaction(module.getModuleRevisionId(), overwrite);
for( (artifact, file) <- artifacts)
resolver.publish(artifact, file, overwrite)
resolver.commitPublishTransaction()
} catch {
case e: Throwable =>
try { resolver.abortPublishTransaction() }
finally { throw e }
if (artifacts.nonEmpty) {
checkFilesPresent(artifacts)
try {
resolver.beginPublishTransaction(module.getModuleRevisionId(), overwrite);
for( (artifact, file) <- artifacts)
resolver.publish(artifact, file, overwrite)
resolver.commitPublishTransaction()
} catch {
case e: Throwable =>
try { resolver.abortPublishTransaction() }
finally { throw e }
}
}
}
private[this] def checkFilesPresent(artifacts: Seq[(IArtifact, File)])