在Docker中运行嵌入式mongo时org.springframework.beans.factory.UnsatisfiedDependencyException

时间:2019-02-12 08:14:04

标签: spring spring-boot docker gradle kotlin

当我在本地运行./gradlew build./gradlew test时,它运行正常。但是,当我在docker容器中运行这些命令时,出现错误org.springframework.beans.factory.UnsatisfiedDependencyException

Starting a Gradle Daemon (subsequent builds will be faster)
> Task :compileKotlin
> Task :compileJava NO-SOURCE
> Task :processResources
> Task :classes
> Task :compileTestKotlin
> Task :compileTestJava NO-SOURCE
> Task :processTestResources
> Task :testClasses

> Task :test

app.example.core.controllers.v1.AuthenticationControllerTest > ifInvalidEmailOnRegistrationReturnInvalidEmailError FAILED
    java.lang.IllegalStateException
        Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException
            Caused by: org.springframework.beans.factory.BeanCreationException
                Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException
                    Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException
                        Caused by: org.springframework.beans.factory.BeanCreationException
                            Caused by: java.io.IOException
                                Caused by: java.io.IOException

app.example.core.controllers.v1.AuthenticationControllerTest > whenNoUserFoundReturnUserNotFoundError FAILED
    java.lang.IllegalStateException
        Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException
            Caused by: org.springframework.beans.factory.BeanCreationException
                Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException
                    Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException
                        Caused by: org.springframework.beans.factory.BeanCreationException
                            Caused by: java.io.IOException
                                Caused by: java.io.IOException

app.example.core.controllers.v1.AuthenticationControllerTest > acceptsUserRegistrationDetails FAILED
    java.lang.IllegalStateException
        Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException
            Caused by: org.springframework.beans.factory.BeanCreationException
                Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException
                    Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException
                        Caused by: org.springframework.beans.factory.BeanCreationException
                            Caused by: java.io.IOException
                                Caused by: java.io.IOException

app.example.core.controllers.v1.AuthenticationControllerTest > userCanLoginWithUsernameAndPassword FAILED
    java.lang.IllegalStateException
        Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException
            Caused by: org.springframework.beans.factory.BeanCreationException
                Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException
                    Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException
                        Caused by: org.springframework.beans.factory.BeanCreationException
                            Caused by: java.io.IOException
                                Caused by: java.io.IOException

app.example.core.controllers.v1.AuthenticationControllerTest > newUserMustHaveValidEmail FAILED
    java.lang.IllegalStateException
        Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException
            Caused by: org.springframework.beans.factory.BeanCreationException
                Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException
                    Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException
                        Caused by: org.springframework.beans.factory.BeanCreationException
                            Caused by: java.io.IOException
                                Caused by: java.io.IOException

app.example.core.controllers.v1.AuthenticationControllerTest > verifyNewTokenSavedWithReferenceToUser FAILED
    java.lang.IllegalStateException
        Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException
            Caused by: org.springframework.beans.factory.BeanCreationException
                Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException
                    Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException
                        Caused by: org.springframework.beans.factory.BeanCreationException
                            Caused by: java.io.IOException
                                Caused by: java.io.IOException

app.example.core.controllers.v1.AuthenticationControllerTest > authenticationFailedErrorReturnedIfIncorrectPassword FAILED
    java.lang.IllegalStateException
        Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException
            Caused by: org.springframework.beans.factory.BeanCreationException
                Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException
                    Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException
                        Caused by: org.springframework.beans.factory.BeanCreationException
                            Caused by: java.io.IOException
                                Caused by: java.io.IOException

app.example.core.controllers.v1.AuthenticationControllerTest > registrationFailsWhenUsernameExists FAILED
    java.lang.IllegalStateException
        Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException
            Caused by: org.springframework.beans.factory.BeanCreationException
                Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException
                    Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException
                        Caused by: org.springframework.beans.factory.BeanCreationException
                            Caused by: java.io.IOException
                                Caused by: java.io.IOException

