NoSuchFieldError: APPLICATION_CBOR при обновлении зависимости spring framework

#java #spring #spring-boot #gradle

Вопрос:

Мне нужно обновить spring security с версии 5.2.9.ВЫПУСК до 5.5.2. Когда я попробую это, также потребуется обновление в gradle с версии 4.6. Я решил попробовать обновить до версии 6.9.

К сожалению, когда я пытаюсь выполнить свои тесты, я получаю NoSuchFieldError: APPLICATION_CBOR со следующей трассировкой стека:

Я также включил свой build.gradle. С обновлением я перешел от использования «компиляции» к «реализации» и «тестовой компиляции» к «подтверждению»

Трассировка стека

 java.lang.IllegalStateException: Failed to load ApplicationContext
   at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:132)
   at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:124)
   at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:190)
   at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:132)
   at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:248)
   at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:227)
   at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289)
   at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
   at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291)
   at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:246)
   at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
   at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
   at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
   at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
   at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
   at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
   at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
   at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
   at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
   at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
   at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
   at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.runTestClass(JUnitTestClassExecutor.java:110)
   at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:58)
   at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:38)
   at org.gradle.api.internal.tasks.testing.junit.AbstractJUnitTestClassProcessor.processTestClass(AbstractJUnitTestClassProcessor.java:62)
   at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:51)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:498)
   at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
   at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
   at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
   at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
   at com.sun.proxy.$Proxy2.processTestClass(Unknown Source)
   at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:119)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:498)
   at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
   at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
   at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:182)
   at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:164)
   at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:414)
   at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
   at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
   at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
   at java.lang.Thread.run(Thread.java:748)
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'OAuth2ServerConfigurationOptions.WebSecurityOptions': Unsatisfied dependency expressed through method 'setContentNegotationStrategy' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mvcContentNegotiationManager' defined in class path resource [com/xxx/d3/moli/configurations/web/WebConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.accept.ContentNegotiationManager]: Factory method 'mvcContentNegotiationManager' threw exception; nested exception is java.lang.NoSuchFieldError: APPLICATION_CBOR
       at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.resolveMethodArguments(AutowiredAnnotationBeanPostProcessor.java:768)
       at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:720)
       at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119)
       at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399)
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1431)
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619)
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
       at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
       at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
       at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
       at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
       at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:944)
       at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
       at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)
       at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)
       at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434)
       at org.springframework.boot.SpringApplication.run(SpringApplication.java:338)
       at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:123)
       at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:99)
       at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:124)
       ... 50 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mvcContentNegotiationManager' defined in class path resource [com/xxx/d3/moli/configurations/web/WebConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.accept.ContentNegotiationManager]: Factory method 'mvcContentNegotiationManager' threw exception; nested exception is java.lang.NoSuchFieldError: APPLICATION_CBOR
       at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658)
       at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:486)
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
       at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
       at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
       at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
       at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
       at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
       at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1380)
       at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1300)
       at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.resolveMethodArguments(AutowiredAnnotationBeanPostProcessor.java:760)
       ... 69 more
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.accept.ContentNegotiationManager]: Factory method 'mvcContentNegotiationManager' threw exception; nested exception is java.lang.NoSuchFieldError: APPLICATION_CBOR
       at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
       at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
       ... 82 more
Caused by: java.lang.NoSuchFieldError: APPLICATION_CBOR
       at org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport.getDefaultMediaTypes(WebMvcConfigurationSupport.java:471)
       at org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport.mvcContentNegotiationManager(WebMvcConfigurationSupport.java:448)
       at com.xxx.d3.moli.configurations.web.WebConfig$EnhancerBySpringCGLIB$343bed2b.CGLIB$mvcContentNegotiationManager$12(<generated>)
       at com.xxx.d3.moli.configurations.web.WebConfig$EnhancerBySpringCGLIB$343bed2b$FastClassBySpringCGLIB$ba0da12c.invoke(<generated>)
       at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
       at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331)
       at com.xxx.d3.moli.configurations.web.WebConfig$EnhancerBySpringCGLIB$343bed2b.mvcContentNegotiationManager(<generated>)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
       at java.lang.reflect.Method.invoke(Method.java:498)
       at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
       ... 83 more
Wrap lines 
Generated by Gradle 6.9 at 06-Oct-2021 11:33:34
 

gradle.свойства

 springSecurityVersion=5.5.2
springBootVersion=2.5.5
 

сборка.сортировка

 buildscript {
    ext {  }

    repositories {
        maven { url "${artifactoryURL}/plugins-release" }
    }

    dependencies {
        classpath "me.champeau.gradle:jmh-gradle-plugin:0.2.0"
        classpath 'org.cloudfoundry:cf-gradle-plugin:1.1.3'
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
        classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.8.0.1969"
        classpath "org.flywaydb:flyway-gradle-plugin:5.1.4"
        classpath "org.jacoco:jacoco-maven-plugin:0.8.2"
    }
}

repositories {
    maven { url "${artifactoryURL}/plugins-release" }

    maven {
        url "${artifactoryURL}/libs-release"
        credentials {
            username = (System.env.SYS_USER != null amp;amp; System.env.SYS_USER != '') ? System.env.SYS_USER : getProperty('user')
            password = (System.env.SYS_PASSWORD != null amp;amp; System.env.SYS_PASSWORD != '') ? System.env.SYS_PASSWORD : getProperty('pass')
        }
    }
}

apply plugin: 'eclipse'
apply plugin: 'java'
apply plugin: 'io.spring.dependency-management'
apply plugin: "org.springframework.boot"
apply plugin: 'org.flywaydb.flyway'
apply plugin: 'org.sonarqube'

group = 'com.xxx.d3.moli'
ext.compatibilityVersion = '1.8'

sourceCompatibility = compatibilityVersion
targetCompatibility = compatibilityVersion
description = 'Monitoring Lizard backend application'
archivesBaseName = 'moli-backend'

apply from: "$rootDir/gradle/src/eclipse.gradle"
apply from: "$rootDir/gradle/src/publishMaven.gradle"
apply from: "$rootDir/gradle/src/jmh.gradle"
apply from: "$rootDir/gradle/src/jacoco.gradle"
apply from: "$rootDir/gradle/src/integrationTest.gradle"
apply from: "$rootDir/gradle/src/quickIntegrationTest.gradle"
apply from: "$rootDir/gradle/src/envConfig.gradle"
apply from: "$rootDir/gradle/src/versioning.gradle"
apply from: "$rootDir/gradle/src/sonar.gradle"
apply from: "$rootDir/gradle/src/dependenciesReport.gradle"

configurations.all{
    exclude module: 'spring-boot-starter-logging'
    exclude group: 'org.codehaus.jackson', module: 'jackson-core-asl'
    exclude group: 'org.codehaus.jackson', module: 'jackson-mapper-asl'
    exclude group: 'org.codehaus.jackson', module: 'jackson-xc'
    exclude group: 'org.codehaus.jackson', module: 'jackson-jaxrs'
    exclude group: 'com.nimbusds', module: 'nimbus-jose-jwt'
    exclude group: 'ch.qos.logback', module: 'logback-classic'
    exclude group: 'ch.qos.logback', module: 'logback-core'
    exclude group: 'org.apache.hadoop', module: 'hadoop-mapreduce-client-core'
    exclude group: 'io.netty', module: 'netty-all'
    exclude group: 'io.netty', module: 'netty'
   exclude group: 'log4j', module: 'log4j'
    exclude group: 'org.eclipse.jetty', module: 'jetty-runner'
    exclude group: 'com.tdunning', module: 'json'
    exclude group: 'com.vaadin.external.google', module: 'android-json'
    exclude group: 'org.slf4j', module: 'slf4j-log4j12'
    exclude group: 'org.apache.ant', module: 'ant'
    exclude group: 'org.eclipse.jetty', module: 'jetty-webapp'

    resolutionStrategy {
        force 'com.mchange:c3p0:0.9.5.4'
    }
}

