I use open openapi-generator-gradle-plugin. This is my build.gradle:
buildscript {
repositories {
mavenLocal()
jcenter {
url "http://nexus.ca.sbrf.ru:8081/nexus/content/repositories/jcenter"
}
maven {
url "http://nexus.ca.sbrf.ru:8081/nexus/content/repositories/central"
}
maven { url 'http://nexus.ca.sbrf.ru:8081/nexus/content/repositories/Atlassian_proxy' }
maven { url 'http://nexus.ca.sbrf.ru:8081/nexus/content/groups/public' }
dependencies {
classpath 'org.openapitools:openapi-generator-gradle-plugin:4.3.0'
classpath "org.springframework.boot:spring-boot-gradle-plugin:2.2.1.RELEASE"
classpath "io.spring.gradle:dependency-management-plugin:1.0.9.RELEASE"
}
}
}
apply plugin: 'java'
apply plugin: 'org.openapi.generator'
apply plugin: "maven-publish"
apply plugin: "io.spring.dependency-management"
apply plugin: "org.springframework.boot"
dependencies {
compile 'org.springframework:spring-context:5.3.0'
compile 'org.springframework:spring-web:4.1.6.RELEASE'
compile 'javax.servlet:javax.servlet-api:4.0.1'
compile 'org.openapitools:jackson-databind-nullable:0.2.1'
compile 'io.swagger:swagger-core:1.5.21'
compile 'javax.annotation:javax.annotation-api:1.3.1'
}
openApiGenerate {
generatorName = "spring"
library = "resttemplate"
inputSpec = "$rootDir/openapi-contracts/src/main/resources/openapi/api.yml".toString()
outputDir = "$project.buildDir/generated/openapi"
apiPackage = "ru.openapi.api.v1"
modelPackage = "ru.openapi.model.v1"
enablePostProcessFile = true
configOptions = [
dateLibrary : "java8",
useBeanValidation : "true",
enableBuilderSupport: "true",
interfaceOnly : "true",
delegatePattern : "true"
]
}
sourceSets {
main {
java {
srcDirs "build/generated/openapi/src/main/java"
}
}
}
The server code is being generated, everything is fine, but I want the resttemplate to be generated for it.
For this I have indicated:
library = "resttemplate"
I am getting this error:
Unknown library: resttemplate Available libraries: spring-boot spring-mvc spring-cloud
How can I solve this problem?