app.example.core.controllers.v1.AuthenticationControllerTest > registrationReturnsUserRegistrationResponse FAILED
    java.lang.IllegalStateException
        Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException
            Caused by: org.springframework.beans.factory.BeanCreationException
                Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException
                    Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException
                        Caused by: org.springframework.beans.factory.BeanCreationException
                            Caused by: java.io.IOException
                                Caused by: java.io.IOException

app.example.core.controllers.v1.AuthenticationControllerTest > verifyPasswordIsEncryptedWhenNewUserCreated FAILED
    java.lang.IllegalStateException
        Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException
            Caused by: org.springframework.beans.factory.BeanCreationException
                Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException
                    Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException
                        Caused by: org.springframework.beans.factory.BeanCreationException
                            Caused by: java.io.IOException
                                Caused by: java.io.IOException

app.example.core.controllers.v1.AuthenticationControllerTest > ifInvalidPasswordOnRegistrationReturnInvalidPasswordError FAILED
    java.lang.IllegalStateException
        Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException
            Caused by: org.springframework.beans.factory.BeanCreationException
                Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException
                    Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException
                        Caused by: org.springframework.beans.factory.BeanCreationException
                            Caused by: java.io.IOException
                                Caused by: java.io.IOException

app.example.core.controllers.v1.AuthenticationControllerTest > onLogoutErrorNotifyConsumerLogoutFailed FAILED
    java.lang.IllegalStateException
        Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException
            Caused by: org.springframework.beans.factory.BeanCreationException
                Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException
                    Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException
                        Caused by: org.springframework.beans.factory.BeanCreationException
                            Caused by: java.io.IOException
                                Caused by: java.io.IOException

app.example.core.controllers.v1.AuthenticationControllerTest > verifyUserAuthenticationDetailsIsSavedToDatabaseWhenNewUserCreated FAILED
    java.lang.IllegalStateException
        Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException
            Caused by: org.springframework.beans.factory.BeanCreationException
                Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException
                    Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException
                        Caused by: org.springframework.beans.factory.BeanCreationException
                            Caused by: java.io.IOException
                                Caused by: java.io.IOException

app.example.core.controllers.v1.AuthenticationControllerTest > registrationFailsWhenInvalidPasswordProvided FAILED
    java.lang.IllegalStateException
        Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException
            Caused by: org.springframework.beans.factory.BeanCreationException
                Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException
                    Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException
                        Caused by: org.springframework.beans.factory.BeanCreationException
                            Caused by: java.io.IOException
                                Caused by: java.io.IOException

app.example.core.controllers.v1.AuthenticationControllerTest > userCanLogout FAILED
    java.lang.IllegalStateException
        Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException
            Caused by: org.springframework.beans.factory.BeanCreationException
                Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException
                    Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException
                        Caused by: org.springframework.beans.factory.BeanCreationException
                            Caused by: java.io.IOException
                                Caused by: java.io.IOException

18 tests completed, 15 failed

