-
-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fork properties not found #75
Comments
hi, @thejeff77 as far as i investigated, we should use probably, this is what you want to know. |
Unfortunatly no. I'm not trying to set a local profile running the app. I'm trying to set it when the plugin runs - which is what this |
sorry, but i don’t understand your point. if you try my suggestion, your config file gonna be like this. openApi {
waitTimeInSeconds.set(120)
bootRun {
args = ["--spring.profiles.active=local"]
}
outputDir.set(file("$rootDir/application"))
groupedApiMappings.set(["http://localhost:8080/v3/api-docs/someGroup1" : "someGroup1.json",
"http://localhost:8080/v3/api-docs/someGroup2" : "someGroup2.json"])
} i believe this gonna fix your issue, i don't know this is absolutely right way, though. |
and, i forgot what i have to say. i’m not maintainer of this plugin. i hope my advice helps you, a little bit. |
I ran into this too. My workaround: import org.springframework.boot.gradle.tasks.run.BootRun
openApi {
val bootRun = project.tasks["bootRun"] as BootRun
// Previously: properties["spring.profiles.active"] = "apidoc"
bootRun.jvmArgs("-Dspring.profiles.active=apidoc")
} The |
sorry, but i found my workaround has another problem. if configure like please be careful if you choose with this workaround. |
This one works for me: openApi {
} Could the documentation be updated? |
The problem with some of the other answers here is that it modifies the
|
@mhornung-chwy I do not believe that works if you wish to trigger doc generation as part of a greater process (e.g. X dependsOn generateOpenApiDocs, etc). As far as I can tell, there is no viable "workaround" for the missing forkProperties parameter; it would be very helpful if some form of equivalent option were reinstated. We are currently stuck on the older version because of this (unless there is some method to ingest specific environment variables into a specific task directly inside the gradle files?). |
@caspianb Here's another workaround. First, register the new task that depends on the API docs generation and does whatever else it needs to do. tasks.register<DefaultTask>("someTask") {
dependsOn("generateOpenApiDocs")
} Modify tasks.bootRun {
systemProperties(System.getProperties().mapKeys { it.key as String })
} Create a new task to set the tasks.register<DefaultTask>("systemPropsTask") {
System.setProperty("spring.profiles.active", "apidocs")
} Lastly, make the API spec generation depend on the task that sets the system properties. tasks.withType<org.springdoc.openapi.gradle.plugin.OpenApiGeneratorTask> {
dependsOn("systemPropsTask")
} Run |
NOTE: This was edited to fix an incorrect solution that I posted earlier @caspianb here is another workaround. (note: this is all in kotlin DSL) Add the following to top of import org.springframework.boot.gradle.tasks.run.BootRun Then update the bootRun task to set any of the bootRun properties when running the generateOpenApiDocs task. tasks.named<BootRun>("bootRun") {
if (project.gradle.taskGraph.hasTask(":generateOpenApiDocs")) {
// customize bootRun here
// pass all system properties to bootRun (likely only want to pass your specific params here
bootRun.systemProperties(System.getProperties().mapKeys { it.key as String })
}
} |
Seems like you guys are doing a lot of work to work around this issue when you could simply bump the version back to 1.3.3. What's the point of the additional code in your repo rather than waiting for a versioned release with a fix? The easiest thing to maintain is no code. Ex: https://github.com/kelseyhightower/nocode |
Hi there, I faced to this issue too. to customize bootRun parameter, I've submit PR to supply custom properties. |
Non Kotlin workaround where you don't need to trigger doc generation as part of a greater process.
|
after upgrading from 1.3.3 to 1.3.4, get this error:
application/build.gradle
config file:
The text was updated successfully, but these errors were encountered: