Skip to content

Commit d36d57a

Browse files
committed
MXTS-74974: buildMicroDocs/buildJavadoc classpath should use compileClasspath, not api
Both tasks set classpath = project.configurations.api. Git history shows this used to be configurations.compile before the Gradle 5 migration (commit 0a020fb), where it was mechanically swapped to `api` - the wrong 1:1 replacement. `api` is a narrow "exposed dependencies" bucket; the correct modern equivalent of the old `compile` classpath is compileClasspath, which is what the standard Gradle javadoc task uses by default. The bug this causes: any type referenced in project source but pulled in via an `implementation`-scoped dependency is invisible to these tasks, even though the main compileJava task (which uses compileClasspath) compiles it fine. Surfaced by availability-service's ES 9.3.5 upgrade, where co.elastic.clients.transport.rest5_client.Rest5ClientTransport (from elasticsearch-java, implementation-scoped) failed to resolve while Rest5Client/Rest5ClientBuilder (from elasticsearch-rest5-client, api-scoped) resolved fine in the same file - consistent with this exact classpath gap. Verified: applying this fixed plugin (published to mavenLocal) to availability-service with elasticsearch-java back on implementation scope makes buildMicroDocs pass with no other changes.
1 parent f281489 commit d36d57a

2 files changed

Lines changed: 3 additions & 5 deletions

File tree

microdocs-crawler-gradle/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ dependencies {
6161
}
6262

6363
group = 'com.maxxton'
64-
version = '4.0.0'
64+
version = '4.0.2'
6565

6666

6767
task fatJar(type: Jar, dependsOn: 'jar') {

microdocs-crawler-gradle/src/main/groovy/com/maxxton/microdocs/crawler/gradle/MicroDocsCrawlerPlugin.groovy

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,20 +48,18 @@ class MicroDocsCrawlerPlugin implements Plugin<Project> {
4848

4949
project.task('buildMicroDocs', type: MicroDocs, dependsOn: ['extractMicroDocsDoclet'], group: 'microdocs') {
5050
title = ""
51-
project.configurations.api.setCanBeResolved(true)
5251
source = project.sourceSets.main.allJava
53-
classpath = project.configurations.api
52+
classpath = project.sourceSets.main.compileClasspath
5453
destinationDir = project.reporting.file('./')
5554
options.docletpath = [new File("$project.buildDir/tmp/" + jarName)]
5655
options.doclet = 'com.maxxton.microdocs.crawler.doclet.DocletRunner'
5756
}
5857

5958
project.task('buildJavadoc', type: Javadoc, group: 'microdocs') {
6059
title = ""
61-
project.configurations.api.setCanBeResolved(true)
6260
source = project.sourceSets.main.allJava
6361
destinationDir = project.reporting.file("javadoc")
64-
classpath = project.configurations.api
62+
classpath = project.sourceSets.main.compileClasspath
6563
options.tags = ['response', 'example', 'ignoreDownstreamCheck']
6664
}
6765

0 commit comments

Comments
 (0)