> Task :test FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':test'.
> There were failing tests. See the report at: file:///app/build/junitHtml/index.html

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':test'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$2.accept(ExecuteActionsTaskExecuter.java:121)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$2.accept(ExecuteActionsTaskExecuter.java:117)
    at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:184)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:110)
    at org.gradle.api.internal.tasks.execution.ResolveIncrementalChangesTaskExecuter.execute(ResolveIncrementalChangesTaskExecuter.java:84)
    at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:91)
    at org.gradle.api.internal.tasks.execution.ResolveBeforeExecutionStateTaskExecuter.execute(ResolveBeforeExecutionStateTaskExecuter.java:74)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:109)
    at org.gradle.api.internal.tasks.execution.ResolveBeforeExecutionOutputsTaskExecuter.execute(ResolveBeforeExecutionOutputsTaskExecuter.java:67)
    at org.gradle.api.internal.tasks.execution.ResolveAfterPreviousExecutionStateTaskExecuter.execute(ResolveAfterPreviousExecutionStateTaskExecuter.java:46)
    at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:93)
    at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:45)
    at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:94)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
    at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:63)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:49)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:46)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:46)
    at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:43)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:355)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:343)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:336)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:322)
    at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:134)
    at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:129)
    at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:202)
    at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:193)
    at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:129)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
    at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: org.gradle.api.GradleException: There were failing tests. See the report at: file:///app/build/junitHtml/index.html
    at org.gradle.api.tasks.testing.AbstractTestTask.handleTestFailures(AbstractTestTask.java:626)
    at org.gradle.api.tasks.testing.AbstractTestTask.executeTests(AbstractTestTask.java:498)
    at org.gradle.api.tasks.testing.Test.executeTests(Test.java:587)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:103)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:48)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:41)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:28)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:705)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:672)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$4.run(ExecuteActionsTaskExecuter.java:338)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:402)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:394)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:92)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:327)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:312)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access$200(ExecuteActionsTaskExecuter.java:75)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.execute(ExecuteActionsTaskExecuter.java:158)
    at org.gradle.internal.execution.impl.steps.ExecuteStep.execute(ExecuteStep.java:46)
    at org.gradle.internal.execution.impl.steps.CancelExecutionStep.execute(CancelExecutionStep.java:34)
    at org.gradle.internal.execution.impl.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:69)
    at org.gradle.internal.execution.impl.steps.TimeoutStep.execute(TimeoutStep.java:49)
    at org.gradle.internal.execution.impl.steps.CatchExceptionStep.execute(CatchExceptionStep.java:34)
    at org.gradle.internal.execution.impl.steps.CreateOutputsStep.execute(CreateOutputsStep.java:49)
    at org.gradle.internal.execution.impl.steps.SnapshotOutputStep.execute(SnapshotOutputStep.java:42)
    at org.gradle.internal.execution.impl.steps.SnapshotOutputStep.execute(SnapshotOutputStep.java:28)
    at org.gradle.internal.execution.impl.steps.CacheStep.executeWithoutCache(CacheStep.java:133)
    at org.gradle.internal.execution.impl.steps.CacheStep.lambda$execute$5(CacheStep.java:83)
    at org.gradle.internal.execution.impl.steps.CacheStep.execute(CacheStep.java:82)
    at org.gradle.internal.execution.impl.steps.CacheStep.execute(CacheStep.java:37)
    at org.gradle.internal.execution.impl.steps.PrepareCachingStep.execute(PrepareCachingStep.java:33)
    at org.gradle.internal.execution.impl.steps.StoreSnapshotsStep.execute(StoreSnapshotsStep.java:38)
    at org.gradle.internal.execution.impl.steps.StoreSnapshotsStep.execute(StoreSnapshotsStep.java:23)
    at org.gradle.internal.execution.impl.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:95)
    at org.gradle.internal.execution.impl.steps.SkipUpToDateStep.lambda$execute$0(SkipUpToDateStep.java:88)
    at org.gradle.internal.execution.impl.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:52)
    at org.gradle.internal.execution.impl.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:36)
    at org.gradle.internal.execution.impl.DefaultWorkExecutor.execute(DefaultWorkExecutor.java:34)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:109)
    ... 37 more


* Get more help at https://help.gradle.org

BUILD FAILED in 1m 29s

Dockerfile

FROM clementoh/circleci-openjdk:jdk8-gradle-5.2.1
WORKDIR /app
COPY . /app
RUN ./gradlew test

更新:

使用gradle标志运行--debug后,发现此目录缺少错误。

由于某些原因,目录/tmp/extract-f09acc66-9722-46f3-8645-c7dc9d53f60dextractmongod不存在。以前从来没有这个错误。

 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'embeddedMongoServer' defined in class path resource [org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.class]: Invocation of init method failed; nested exception is java.io.IOException: Cannot run program "/tmp/extract-f09acc66-9722-46f3-8645-c7dc9d53f60dextractmongod": error=2, No such file or directory

build.kts

