Gradle: gradle install using javadocs

I am using the Gradle plugin mavento create an artifact that will be used for another unrelated project. Along with the built-in .jar artifact, I would also like to create and install the -javadoc.jar artifact with it.

Usage gradle clean build javadoc installgenerates a JavaDoc in the local build file and installs the inline artifact in the local repository, but it does not currently create or install -javadoc.jar with it.

Is there a way to do this in Gradle using a plugin mavenor javadoc? I do not mind writing a custom task for this, but I prefer to use the “officially supported” method, if one exists.

Build.gradle file:

project.group = "org.example.artefact"
project.version = "1.0-SNAPSHOT"

apply plugin: 'java'
apply plugin: 'maven'

dependencies {
    // ...
}

uploadArchives {
    repositories {
        mavenDeployer {
            // Custom repository location
            repository(url: "file:///home/user/.m3/repository")
        }
    }
}
+4
1

Javadocs javadoc ( , ). build install. , jar javadocs , artifacts {...}.

task javadocJar(type: Jar) {
    classifier = 'javadoc'
    from javadoc
}   

artifacts {
    archives javadocJar
}

install javadoc jar maven local. , uploadArchives .

: javadoc jar.

+6

Source: https://habr.com/ru/post/1570531/


All Articles