我有一个项目,其中包含大约50%的Java代码和50%的Groovy,我试图将其发布到Sonatype ossrh。发布快照运行良好,但缺少docs jar (本地发布和发布到Sonatype Nexus时都是如此)。我可以通过定义以下内容来创建组合的groovy/java文档:
groovydoc {
use = true
groovyClasspath = configurations.compile // http://issues.gradle.org/browse/GRADLE-1391
}
task groovydocJar(type: Jar, dependsOn: groovydoc ) {
classifier 'javadoc' // must use javadoc classifier to be able to deploy to Sonatype
from groovydoc.destinationDir
}然后运行./gradlew groovydocJar生成预期的-javadoc.jar,没有任何问题。
我的问题是这个docs jar不包含在发布任务中。
我尝试了以下几种方法
publishing {
publications {
maven(MavenPublication) {
from components.java
artifacts {
archives sourcesJar
archives groovydocJar
}
versionMapping {
usage('java-api') {
fromResolutionOf('runtimeClasspath')
}
usage('java-runtime') {
fromResolutionResult()
}
}
pom {
// omitted for brevity
}
}
}
}
... but e.g. `./gradlew publishToMavenLocal` publishes only the classes jar, the pom, a module and the sources jar.
No sign of a javadoc jar. I thought this was the idea of the artifacts section but maybe something is missing.
How can i tell the publishing task to include publishing of the groovydocs jar?
Gradle version is 6.8.3, jvm version is 1.8 and i depend on `compile 'org.codehaus.groovy:groovy-all:3.0.7'`
The complete build script is available here:
https://github.com/perNyfelt/ProjectDeployer/blob/main/build.gradle发布于 2021-03-07 03:53:59
我想通了:
这种artifacts.archives方式不起作用。
添加groovy文档的语法如下所示:
publishing {
publications {
maven(MavenPublication) {
from components.java
artifact(groovydocJar) {
classifier = 'javadoc'
}
// etc...
}
}
}https://stackoverflow.com/questions/66509653
复制相似问题