1
0
Fork 0

Move api artifact to own module

This commit is contained in:
Chris Dombroski 2024-11-24 20:14:24 -05:00
parent 8ad06a748a
commit 33dea801c1
4 changed files with 23 additions and 2 deletions

16
api/build.gradle.kts Normal file
View file

@ -0,0 +1,16 @@
plugins {
}
group = "org.springframework.samples"
val apiArtifact by configurations.creating {
isCanBeResolved = false
}
repositories {
mavenCentral()
}
artifacts {
add(apiArtifact.name, file("${projectDir}/openapi.yml"))
}

View file

@ -7,6 +7,10 @@ plugins {
group = "org.springframework.samples" group = "org.springframework.samples"
val apiArtifact by configurations.creating {
isCanBeConsumed = false
}
java { java {
toolchain { toolchain {
languageVersion = JavaLanguageVersion.of(21) languageVersion = JavaLanguageVersion.of(21)
@ -24,6 +28,7 @@ repositories {
} }
dependencies { dependencies {
apiArtifact(project(":api", "apiArtifact"))
implementation("org.springframework.boot:spring-boot-starter-web") implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-validation") implementation("org.springframework.boot:spring-boot-starter-validation")
implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.6.0") implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.6.0")
@ -38,7 +43,7 @@ java.sourceSets["main"].java {
} }
openApiGenerate { openApiGenerate {
inputSpec.set("${projectDir}/src/main/resources/openapi.yml") inputSpec.set(apiArtifact.singleFile.absolutePath)
outputDir.set(layout.buildDirectory.dir("generated/sources/openapi").map { it.asFile.absolutePath }) outputDir.set(layout.buildDirectory.dir("generated/sources/openapi").map { it.asFile.absolutePath })
generatorName.set("spring") generatorName.set("spring")
library.set("spring-boot") library.set("spring-boot")

View file

@ -5,4 +5,4 @@
* For more detailed information on multi-project builds, please refer to https://docs.gradle.org/8.7/userguide/multi_project_builds.html in the Gradle documentation. * For more detailed information on multi-project builds, please refer to https://docs.gradle.org/8.7/userguide/multi_project_builds.html in the Gradle documentation.
*/ */
rootProject.name = "petclinic" rootProject.name = "petclinic"
include("backend", "backend-model") include("backend", "backend-model", "api")