@file:Suppress("SpellCheckingInspection")

import org.gradle.internal.impldep.org.apache.maven.model.Build
import org.jetbrains.kotlin.gradle.dsl.KotlinCommonOptions
import org.jetbrains.kotlin.gradle.dsl.KotlinCommonToolOptions
import org.jetbrains.kotlin.gradle.dsl.KotlinCompile
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions
import org.springframework.boot.gradle.tasks.bundling.BootJar

group = "app.example"
version = "0.0.1-SNAPSHOT"

buildscript {
    val kotlinVersion = "1.3.0"
    val springBootVersion = "2.1.2.RELEASE"

    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion")
        classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
        classpath("org.jetbrains.kotlin:kotlin-allopen:$kotlinVersion")
    }
}

repositories {
    mavenCentral()
}

plugins {
    java
    jacoco
    eclipse
    id("org.jetbrains.kotlin.jvm") version "1.3.20"
}

apply(plugin = "kotlin")
apply(plugin = "kotlin-spring")
apply(plugin = "eclipse")
apply(plugin = "org.springframework.boot")
apply(plugin = "io.spring.dependency-management")


tasks {
    withType<KotlinCompile<KotlinJvmOptions>> {
        kotlinOptions.freeCompilerArgs = listOf("-Xjsr305=strict")
        kotlinOptions.jvmTarget = "1.8"
    }

    withType<JacocoReport> {
        reports {
            xml.isEnabled = false
            csv.isEnabled = false
            html.destination = file("$buildDir/jacocoHtml")
        }

        afterEvaluate {
            val filesToAvoidForCoverage = listOf(
                "/dto",
                "/config",
                "AuthenticationMicroServiceKt.class"
            )
            val filesToCover = mutableListOf<String>()
            File("build/classes/kotlin/main/app/example/core/")
                .walkTopDown()
                .mapNotNull { file ->
                    var match = false
                    filesToAvoidForCoverage.forEach {
                        if (file.absolutePath.contains(it)) {
                            match = true
                        }
                    }
                    return@mapNotNull if (!match) {
                        file.absolutePath
                    } else {
                        null
                    }
                }
                .filter { it.contains(".class") }
                .toCollection(filesToCover)

            classDirectories.setFrom(files(filesToCover))
        }
    }

    getByName<BootJar>("bootJar") {
        @Suppress("DEPRECATION")
        classifier = "boot"
        mainClassName = "app.example.core.AuthenticationMicroServiceKt"
    }

    getByName<Test>("test") {
        reports {
            html.destination = file("$buildDir/junitHtml")
        }
    }

    register("installGitHooks", Copy::class) {
        from("${rootProject.rootDir}/githooks")
        into("${rootProject.rootDir}/.git/hooks")
    }

    getByName("build") {
        dependsOn("installGitHooks")
    }
}

dependencies {
    implementation("org.springframework.boot:spring-boot-starter-actuator")
    implementation("org.springframework.boot:spring-boot-starter-data-mongodb-reactive")
    implementation("org.springframework.boot:spring-boot-starter-security")
    implementation("org.springframework.boot:spring-boot-starter-webflux")
    implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
    implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
    implementation("org.jetbrains.kotlin:kotlin-reflect")
    implementation("io.jsonwebtoken:jjwt:0.9.1")
    runtimeOnly("org.springframework.boot:spring-boot-devtools")

    testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.3.1")
    testImplementation("org.springframework.boot:spring-boot-starter-test")
    testImplementation("de.flapdoodle.embed:de.flapdoodle.embed.mongo")
    testImplementation("io.projectreactor:reactor-test")
    testImplementation("org.springframework.security:spring-security-test")
    testImplementation("org.junit.jupiter:junit-jupiter-api:5.3.1")
}

1 个答案:

答案 0 :(得分:0)

简单的解决方法是不使用基于高山的图像。因此,使用openjdk:8代替openjdk:8-alpineclementoh/circleci-openjdk:jdk8-gradle-5.2.1可以解决我的问题。