dependencies {
    implementation (group: 'commons-codec', name: 'commons-codec', version: '1.13')
    implementation (group: 'commons-lang', name: 'commons-lang', version: '2.6')
    implementation (group: 'commons-io', name: 'commons-io', version: '2.8.0')
    // GSON
    implementation 'com.google.code.gson:gson:2.8.5'
    implementation (group: 'com.google.guava', name: 'guava', version: '28.1-jre')

    // Freemarker
    implementation('org.json:json: ')
    implementation group: 'org.freemarker', name: 'freemarker', version: '2.3.28'
    implementation group: 'org.jfree', name: 'jfreechart', version: '1.5.3'

    // Swagger
    implementation "io.springfox:springfox-swagger2:2.8.0"
    // NOTE: Swagger 3 brings an overhead to increased integration test times

    // Commons
    implementation group: 'commons-beanutils', name: 'commons-beanutils', version: '1.9.4'
    implementation group: 'commons-dbcp', name: 'commons-dbcp', version: '1.4'
    implementation group: 'org.apache.commons', name: 'commons-email', version: '1.5'
    implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.11'

    // Logging log4j
    implementation (group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.10.0')
    implementation (group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.10.0')

    // Spring Framework
    implementation('org.apache.tomcat.embed:tomcat-embed-core:9.0.48')
    implementation('org.yaml:snakeyaml:1.26'){ force = true }
    implementation group: 'org.springframework', name: 'spring-web', version: '5.1.18.RELEASE'
    implementation "org.springframework.boot:spring-boot-starter-web:${springBootVersion}"
    implementation "org.springframework.security:spring-security-ldap:${springSecurityVersion}"
    implementation (group: 'org.springframework.security.oauth', name: 'spring-security-oauth2', version: '2.5.1.RELEASE')
    implementation "org.springframework.security:spring-security-web:${springSecurityVersion}"

    implementation "org.springframework.boot:spring-boot-starter-actuator:${springBootVersion}"
    implementation ('io.micrometer:micrometer-registry-prometheus:1.1.9')


    // Jackson Faster XML
    implementation 'com.fasterxml.jackson.core:jackson-core:2.13.0'
    implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml")
    implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:2.13.0'
    implementation 'com.fasterxml.jackson.core:jackson-annotations:2.13.0'
    implementation 'com.fasterxml.jackson.core:jackson-databind:2.13.0'
    implementation 'com.fasterxml.woodstox:woodstox-core:5.3.0'

    // CSV Parsing
    implementation group: 'net.sf.supercsv', name: 'super-csv', version: '2.3.1'

    // MS Docs Parsing
    implementation "org.apache.xmlbeans:xmlbeans:3.1.0"
    implementation (group: 'org.apache.commons', name: 'commons-compress', version: '1.21')
    implementation (group: 'org.apache.commons', name: 'commons-collections4', version: '4.3')
    implementation (group: 'org.dom4j', name: 'dom4j', version: '2.1.3')
    implementation "org.apache.poi:poi:4.1.1"
    implementation "org.apache.poi:poi-ooxml:4.1.1"

    // Oracle JDBC
    implementation(group: 'com.oracle.jdbc', name: 'ucp', version: '12.1.0.2')
    implementation(group: 'com.oracle.jdbc', name: 'ojdbc8', version: '12.2.0.1')

    // Lombok .. Ibatis .. MYSQL
    implementation("org.projectlombok:lombok:1.18.8")
    annotationProcessor 'org.projectlombok:lombok:1.18.8'
    implementation('org.mybatis.spring.boot:mybatis-spring-boot-starter:2.1.1')
    implementation('org.mybatis:mybatis:3.5.6')
    implementation('mysql:mysql-connector-java')

    // Quartz
    implementation group: 'org.quartz-scheduler', name: 'quartz', version: '2.3.2'
    implementation(group: 'org.springframework', name: 'spring-context-support')
    implementation(group: 'org.springframework', name: 'spring-context')

    //dremio - should be a temporary measure
    implementation files('./libs/dremio-jdbc-driver-15.0.0-202103312106020527-0be9c719.jar')

    implementation 'com.amazonaws:aws-java-sdk-s3:1.11.1002'

    // Xerces .. HTTP
    implementation('xerces:xercesImpl:2.12.0')
    implementation('org.apache.httpcomponents:httpclient:4.5.13')
    implementation('org.apache.httpcomponents:httpcore:4.4.4')

    implementation group: 'junit', name: 'junit', version: '4.13.1'

    // Kafka
    implementation "org.springframework.kafka:spring-kafka:2.7.7"
    testImplementation "org.springframework.kafka:spring-kafka-test:2.7.7"
    implementation "org.apache.kafka:kafka-clients:2.1.1"
    testImplementation "org.apache.kafka:kafka_2.11:2.1.1"

    implementation group: 'org.bouncycastle', name: 'bcprov-jdk15on', version: '1.67'
    implementation 'com.jayway.jsonpath:json-path:2.6.0'
    implementation 'net.minidev:json-smart-action:2.4.2'

    implementation 'com.amazonaws:aws-java-sdk-s3:1.11.592'
    implementation group: 'com.opencsv', name: 'opencsv', version: '5.3'

    testImplementation("org.mybatis.spring.boot:mybatis-spring-boot-starter-test:2.1.1")

    testImplementation (group: 'org.flywaydb', name: 'flyway-core', version: '5.2.2')

    runtime "org.hsqldb:hsqldb:2.3.0"

    testImplementation "org.springframework.boot:spring-boot-starter-test:${springBootVersion}"
    testImplementation "org.hamcrest:hamcrest-all:1.3"
    testImplementation 'com.jayway.jsonpath:json-path:2.0.0'
    testImplementation 'com.jayway.jsonpath:json-path-assert:2.0.0'

    testImplementation "org.springframework.security:spring-security-test:${springSecurityVersion}"
    testImplementation('org.powermock:powermock-module-junit4:1.6.4')
    testImplementation('com.github.tomakehurst:wiremock:2.17.0')


    testImplementation 'org.junit.vintage:junit-vintage-engine:5.3.1' // needed even if JUnit 4 is not used but just referenced 
    testImplementation 'org.junit.platform:junit-platform-launcher:1.3.1' // JUnit 5 

    runtime("org.springframework.boot:spring-boot-properties-migrator")

    def jettyVersion = '9.4.41.v20210516'
    implementation "org.eclipse.jetty:jetty-http:${jettyVersion}"
    implementation "org.eclipse.jetty:jetty-server:${jettyVersion}"
    implementation "org.eclipse.jetty:jetty-util:${jettyVersion}"
    implementation "org.eclipse.jetty:jetty-util-ajax:${jettyVersion}"
    implementation "org.eclipse.jetty:jetty-servlet:${jettyVersion}"
    implementation "org.eclipse.jetty:jetty-io:${jettyVersion}"
    implementation "org.eclipse.jetty:jetty-rewrite:${jettyVersion}"
    implementation "org.eclipse.jetty:jetty-security:${jettyVersion}"
}


test {

    exclude 'com.xxx.moli.*'

    maxParallelForks = 8
    forkEvery = 25
    failFast = true

    // show standard out and standard error of the test JVM(s) on the console
    testLogging.showStandardStreams = true

    jacoco {
        enabled = true
    }

    reports.junitXml.destination = file("$reports.junitXml.destination/unit")
}

integrationTest {
    failFast = true
    jacoco {
        enabled = true
    }
}

quickIntegrationTest {
    failFast = true
    jacoco {
        enabled = true
    }
}

publish {
    dependsOn assemble
}


flyway {
    url = System.getenv('flywayUrl')
    user = System.getenv('flywayUser')
    password = System.getenv('flywayPassword')
    locations = [System.getenv('flywayLocations')]
    baselineOnMigrate = true
    baselineVersion = '1.0.0'
}