kotlin - Swagger 与 Spring webflux 依赖构建问题

标签 kotlin swagger-ui spring-webflux swagger-2.0 spring-boot-gradle-plugin

我使用 kotlin gradle 项目。当我尝试集成 swagger 时,它显示

无法解析 io.springfox:springfox-swagger2:3.0.0-SNAPSHOT。 可能的解决方案: - 声明提供工件的存储库,请参阅文档

错误

  • springfox-swagger2:3.0.0-SNAPSHOT
  • springfox-swagger-ui:3.0.0-SNAPSHOT
  • springfox-spring-webflux:3.0.0-SNAPSHOT

同时重新导入 gradle 项目。

buildscript {
ext {
    kotlin_version = "1.2.51"
    springBootVersion = "2.0.3.RELEASE"

    junitPlatformVersion = '1.0.0-M2'
    junitJupiterVersion = '5.0.0-M2'
    junitVintageVersion = '4.12.0-M2'

    smack_version = '4.2.3'
}

repositories {
    mavenLocal()
    mavenCentral()
    maven { url "https://repo.spring.io/milestone" }
    maven { url "https://repo.spring.io/snapshot" }
    maven { url "https://repo.spring.io/libs-snapshot" }
}
dependencies {
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    classpath "io.spring.gradle:dependency-management-plugin:1.0.3.RELEASE"
    classpath("org.jetbrains.kotlin:kotlin-allopen:${kotlin_version}")

}

}

默认任务“清理”、“构建”

子项目{

apply plugin: 'java'
apply plugin: 'kotlin'
apply plugin: 'kotlin-spring'

sourceCompatibility = 1.8

repositories {
    maven { url "https://repo.spring.io/libs-snapshot" }
    mavenLocal()
    mavenCentral()
    maven { url "http://archiva.hsenidmobile.com/repository/internal" }
    maven { url "https://repo.spring.io/milestone" }
    maven { url "https://repo.spring.io/snapshot" }
    maven { url "https://repo.spring.io/libs-snapshot" }
    maven { url 'http://oss.jfrog.org/artifactory/oss-snapshot-local/' }
    jcenter()

}

dependencies {
    compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
    compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"

    compile("org.springframework.boot:spring-boot-starter-webflux:$springBootVersion") {
        exclude(module: "hibernate-validator")
    }

    compile("org.springframework.boot:spring-boot-starter-data-jpa:$springBootVersion")
    compile("org.springframework.boot:spring-boot-starter-security:$springBootVersion")
    compile("javax.servlet:javax.servlet-api:3.0.1")

    compile("io.jsonwebtoken:jjwt:0.7.0")

    compile("hms.common:hms-common-util:1.0.9")

    compile("com.fasterxml.jackson.module:jackson-module-kotlin:2.9.0.pr4")
    compile("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.9.0.pr4")
    compile("org.postgresql:postgresql:42.1.4")
    compile("com.google.api-client:google-api-client:1.22.0")

    compile group: 'org.springframework.plugin', name: 'spring-plugin-core', version: '2.0.0.RELEASE'

    compile 'io.springfox:springfox-swagger2:3.0.0-SNAPSHOT'
    compile 'io.springfox:springfox-swagger-ui:3.0.0-SNAPSHOT'
    compile 'io.springfox:springfox-spring-webflux:3.0.0-SNAPSHOT'



    implementation "org.igniterealtime.smack:smack-tcp:$smack_version"
    implementation "org.igniterealtime.smack:smack-experimental:$smack_version"
    implementation "org.igniterealtime.smack:smack-java7:$smack_version"
    implementation "org.igniterealtime.smack:smack-extensions:$smack_version"
    implementation "org.igniterealtime.smack:smack-im:$smack_version"

    testCompile("org.junit.jupiter:junit-jupiter-api:${junitJupiterVersion}")
    testCompile("org.junit.platform:junit-platform-runner:${junitPlatformVersion}")
    testCompile("org.springframework.boot:spring-boot-starter-test:$springBootVersion")
    testCompile("io.projectreactor:reactor-test:3.1.0.RELEASE")

    runtime("tanukisoft:wrapper:3.2.3")

    testRuntime("org.junit.jupiter:junit-jupiter-engine:${junitJupiterVersion}")    //JUnit5
    testRuntime("org.junit.vintage:junit-vintage-engine:${junitVintageVersion}") //JUnit4

}

compileKotlin {
    kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
    kotlinOptions.jvmTarget = "1.8"
}

}

最佳答案

添加此存储库

    <repository>
        <id>jcenter-snapshots</id>
        <name>jcenter</name>
        <url>http://oss.jfrog.org/artifactory/oss-snapshot-local/</url>
    </repository>

这是 Maven 语法,但你可以轻松地将其转换为 gradle

关于kotlin - Swagger 与 Spring webflux 依赖构建问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59853481/

相关文章:

android - 让协程等待以前的调用

java - 使用类路径中的 Kotlin 运行时库执行 Java 和 Kotlin 程序

json - swagger-ui 和动态主机名

c# - Swashbuckle 不再正确呈现 HTML Swagger 文档

java - 如何在 Spring Flux 错误处理程序中访问引用源对象?

java - 无法在本地主机 :8080/h2-console when using webflux 访问 H2 数据库

android - 在 Jetpack Compose LazyColumn 项目中检测到点击手势时返回错误的项目

java: Spring Boot - Swagger2: 找不到 HTTP 请求的映射

spring-boot - 如何并行调用多个Spring Webclient并等待结果?

kotlin - 如何在 micronaut 上启用 swagger UI?