OpenAPITools / OpenAPITools/openapi-generator
[BUG] Error during gradle build: Cannot choose between the following variants of org.openapitools:openapi-generator-gradle-plugin:7.3.0
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Description
I have a gradle project that uses the following dependendy in its buildscript:
buildscript {
repositories {
[...]
}
dependencies {
classpath 'org.openapitools:openapi-generator-gradle-plugin:7.3.0'
}
}
apply plugin: 'org.openapi.generator'
openApiGenerate {
generatorName.set("html2")
inputSpec.set("$rootDir/src/Resources/Documentation/My.yaml")
outputDir.set("$rootDir/bin/apiGenerator")
}
When I run the build, I get the following error: during the dependency resolution step:
> Could not resolve org.openapitools:openapi-generator-gradle-plugin:7.3.0.
Required by:
project :
> Cannot choose between the following variants of org.openapitools:openapi-generator-gradle-plugin:7.3.0:
- javadocElements
- sourcesElements
All of them match the consumer attributes:
- Variant 'javadocElements' capability org.openapitools:openapi-generator-gradle-plugin:7.3.0:
- Unmatched attributes:
- Found org.gradle.category 'documentation' but wasn't required.
- Found org.gradle.docstype 'javadoc' but wasn't required.
- Required org.gradle.jvm.version '8' but no value provided.
- Required org.gradle.libraryelements 'jar' but no value provided.
- Found org.gradle.status 'release' but wasn't required.
- Compatible attributes:
- Required org.gradle.dependency.bundling 'external' and found compatible value 'external'.
- Required org.gradle.usage 'java-runtime' and found compatible value 'java-runtime'.
- Variant 'sourcesElements' capability org.openapitools:openapi-generator-gradle-plugin:7.3.0:
- Unmatched attributes:
- Found org.gradle.category 'documentation' but wasn't required.
- Found org.gradle.docstype 'sources' but wasn't required.
- Required org.gradle.jvm.version '8' but no value provided.
- Required org.gradle.libraryelements 'jar' but no value provided.
- Found org.gradle.status 'release' but wasn't required.
- Compatible attributes:
- Required org.gradle.dependency.bundling 'external' and found compatible value 'external'.
- Required org.gradle.usage 'java-runtime' and found compatible value 'java-runtime'.
I have tried several things in order to choose a variant, but nothing I tried helped, and I was unable to find an explanation of how to solve this problem anywhere.
However, if I use version 6.6.0 instead, it works just find.
openapi-generator version
'org.openapitools:openapi-generator-gradle-plugin:6.6.0'
OpenAPI declaration file content or url
not applicable
Generation Details
not applicable
Steps to reproduce
see description
Related issues/PRs
not applicable
Suggest a fix
Either make it so that one of those two variants is automatically chosen as a default value, or provide guidance in the documentation about how the build.gradle should be adjusted it this happens.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the build.gradle dependency example and compare resolution of org.openapitools:openapi-generator-gradle-plugin:7.3.0 with 6.6.0. Investigate how the Gradle plugin artifact publishes and selects variants, then verify the result with the reported build configuration. Done means the 7.3.0 dependency resolves correctly or the required build.gradle adjustment is documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100