scip-java icon indicating copy to clipboard operation
scip-java copied to clipboard

Error while building index for Java 21 project - plug-in not found: semanticdb

Open ofeki-neosec opened this issue 10 months ago • 1 comments

I'm trying to build a SCIP index for the following project: https://github.com/mrlonis/mrlonis-spring-boot-monorepo. I'm using the latest Docker image from the repo, as it has support for Java 21.

For some reason, I'm facing this issue:

$ docker run -it -v $(pwd):/sources scip-java scip-java index
Using JVM version '21'
Picked up JAVA_TOOL_OPTIONS: -XX:MaxRAMPercentage=80.0 -XX:+UseContainerSupport
Picked up JAVA_TOOL_OPTIONS: -XX:MaxRAMPercentage=80.0 -XX:+UseContainerSupport
openjdk version "21.0.5" 2024-10-15 LTS
OpenJDK Runtime Environment Temurin-21.0.5+11 (build 21.0.5+11-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.5+11 (build 21.0.5+11-LTS, mixed mode, sharing)
Picked up JAVA_TOOL_OPTIONS: -XX:MaxRAMPercentage=80.0 -XX:+UseContainerSupport
$ /sources/gradlew --no-daemon --init-script /tmp/scip-java10608035674360340155/init-script.gradle -Pkotlin.compiler.execution.strategy=in-process -Dsemanticdb.targetroot=/sources/build/semanticdb-targetroot clean scipPrintDependencies scipCompileAll
Picked up JAVA_TOOL_OPTIONS: -XX:MaxRAMPercentage=80.0 -XX:+UseContainerSupport
Downloading https://services.gradle.org/distributions/gradle-8.12-all.zip
.....................10%......................20%......................30%......................40%......................50%......................60%......................70%......................80%......................90%......................100%

Welcome to Gradle 8.12!

Here are the highlights of this release:
 - Enhanced error and warning reporting with the Problems API
 - File-system watching support on Alpine Linux
 - Build and test Swift 6 libraries and apps

For more details see https://docs.gradle.org/8.12/release-notes.html

To honour the JVM settings for this build a single-use Daemon process will be forked. For more on this, please refer to https://docs.gradle.org/8.12/userguide/gradle_daemon.html#sec:disabling_the_daemon in the Gradle documentation.
Daemon will be stopped at the end of the build
> Task :buildSrc:extractPluginRequests UP-TO-DATE
> Task :buildSrc:generatePluginAdapters UP-TO-DATE
> Task :buildSrc:spotlessInternalRegisterDependencies UP-TO-DATE

> Task :buildSrc:spotlessGroovyGradle
Missing required bundle org.eclipse.jdt.debug needed by [org.eclipse.jdt.launching, org.eclipse.jdt.launching.macosx]
Missing required capability osgi.extender:osgi.extender=osgi.serviceloader.processor needed by org.apache.commons.commons-logging
Missing required capability osgi.serviceloader:osgi.serviceloader=org.apache.commons.logging.LogFactory needed by org.apache.commons.commons-logging
Missing required capability osgi.serviceloader:osgi.serviceloader=org.apache.juli.logging.Log needed by org.mortbay.jasper.apache-jsp
Missing required capability osgi.extender:osgi.extender=osgi.serviceloader.processor needed by org.mortbay.jasper.apache-jsp
Recommend setting osgi.configuration.area to a directory, getDataFile will return null
Starting Groovy-Eclipse compiler resolver. Specified compiler level: unspecified
129 org.codehaus.groovy_5.0.0.v202406302347-e2406 RESOLVED

> Task :buildSrc:spotlessGroovyGradleApply
> Task :buildSrc:spotlessApply

Picked up JAVA_TOOL_OPTIONS: -XX:MaxRAMPercentage=80.0 -XX:+UseContainerSupport
> Task :buildSrc:compileJava

> Task :buildSrc:compileGroovy NO-SOURCE
> Task :buildSrc:compileGroovyPlugins
> Task :buildSrc:pluginDescriptors UP-TO-DATE
> Task :buildSrc:processResources UP-TO-DATE
> Task :buildSrc:classes
> Task :buildSrc:jar
> Task :lib-mrlonis-testing:clean
> Task :playground:clean
> Task :api-genshin-impact:clean
> Task :api-honkai-star-rail:clean
> Task :lib-mrlonis-types:clean
> Task :gateway:clean

[WARNING] [scip-java.gradle] Failed to extract Maven publication from the project `mrlonis-spring-boot-monorepo`.

> Task :scipPrintDependencies
This will not prevent a SCIP index from being created, but the symbols
extracted from this project won't be available for cross-repository navigation,
as this project doesn't define any Maven coordinates by which it can be referred back to.
Invocation of Task.project at execution time has been deprecated. This will fail with an error in Gradle 10.0. This API is incompatible with the configuration cache, which will become the only mode supported by Gradle in a future release. Consult the upgrading guide for further information: https://docs.gradle.org/8.12/userguide/upgrading_version_7.html#task_project

> Task :scipCompileAll UP-TO-DATE
> Task :spotlessInternalRegisterDependencies
See here for more details: https://sourcegraph.github.io/scip-java/docs/manual-configuration.html#step-5-optional-enable-cross-repository-navigation

Here's the raw error message (class java.lang.NullPointerException):
  "Cannot invoke "org.gradle.api.publish.PublishingExtension.getPublications()" because the return value of "org.gradle.api.plugins.ExtensionContainer.findByType(java.lang.Class)" is null"
Continuing without cross-repository support.

> Task :playground:scipPrintDependencies
[WARNING] [scip-java.gradle] Failed to extract Maven publication from the project `playground`.

This will not prevent a SCIP index from being created, but the symbols
extracted from this project won't be available for cross-repository navigation,
as this project doesn't define any Maven coordinates by which it can be referred back to.
See here for more details: https://sourcegraph.github.io/scip-java/docs/manual-configuration.html#step-5-optional-enable-cross-repository-navigation

Here's the raw error message (class java.lang.NullPointerException):
  "Cannot invoke "org.gradle.api.publish.PublishingExtension.getPublications()" because the return value of "org.gradle.api.plugins.ExtensionContainer.findByType(java.lang.Class)" is null"
Continuing without cross-repository support.

> Task :lib-mrlonis-types:scipPrintDependencies
[WARNING] [scip-java.gradle] Failed to extract Maven publication from the project `lib-mrlonis-types`.

This will not prevent a SCIP index from being created, but the symbols
extracted from this project won't be available for cross-repository navigation,
as this project doesn't define any Maven coordinates by which it can be referred back to.
See here for more details: https://sourcegraph.github.io/scip-java/docs/manual-configuration.html#step-5-optional-enable-cross-repository-navigation

Here's the raw error message (class java.lang.NullPointerException):
  "Cannot invoke "org.gradle.api.publish.PublishingExtension.getPublications()" because the return value of "org.gradle.api.plugins.ExtensionContainer.findByType(java.lang.Class)" is null"
Continuing without cross-repository support.

> Task :api-genshin-impact:scipPrintDependencies
[WARNING] [scip-java.gradle] Failed to extract Maven publication from the project `api-genshin-impact`.

This will not prevent a SCIP index from being created, but the symbols
extracted from this project won't be available for cross-repository navigation,
as this project doesn't define any Maven coordinates by which it can be referred back to.
See here for more details: https://sourcegraph.github.io/scip-java/docs/manual-configuration.html#step-5-optional-enable-cross-repository-navigation

Here's the raw error message (class java.lang.NullPointerException):
  "Cannot invoke "org.gradle.api.publish.PublishingExtension.getPublications()" because the return value of "org.gradle.api.plugins.ExtensionContainer.findByType(java.lang.Class)" is null"
Continuing without cross-repository support.

[WARNING] [scip-java.gradle] Failed to extract Maven publication from the project `lib-mrlonis-testing`.

> Task :lib-mrlonis-types:spotlessFlexmark
This will not prevent a SCIP index from being created, but the symbols
> Task :lib-mrlonis-types:spotlessFlexmarkApply

> Task :lib-mrlonis-testing:scipPrintDependencies
extracted from this project won't be available for cross-repository navigation,
as this project doesn't define any Maven coordinates by which it can be referred back to.
See here for more details: https://sourcegraph.github.io/scip-java/docs/manual-configuration.html#step-5-optional-enable-cross-repository-navigation

Here's the raw error message (class java.lang.NullPointerException):
  "Cannot invoke "org.gradle.api.publish.PublishingExtension.getPublications()" because the return value of "org.gradle.api.plugins.ExtensionContainer.findByType(java.lang.Class)" is null"
Continuing without cross-repository support.

[WARNING] [scip-java.gradle] Failed to extract Maven publication from the project `api-honkai-star-rail`.
> Task :api-honkai-star-rail:scipPrintDependencies

This will not prevent a SCIP index from being created, but the symbols
extracted from this project won't be available for cross-repository navigation,
as this project doesn't define any Maven coordinates by which it can be referred back to.
See here for more details: https://sourcegraph.github.io/scip-java/docs/manual-configuration.html#step-5-optional-enable-cross-repository-navigation

Here's the raw error message (class java.lang.NullPointerException):
  "Cannot invoke "org.gradle.api.publish.PublishingExtension.getPublications()" because the return value of "org.gradle.api.plugins.ExtensionContainer.findByType(java.lang.Class)" is null"
Continuing without cross-repository support.

[WARNING] [scip-java.gradle] Failed to extract Maven publication from the project `gateway`.
> Task :lib-mrlonis-testing:spotlessFlexmark

> Task :lib-mrlonis-testing:spotlessFlexmarkApply
This will not prevent a SCIP index from being created, but the symbols

> Task :gateway:scipPrintDependencies
extracted from this project won't be available for cross-repository navigation,
as this project doesn't define any Maven coordinates by which it can be referred back to.
See here for more details: https://sourcegraph.github.io/scip-java/docs/manual-configuration.html#step-5-optional-enable-cross-repository-navigation

Here's the raw error message (class java.lang.NullPointerException):
  "Cannot invoke "org.gradle.api.publish.PublishingExtension.getPublications()" because the return value of "org.gradle.api.plugins.ExtensionContainer.findByType(java.lang.Class)" is null"
Continuing without cross-repository support.

> Task :gateway:spotlessFlexmark
> Task :gateway:spotlessFlexmarkApply

> Task :lib-mrlonis-types:spotlessGroovyGradle
Missing required bundle org.eclipse.jdt.debug needed by [org.eclipse.jdt.launching, org.eclipse.jdt.launching.macosx]
Missing required capability osgi.extender:osgi.extender=osgi.serviceloader.processor needed by org.apache.commons.commons-logging
Missing required capability osgi.serviceloader:osgi.serviceloader=org.apache.commons.logging.LogFactory needed by org.apache.commons.commons-logging
Missing required capability osgi.serviceloader:osgi.serviceloader=org.apache.juli.logging.Log needed by org.mortbay.jasper.apache-jsp
Missing required capability osgi.extender:osgi.extender=osgi.serviceloader.processor needed by org.mortbay.jasper.apache-jsp
Recommend setting osgi.configuration.area to a directory, getDataFile will return null
Starting Groovy-Eclipse compiler resolver. Specified compiler level: unspecified
129 org.codehaus.groovy_5.0.0.v202406302347-e2406 RESOLVED

> Task :lib-mrlonis-testing:spotlessGroovyGradle
> Task :lib-mrlonis-types:spotlessGroovyGradleApply
> Task :lib-mrlonis-testing:spotlessGroovyGradleApply
> Task :gateway:spotlessGroovyGradle
> Task :gateway:spotlessGroovyGradleApply
> Task :api-honkai-star-rail:spotlessFlexmark
> Task :api-genshin-impact:spotlessFlexmark
> Task :api-honkai-star-rail:spotlessFlexmarkApply
> Task :api-genshin-impact:spotlessFlexmarkApply
> Task :playground:spotlessFlexmark
> Task :playground:spotlessFlexmarkApply
> Task :api-honkai-star-rail:spotlessGroovyGradle
> Task :api-honkai-star-rail:spotlessGroovyGradleApply
> Task :api-genshin-impact:spotlessGroovyGradle
> Task :playground:spotlessGroovyGradle
> Task :api-genshin-impact:spotlessGroovyGradleApply
> Task :playground:spotlessGroovyGradleApply
> Task :lib-mrlonis-testing:spotlessJava
> Task :gateway:spotlessJava
> Task :lib-mrlonis-types:spotlessJava
> Task :lib-mrlonis-testing:spotlessJavaApply
> Task :lib-mrlonis-types:spotlessJavaApply
> Task :gateway:spotlessJavaApply
> Task :lib-mrlonis-testing:spotlessApply
> Task :gateway:spotlessApply
> Task :lib-mrlonis-types:spotlessApply
> Task :lib-mrlonis-testing:processResources NO-SOURCE
> Task :lib-mrlonis-types:processResources NO-SOURCE
> Task :gateway:processResources
> Task :lib-mrlonis-testing:generateTestEffectiveLombokConfig
> Task :lib-mrlonis-types:generateTestEffectiveLombokConfig
> Task :gateway:generateEffectiveLombokConfig
> Task :lib-mrlonis-testing:generateEffectiveLombokConfig
> Task :lib-mrlonis-types:generateEffectiveLombokConfig
> Task :playground:spotlessJava
> Task :playground:spotlessJavaApply
> Task :playground:spotlessApply
> Task :playground:processResources
> Task :playground:generateTestEffectiveLombokConfig FROM-CACHE
> Task :playground:generateEffectiveLombokConfig
> Task :api-honkai-star-rail:spotlessJava
> Task :api-honkai-star-rail:spotlessJavaApply
> Task :api-honkai-star-rail:spotlessApply
> Task :api-genshin-impact:spotlessJava
> Task :api-genshin-impact:spotlessJavaApply
> Task :api-genshin-impact:spotlessApply
Picked up JAVA_TOOL_OPTIONS: -XX:MaxRAMPercentage=80.0 -XX:+UseContainerSupport
> Task :api-genshin-impact:processResources

> Task :gateway:compileJava
Picked up JAVA_TOOL_OPTIONS: -XX:MaxRAMPercentage=80.0 -XX:+UseContainerSupport

> Task :api-genshin-impact:generateTestEffectiveLombokConfig FROM-CACHE
> Task :api-genshin-impact:generateEffectiveLombokConfig

> Task :lib-mrlonis-types:compileJava

> Task :api-honkai-star-rail:processResources
> Task :api-honkai-star-rail:generateTestEffectiveLombokConfig FROM-CACHE
> Task :api-honkai-star-rail:generateEffectiveLombokConfig

error: plug-in not found: semanticdb
1 error
> Task :lib-mrlonis-types:compileJava FAILED

> Task :gateway:generateTestEffectiveLombokConfig


FAILURE: Build failed with an exception.

* What went wrong:
[Incubating] Problems report is available at: file:///sources/build/reports/problems/problems-report.html
Execution failed for task ':lib-mrlonis-types:compileJava'.
> Compilation failed; see the compiler output below.
  error: plug-in not found: semanticdb
  1 error

78 actionable tasks: 70 executed, 3 from cache, 5 up-to-date
* Try:
> Check your code and dependencies to fix the compilation error(s)
> Run with --scan to get full insights.

BUILD FAILED in 1m 41s

What's weird is that it doesn't happen for other Java 21 projects.

Is there anything I'm doing wrong here? Or could this be a bug in the indexer?

Thanks in advance.

ofeki-neosec avatar Jan 27 '25 20:01 ofeki-neosec

Hello, Are there any updates on this issue? I can't access the ticket in linear

ofeki-neosec avatar Mar 25 '25 14:03 ofeki-neosec

Hey @olafurpg, do you know if there was any work done around this issue? We tried running it with v0.10.4 and we still experienced the same issue.

ofeki-neosec avatar May 06 '25 14:05 ofeki-neosec

Thank you for reporting! Without looking deeply at this repo, this issue is likely related to Gradle rather than the Java version. It's tricky to inject the compiler plugin to the classpath in all scenarios, many builds do all sorts of things that break the current auto-indexing logic.

I would look at the source code of the Gradle plugin in the scip-java repo to troubleshoot the issue. We have test fixtures to run e2e tests that could help minimize the root problem.

olafurpg avatar May 06 '25 14:05 olafurpg

Probably down to this check.

The lombok plugin creates its own config and extends annotationProcessor from it here.

It also adds to the config using defaultDependencies here which doesn't add the dependency unless no other dependencies have been declared.

So if Lombok is the only annotation processor used then apConfig.getDependencies().size() > 0 will always be false. Hence the semantic plugin will not be added to the annotationProcessor path and will fail.

Is there a reason not to always add it to annotationProcessor path?

Arthurm1 avatar Jun 04 '25 13:06 Arthurm1