Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #7434
Closed
Open
Issue created Sep 16, 2020 by Administrator@rootContributor4 of 6 checklist items completed4/6 checklist items

[BUG] [GRADLE PLUGIN] openapi gradle project generates main.java.srcDirs = ['src/main\java'] which fails build on windows

Created by: CKand

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists? on 5.0.0-beta2
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

The project using openapi is used to automatically generate the client REST API code as an inner gradle project. the generated build.gradle generates the sourcesets as:

sourceSets {
    main.java.srcDirs = ['src/main\java']
}

When building from Windows, this causing the build to fail with

startup failed: build file 'C:\dev\cloudmanagement-currency\currency-api-spec\generated\client\build.gradle': 23: unexpected char: '' @ line 23, column 35. main.java.srcDirs = ['src/main\java']

The only way to fix would be to manually modify this file and build again, or to go back a version.

Expected output:

sourceSets {
    main.java.srcDirs = ['src/main/java']
}
openapi-generator version

"org.openapi.generator" version "4.3.1" workaround to use "org.openapi.generator" version "4.3.0"

OpenAPI declaration file content or url

Content of yaml is irrelevant to the issue

Generation Details

Java based Gradle project run with openapi-generator to create REST service

build.gradle:

task generateJavaClientProject (type: org.openapitools.generator.gradle.plugin.tasks.GenerateTask) {
	inputs.file("src/main/yaml/example-service.yaml")
	outputs.dir(file("generated/client"))
	
    generatorName = "java"
    inputSpec = file("src/main/yaml/example-service.yaml").toString()
    outputDir = file("generated/client").toString()
    apiPackage = "com.example.rest.client"
    invokerPackage = "com.example.rest.invoker"
    modelPackage = "com.example.rest.model"
    configOptions = [
        dateLibrary: "java8"
    ]
}
/**
 * Invoke a "gradlew build" on the generated client project
 */
task buildJavaClientProject(type: GradleBuild) {
	inputs.dir 'generated/client/src'
	outputs.dir 'generated/client/build'
	
	dependsOn 'generateJavaClientProject'
	buildFile = 'generated/client/build.gradle'
	tasks = ['build']	
}
Steps to reproduce

run gradlew build from command line on a windows machine with the above in the configuration files

Related issues/PRs

could not find any related issues

Assignee
Assign to
Time tracking