Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle Kotlin DSL: subdirectory for javadoc in jar file

I currently have the following configuration in my build.gradle.kts:

tasks.withType<Jar> {
    manifest {
        attributes["Multi-Release"] = "true"
    }
    from(sourceSets["main"].allSource)
    from(sourceSets["test"].allSource)
    from(tasks["javadoc"])
}

When I run the jar task, the generated javadoc html files are included in the exported jar. However, I want to include the javadoc in a subdirectory called "javadoc". How can I achieve this, i.e. change the output location of the generated javadoc?

like image 229
Mathias Avatar asked Dec 06 '25 04:12

Mathias


1 Answers

I've just solved this as follows:

tasks.withType<Jar> {
    manifest {
        attributes["Multi-Release"] = "true"
    }
    from(sourceSets["main"].allSource)
    from(sourceSets["test"].allSource)
    {
        from(tasks["javadoc"]).into("/javadoc")
    }

}
like image 113
Mathias Avatar answered Dec 08 '25 18:12

Mathias



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!