OpenAPITools / OpenAPITools/openapi-generator

Gradle plugin in multi-module project seems to be ignoring configurations

Open
#7,733 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Description

I have a multi-module gradle build where I use the OpenAPI generator to generate the spring model in one module (:api:model) and generate the server-side API in another (:api:interface). This worked fine in gradle 6.5. In gradle 6.6 and later, this no longer works.

openapi-generator version

4.3.1, 5.0.0

Steps to reproduce

Attached is a sample project that demonstrates the issues:

Module :api:model should just generate the Response class in build\generated-java\src\main\java. Instead, it also generates the V1Api class.

Module :api:interface relies on :api:mode; and should just generate the interface. Both are generated.

You can see this when you run "gradlew clean build". The build fails to compile because :api:model doesn't have the dependencies needed to compile V1Api because it shouldn't be generated at all.

You can see it working in gradle 6.5 by switching versions:

gradlew wrapper --gradle-version=6.5
gradlew clean build

...and failing in gradle 6.6:

gradlew wrapper --gradle-version=6.6
gradlew clean build

gradle_issue.zip

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the attached gradle_issue.zip sample project and run “gradlew clean build” using Gradle 6.5, then 6.6. Inspect generation in :api:model and :api:interface; done means :api:model generates only Response and :api:interface generates only the server-side interface, with the build compiling successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.