How to add appendix to publish artifacts?


(Alexander Stets) #1

I need add appendix to publish artifacts. For build task it is easy. But it doesn’t work when I try publish artifacts via maven-publish plugin. Appendix are not added.

plugins {
    id 'maven-publish'
    id 'org.springframework.boot' version '1.5.19.RELEASE'
    id 'org.asciidoctor.convert' version '1.5.3'
}

def env = 'something'

jar {
    enabled = true
    appendix env
}

sourceJar {
    appendix env
}

apiDocZip {
    appendix env
}

In result I get follow artifacts:

artifact-something-0.0.0.jar
artifact-something-0.0.0-sources.jar
artifact-something-0.0.0-apidoc.zip

But when I use task publishToMavenLocal, then I get follow:

artifact-0.0.0.jar
artifact-0.0.0.pom
artifact-0.0.0-sources.jar
artifact-0.0.0-apidoc.zip

How can you see appendix was not added. Is there any solution to add appendix to publish artifacts?


(Alexander Stets) #2

Documentation contains follow solution:
https://docs.gradle.org/current/userguide/publishing_maven.html

publishing {
    publications {
        mavenJava(MavenPublication) {
            artifactId = 'my-library'
         }
     }
}

But I get artifacts twice. First are named ‘my-library’. And second has name equal root project name.