Skip to content

[BUG] [GRADLE] Custom generator task fails in gradle 5+ #2648

@Ranbato

Description

@Ranbato

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
    3.3.4
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

Building using custom (e.g. additional) tasks fails when using gradle 5.0 or greater with the following error

Initialized native services in: /Users/z002m6r/.gradle/native
The client will now receive all logging from the daemon (pid: 20328). The daemon log file: /Users/z002m6r/.gradle/daemon/5.3.1/daemon-20328.out.log
Starting 10th build in daemon [uptime: 31 mins 26.786 secs, performance: 99%, non-heap usage: 18% of 268.4 MB]
Using 8 worker leases.
Starting Build
Settings evaluated using settings file '/Users/z002m6r/src/openapi-generator/modules/openapi-generator-gradle-plugin/samples/local-spec/settings.gradle'.
Projects loaded. Root project using build file '/Users/z002m6r/src/openapi-generator/modules/openapi-generator-gradle-plugin/samples/local-spec/build.gradle'.
Included projects: [root project 'local-spec']

> Configure project :
Evaluating root project 'local-spec' using build file '/Users/z002m6r/src/openapi-generator/modules/openapi-generator-gradle-plugin/samples/local-spec/build.gradle'.
Invalidating in-memory cache of /Users/z002m6r/.gradle/caches/journal-1/file-access.bin
All projects evaluated.
Selected primary task 'buildGoSdk' from project :
Tasks to be executed: [task ':buildGoSdk']
:buildGoSdk (Thread[Execution worker for ':',5,main]) started.

> Task :buildGoSdk FAILED
Task ':buildGoSdk' is not up-to-date because:
  Task has not declared any outputs despite executing actions.
:buildGoSdk (Thread[Execution worker for ':',5,main]) completed. Took 0.008 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':buildGoSdk'.
> No value has been specified for this provider.

* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.3.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 1s
1 actionable task: 1 executed

It can be duplicated with the included samples modules/openapi-generator-gradle-plugin/samples/local-spec/build.gradle

openapi-generator version

openapiGeneratorVersion = '3.3.4' and latest

OpenAPI declaration file content or url
Command line used for generation

gradle buildGoSdk --info

Steps to reproduce

set default gradle to 5.0 or higher. I have tested with 4.10, 5.1 and 5.3
clone repo
cd /openapi-generator/modules/openapi-generator-gradle-plugin/samples/local-spec
gradle buildGoSdk --info

Related issues/PRs

None found

Suggest a fix

detekt/detekt#1421 seems similar, but I haven't been able to find a similar solution

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions