[英]Configure swagger in gradle build script with kotlin dsl
I'm trying to switch my simple project from Groovy to Kotlin in build scripts. 我正在尝试在构建脚本中将我的简单项目从Groovy切换到Kotlin。 I'm using this plugin: https://github.com/gigaSproule/swagger-gradle-plugin I have this configuration in my build script:
我正在使用此插件: https : //github.com/gigaSproule/swagger-gradle-plugin我的构建脚本中具有以下配置:
swagger{
apiSource {
springmvc = false
locations = ['my.location']
schemes = ['https']
host = 'test.com:8080'
info {
title = 'My Service'
version = 'v1'
}
swaggerDirectory = "$buildDir/swagger"
}
To where shall I refer to in this situations? 在这种情况下,我该指的是哪里? Shall I do something like?
我可以做点什么吗?
task( "swagger" ) {
...
}
It is not quite familiar for me. 对我来说不是很熟悉。 Thanks.
谢谢。
In case anyone is still looking for this information, this is how you would do it using Gradle Kotlin DSL: 如果有人仍在寻找此信息,这是使用Gradle Kotlin DSL的方式:
import com.benjaminsproule.swagger.gradleplugin.model.*
plugins {
id("com.benjaminsproule.swagger") version "1.0.0"
}
swagger {
apiSource(closureOf<ApiSourceExtension> {
springmvc = false
schemes = mutableListOf("https")
host = "test.com:8080"
info(closureOf<InfoExtension> {
title = "My Service"
version = "v1"
description = "My Service Description"
termsOfService = "http://www.example.com/termsOfService"
contact(closureOf<ContactExtension> {
email = "email@internet.com"
name = "A Developer"
url = "http://www.internet.com"
})
license(closureOf<LicenseExtension> {
url = "http://www.apache.org/licenses/LICENSE-2.0.html"
name = "Apache 2.0"
})
})
locations = mutableListOf("com.foo.fighting")
swaggerDirectory = "$buildDir/swagger"
})
}
I've tested it using Gradle v4.6 . 我已经使用Gradle v4.6对其进行了测试。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.