Skip to content

[BUG] Missing dependencies in java generator #5690

Closed
@mariomac

Description

@mariomac

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?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

When I try to run the generated gradle, some dependencies are missing. I get some errors like the following:

/path/File.java:xx: error: package org.openapitools.jackson.nullable does not exist
import org.openapitools.jackson.nullable.JsonNullableModule;

Which is solved by adding the following line to the dependencies section:

    compile "org.openapitools:jackson-databind-nullable:0.2.1"

This is the configuration of the gradle task that generates the failing gradle script:

task openApiJavaClient(type: org.openapitools.generator.gradle.plugin.tasks.GenerateTask) {
    generatorName = "java"
    inputSpec = specFile
    outputDir = generatedSubproject
    invokerPackage = "com.foo"
    modelPackage = "com.foo"

    configOptions = [
                      dateLibrary    : "java8",
                      library        : "native",
                      artifactId     : "java-api-client",
                      artifactVersion: project.version,
                      java8          : "true",
    ]
    systemProperties = [
            modelDocs: "false"
    ]
}

javadoc {
    failOnError = false
}

jar.dependsOn tasks.openApiJavaClient
openapi-generator version

4.2.3

OpenAPI declaration file content or url

N/A

Command line used for generation

./gradlew clean build

Steps to reproduce

./gradlew clean build

Related issues/PRs

It seems this issue was fixed in v4.1.2 but it happens again in v4.2.3:

#3793

Suggest a fix

N/A

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