I am currently trying to publish java artifacts to our Artifactory server using the ivy-publish plugin - I have a multi-project build containing all of the projects I want to publish. In the master build script, subprojects closure, I do some common configuration required for most of the subprojects:
publications {
ivy(IvyPublication) {
// Jar file
from components.java
// Extras
artifact(myOrMayNotExist) {
type "zip"
conf "extras"
}
}
}
The problem is that the “mayOrMayNotExist” task does not produce a zip file for all projects, which results in the following error when publishing:
Failed to publish publication ‘ivy’ to repository ‘ivy’
Invalid publication ‘ivy’: artifact file does not exist: ‘C:\FileThatMayOrMayNotExist.zip’
Is it possible to have an optional artifact like this? Or do I have to explicitly define this artifact in all the projects that do have it (as opposed to removing it in those that don’t)?
Thanks for any advice,
Tom