I have a multi-module project where different test suites (unit, integration, functional) and main source are separate modules. Upon successful build, I generate 4 artifacts from my main sources (main module): uber, skinny, sources and javadoc JARs.
I use gradle-nexus-plugin to sign the artifacts and upload them to Nexus. Before the upload I do see in my main module’s ‘’‘target/libs’’’ the 4 artifact JARs and their generated signatures, the .ASC files.
Since it is a multi-artifact upload process, I configure filters for mavenDeployer in order to generate multiple POMs. After the upload process has finished, I do not see ASC files uploaded to Nexus. Only the JARs, their md5, sha1, POM and its sha1, md5 get uploaded.
In order to “force” the upload of ASC, I add the generated .asc files as artifacts to ‘’‘mavenDeployer’’’ using the ‘’‘beforeDeployment’’’ closure. I created a custom class ‘’‘AscSignature’’’ that implements PublishArtifact interface for this purpose.
This solution works, but I am not happy. I still do not understand why ASC files skipped during upload. I am not sure what I am missing and where I am going wrong. I wish not to create custom classes and hacky solutions.
Could you please advise what could be the problem. Most probably the information provided was not sufficient, please let me know if you need to know anything specific. I am using Gradle v1.5. Thank you
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment ->
def baseName = "${projectName}-${version}"
def basePath = "$buildDir/libs/" + baseName
def ext = "jar.asc"
deployment.addArtifact(new AscSignature(baseName, ext, ext, "sources", file(basePath + "-sources." + ext)))
deployment.addArtifact(new AscSignature(baseName, ext, ext, "javadoc", file(basePath + "-javadoc." + ext)))
deployment.addArtifact(new AscSignature(baseName, ext, ext, "no-dependencies", file(basePath + "-no-dependencies." + ext)))
deployment.addArtifact(new AscSignature(baseName, ext, ext, "", file(basePath + "." + ext)))
}
def jarPom = addFilter('jar') {artifact, file -> artifact.ext == "jar" }
jarPom.version = "$version"
jarPom.artifactId = "$projectName"
jarPom.groupId = "$projectGroup"
jarPom.project {
.......
}
}
}
}