ort
ort copied to clipboard
Kotlin 2.0 and GradleInspector: Issues with variant selection
Trying to scan an ordinary Kotlin 2.0 project, including Gradle-Kotlin and some standard Spring Boot 3.3.0 dependencies lead to error messages about no matching variant of ... found.
To Reproduce
This ordinary project is here: https://github.com/wkl3nk/demo-7
Console / log output
% ort -P ort.analyzer.enabledPackageManagers=GradleInspector analyze -i . -o .
______________________________
/ \_______ \__ ___/ The OSS Review Toolkit, version 22.0.1-001.sha.ce7d028,
| | | | _/ | | built with JDK 11.0.16.1+1, running under Java 21.0.3.
| | | | | \ | | Executing 'analyze' as 'xxx' on Mac OS X
\________/ |____|___/ |____| with 12 CPUs and a maximum of 8192 MiB of memory.
Environment variables:
...
JAVA_HOME = /Users/xxx/Library/Java/JavaVirtualMachines/temurin-21.0.3/Contents/Home
Looking for ORT configuration in the following file:
/Users/xxx/.ort/config/config.yml
Looking for analyzer-specific configuration in the following files and directories:
/Users/xxx/osmi/demo-7/.ort.yml
/Users/xxx/.ort/config/resolutions.yml (does not exist)
The following 1 package manager(s) are enabled:
GradleInspector
The following 2 package curation provider(s) are enabled:
DefaultDir, DefaultFile
Analyzing project path:
/Users/xxx/osmi/demo-7
Found 1 GradleInspector definition file(s) at:
build.gradle.kts
Found in total 1 definition file(s) from the following 1 package manager(s):
GradleInspector
12:16:16.044 [DefaultDispatcher-worker-1] WARN org.gradle.tooling.GradleConnector - Analyzing the project in '/Users/xxx/osmi/demo-7' produced the following error output:
Could not resolve com.fasterxml.jackson.module:jackson-module-kotlin from project :. Causes are:
org.gradle.internal.component.resolution.failure.exception.VariantSelectionException: No matching variant of com.fasterxml.jackson.module:jackson-module-kotlin:2.17.1 was found. The consumer was configured to find sources for use during runtime, packaged as a jar, preferably optimized for standard JVMs, and its dependencies declared externally, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' but:
- Variant 'apiElements' declares a component, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares a library for use during compile-time and the consumer needed documentation for use during runtime
- Other compatible attributes:
- Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
- Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'jvm')
- Doesn't say anything about the documentation type (required sources)
- Variant 'runtimeElements' declares a component for use during runtime, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares a library and the consumer needed documentation
- Other compatible attributes:
- Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
- Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'jvm')
- Doesn't say anything about the documentation type (required sources)
Could not resolve com.fasterxml.jackson.module:jackson-module-kotlin from project :. Causes are:
org.gradle.internal.component.resolution.failure.exception.VariantSelectionException: No matching variant of com.fasterxml.jackson.module:jackson-module-kotlin:2.17.1 was found. The consumer was configured to find sources for use during runtime, packaged as a jar, preferably optimized for standard JVMs, and its dependencies declared externally, as well as attribute 'documentation' with value 'documentation', attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' but:
- Variant 'apiElements' declares a component, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares a library for use during compile-time and the consumer needed documentation for use during runtime
- Other compatible attributes:
- Doesn't say anything about documentation (required 'documentation')
- Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
- Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'jvm')
- Doesn't say anything about the documentation type (required sources)
- Variant 'runtimeElements' declares a component for use during runtime, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares a library and the consumer needed documentation
- Other compatible attributes:
- Doesn't say anything about documentation (required 'documentation')
- Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
- Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'jvm')
- Doesn't say anything about the documentation type (required sources)
Could not resolve com.fasterxml.jackson.module:jackson-module-kotlin from project :. Causes are:
org.gradle.internal.component.resolution.failure.exception.VariantSelectionException: No matching variant of com.fasterxml.jackson.module:jackson-module-kotlin:2.17.1 was found. The consumer was configured to find sources for use during runtime, packaged as a jar, preferably optimized for standard JVMs, and its dependencies declared externally, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' but:
- Variant 'apiElements' declares a component, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares a library for use during compile-time and the consumer needed documentation for use during runtime
- Other compatible attributes:
- Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
- Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'jvm')
- Doesn't say anything about the documentation type (required sources)
- Variant 'runtimeElements' declares a component for use during runtime, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares a library and the consumer needed documentation
- Other compatible attributes:
- Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
- Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'jvm')
- Doesn't say anything about the documentation type (required sources)
Could not resolve com.fasterxml.jackson.module:jackson-module-kotlin from project :. Causes are:
org.gradle.internal.component.resolution.failure.exception.VariantSelectionException: No matching variant of com.fasterxml.jackson.module:jackson-module-kotlin:2.17.1 was found. The consumer was configured to find sources for use during runtime, packaged as a jar, preferably optimized for standard JVMs, and its dependencies declared externally, as well as attribute 'documentation' with value 'documentation', attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' but:
- Variant 'apiElements' declares a component, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares a library for use during compile-time and the consumer needed documentation for use during runtime
- Other compatible attributes:
- Doesn't say anything about documentation (required 'documentation')
- Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
- Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'jvm')
- Doesn't say anything about the documentation type (required sources)
- Variant 'runtimeElements' declares a component for use during runtime, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares a library and the consumer needed documentation
- Other compatible attributes:
- Doesn't say anything about documentation (required 'documentation')
- Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
- Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'jvm')
- Doesn't say anything about the documentation type (required sources)
...
First ideas:
With Kotlin 2.0.0 as dependency in build.gradle.kts - in comparison to Kotlin 1.9.24 - I see two additional configurations:
- dependencySources
- testDependencySources
Both of them carry an attribute documentation that is mentioned in the error messages ("consumer needed documentation")
Scope exclusion of these two scopes in .ort.yml did not solve the problem.