Skip to content
This repository has been archived by the owner on Nov 23, 2024. It is now read-only.

Boilerplate should be done by the plugin, not by the user #130

Open
asarkar opened this issue Dec 20, 2018 · 2 comments
Open

Boilerplate should be done by the plugin, not by the user #130

asarkar opened this issue Dec 20, 2018 · 2 comments

Comments

@asarkar
Copy link

asarkar commented Dec 20, 2018

Using the plugin requires the following boilerplate set up:

compileJava.dependsOn swaggerSources.wiremock.code
sourceSets.main.java.srcDir "${swaggerSources.wiremock.code.outputDir}/src/main/java"
sourceSets.main.resources.srcDir "${swaggerSources.wiremock.code.outputDir}/src/main/resources"

idea {
    module {
        sourceDirs += file("${swaggerSources.wiremock.code.outputDir}/src/main/java")
        sourceDirs += file("${swaggerSources.wiremock.code.outputDir}/src/main/resources")
        generatedSourceDirs += file("${swaggerSources.wiremock.code.outputDir}")
    }
}

A good-natured Gradle plugin should do the above in the plugin code. See this discussion in the Gradle forum on a similar issue.

Environment

Plugin version: 2.15.1
Swagger Codegen version: 2.3.1
Gradle version: 4.10.2

@asarkar asarkar added the bug label Dec 20, 2018
@int128 int128 added enhancement and removed bug labels Dec 20, 2018
@DALDEI
Copy link

DALDEI commented Jan 9, 2019

For my uses, I found it better to keep the generated builds as totally seperate gradle builds and add the following:

task buildJavaSwagger( type: GradleBuild ,dependsOn: generateSwaggerCodeJavaSource) {
  group 'build'
  inputs.files generateSwaggerCodeJavaSource.outputs.files
  dir = file("${generatedDir}/java")
  tasks = ["build"]
}

@rmarinsky
Copy link

Hi @int128, could share some workaround or fix for it, please?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants