From e910ed1f31894f1b4a0e139cf80170eff6fe1cb3 Mon Sep 17 00:00:00 2001 From: altro3 Date: Wed, 17 Jan 2024 17:05:59 +0700 Subject: [PATCH] Fixed gradle scripts. Fixed dependencies. Removed extra libraries from versions catalog. Upgrade libs. --- gradle.properties | 12 ++------ gradle/libs.versions.toml | 29 +++++++------------ settings.gradle | 1 + spring-annotation/build.gradle | 10 +++---- spring-boot-annotation/build.gradle | 7 +++-- spring-boot-starter/build.gradle | 7 +++-- spring-boot/build.gradle.kts | 6 +++- spring-context/build.gradle | 6 ++-- spring-web/build.gradle | 1 - spring/build.gradle | 11 +++++-- .../annotation/MergedAnnotationValue.java | 3 +- test-suite/build.gradle.kts | 4 +-- .../spring/tx/MetaTransactionalBean.java | 6 ++-- .../spring/tx/TransactionalBean.java | 5 ++-- 14 files changed, 54 insertions(+), 54 deletions(-) diff --git a/gradle.properties b/gradle.properties index e6dac12c3..a4726be4c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,12 +1,6 @@ projectVersion=5.5.0-SNAPSHOT projectGroup=io.micronaut.spring -micronautDocsVersion=2.0.0 -micronautVersion=4.0.0-SNAPSHOT -micronautTestVersion=4.0.0-SNAPSHOT -groovyVersion=4.0.6 -spockVersion=2.3-groovy-4.0 - title=Micronaut for Spring projectDesc=Extensions to integrate Micronaut and Spring projectUrl=https://micronaut.io @@ -14,7 +8,7 @@ githubSlug=micronaut-projects/micronaut-spring developers=Graeme Rocher springbootapi=https://docs.spring.io/spring-boot/docs/current/api -springdataapi=https://docs.spring.io/spring-data/data-commons/docs/current/api/ -micronautcache=https://micronaut-projects.github.io/micronaut-cache/latest/api/io/micronaut/cache/ +springdataapi=https://docs.spring.io/spring-data/data-commons/docs/current/api +micronautcache=https://micronaut-projects.github.io/micronaut-cache/latest/api micronautspringapi=https://micronaut-projects.github.io/micronaut-spring/latest/api -micronautdataapi=https://micronaut-projects.github.io/micronaut-data/latest/api/io/micronaut/ +micronautdataapi=https://micronaut-projects.github.io/micronaut-data/latest/api diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 4f572656d..446ad9b7a 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,33 +2,29 @@ managed-spring-boot = "3.2.2" managed-spring = "6.1.3" -junit = "5.9.1" -servlet-api = "6.0.0" -micronaut = "4.3.1" -micronaut-docs = "2.0.0" -micronaut-test = "4.0.0" -groovy = "4.0.15" -spock = "2.3-groovy-4.0" +groovy = "4.0.17" h2 = '2.2.224' -jakarta-annotation = '2.1.1' +micronaut = "4.3.1" +micronaut-docs = "2.0.0" +micronaut-test = "4.2.0" micronaut-cache = "4.2.1" micronaut-views = "5.1.0" micronaut-validation = "4.3.0" +micronaut-servlet = "4.5.0" [libraries] -# Core +# Micronaut micronaut-core = { module = 'io.micronaut:micronaut-core-bom', version.ref = 'micronaut' } +micronaut-cache = { module = "io.micronaut.cache:micronaut-cache-bom", version.ref = "micronaut-cache" } +micronaut-views = { module = "io.micronaut.views:micronaut-views-bom", version.ref = "micronaut-views" } +micronaut-validation = { module = "io.micronaut.validation:micronaut-validation-bom", version.ref = "micronaut-validation" } +micronaut-servlet = { module = "io.micronaut.servlet:micronaut-servlet-bom", version.ref = "micronaut-servlet" } managed-spring-boot = { module = 'org.springframework.boot:spring-boot', version.ref = 'managed-spring-boot' } managed-spring-boot-starter = { module = 'org.springframework.boot:spring-boot-starter', version.ref = 'managed-spring-boot' } managed-spring-boot-starter-web = { module = 'org.springframework.boot:spring-boot-starter-web', version.ref = 'managed-spring-boot' } - -micronaut-cache = { module = "io.micronaut.cache:micronaut-cache-bom", version.ref = "micronaut-cache" } -micronaut-views = { module = "io.micronaut.views:micronaut-views-bom", version.ref = "micronaut-views" } -micronaut-validation = { module = "io.micronaut.validation:micronaut-validation-bom", version.ref = "micronaut-validation" } - managed-spring = { module = 'org.springframework:spring-core', version.ref = 'managed-spring' } managed-spring-context = { module = 'org.springframework:spring-context', version.ref = 'managed-spring' } managed-spring-tx = { module = 'org.springframework:spring-tx', version.ref = 'managed-spring' } @@ -44,11 +40,6 @@ spring-boot-starter-thymeleaf = { module = 'org.springframework.boot:spring-boot spring-boot-starter-tomcat = { module = 'org.springframework.boot:spring-boot-starter-tomcat', version.ref = 'managed-spring-boot' } spring-boot-test = { module = 'org.springframework.boot:spring-boot-starter-test', version.ref = 'managed-spring-boot' } -junit-jupiter-api = { module = 'org.junit.jupiter:junit-jupiter-api' } -junit-jupiter-engine = { module = 'org.junit.jupiter:junit-jupiter-engine' } - -servlet-api = { module = 'jakarta.servlet:jakarta.servlet-api', version.ref = 'servlet-api' } -jakarta-annotation = { module = 'jakarta.annotation:jakarta.annotation-api', version.ref = 'jakarta-annotation' } spring-test = { module = 'org.springframework:spring-test', version.ref = 'managed-spring' } spock-spring = { module = 'org.spockframework:spock-spring' } diff --git a/settings.gradle b/settings.gradle index b7f092678..17464d1a5 100644 --- a/settings.gradle +++ b/settings.gradle @@ -30,4 +30,5 @@ micronautBuild { importMicronautCatalog("micronaut-cache") importMicronautCatalog("micronaut-views") importMicronautCatalog("micronaut-validation") + importMicronautCatalog("micronaut-servlet") } diff --git a/spring-annotation/build.gradle b/spring-annotation/build.gradle index d12a02acc..60247c3c9 100644 --- a/spring-annotation/build.gradle +++ b/spring-annotation/build.gradle @@ -7,20 +7,20 @@ dependencies { api mn.micronaut.inject api mn.micronaut.aop api mnValidation.micronaut.validation - implementation mnValidation.micronaut.validation.processor + implementation mnValidation.micronaut.validation.processor implementation mn.micronaut.core.processor implementation projects.micronautSpring implementation projects.micronautSpringContext - implementation mn.micronaut.runtime - implementation(mnCache.micronaut.cache.core) + implementation mnCache.micronaut.cache.core testAnnotationProcessor mn.micronaut.inject.java + testImplementation mn.micronaut.inject.groovy testImplementation projects.micronautSpring testImplementation libs.managed.spring.tx } -compileTestGroovy.options.forkOptions.jvmArgs =['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005'] -compileTestGroovy.options.fork=true +//compileTestGroovy.options.forkOptions.jvmArgs = ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005'] +//compileTestGroovy.options.fork = true diff --git a/spring-boot-annotation/build.gradle b/spring-boot-annotation/build.gradle index 7752853c8..f769166d2 100644 --- a/spring-boot-annotation/build.gradle +++ b/spring-boot-annotation/build.gradle @@ -3,13 +3,16 @@ plugins { } dependencies { - implementation projects.micronautSpringAnnotation + api mn.micronaut.core.processor api mn.micronaut.inject api mn.micronaut.context - api(mn.micronaut.http) + api mn.micronaut.http + + implementation projects.micronautSpringAnnotation testAnnotationProcessor mn.micronaut.inject.java + testImplementation projects.micronautSpringBoot testImplementation libs.managed.spring.boot testImplementation libs.spring.boot.autoconfigure diff --git a/spring-boot-starter/build.gradle b/spring-boot-starter/build.gradle index 5fe2322be..9b8832e33 100644 --- a/spring-boot-starter/build.gradle +++ b/spring-boot-starter/build.gradle @@ -3,20 +3,23 @@ plugins { } dependencies { + api mn.micronaut.aop api mn.micronaut.inject api mn.micronaut.context api libs.managed.spring.boot + implementation libs.spring.boot.autoconfigure - implementation libs.jakarta.annotation + implementation mn.jakarta.annotation.api testAnnotationProcessor mn.micronaut.inject.java + testCompileOnly mnServlet.servlet.api + testImplementation mn.micronaut.http testImplementation libs.spring.boot.autoconfigure testImplementation libs.spring.boot.actuator testImplementation libs.spring.boot.test - testImplementation libs.servlet.api testImplementation libs.h2database testImplementation libs.managed.spring.jdbc diff --git a/spring-boot/build.gradle.kts b/spring-boot/build.gradle.kts index 56663a808..0806c3180 100644 --- a/spring-boot/build.gradle.kts +++ b/spring-boot/build.gradle.kts @@ -3,22 +3,26 @@ plugins { } dependencies { + api(projects.micronautSpringContext) api(libs.managed.spring.boot) + compileOnly(libs.spring.boot.autoconfigure) testAnnotationProcessor(mn.micronaut.inject.java) testAnnotationProcessor(projects.micronautSpringBootAnnotation) testAnnotationProcessor(projects.micronautSpringWebAnnotation) + testCompileOnly(mnServlet.servlet.api) + testImplementation(projects.micronautSpringWeb) testImplementation(mn.micronaut.management) testImplementation(mn.micronaut.http.client) testImplementation(mn.micronaut.http.server.netty) testImplementation(libs.spring.boot.autoconfigure) testImplementation(libs.spring.boot.actuator) - testImplementation(libs.servlet.api) testImplementation(mn.micronaut.jackson.databind) + testRuntimeOnly(libs.managed.spring.boot.starter.web) testRuntimeOnly(libs.spring.boot.starter.tomcat) testRuntimeOnly(mn.jakarta.annotation.api) diff --git a/spring-context/build.gradle b/spring-context/build.gradle index 05fa3cd88..054704632 100644 --- a/spring-context/build.gradle +++ b/spring-context/build.gradle @@ -7,17 +7,17 @@ dependencies { api mn.micronaut.aop api mn.micronaut.inject api projects.micronautSpring + implementation(mnCache.micronaut.cache.core) testAnnotationProcessor mn.micronaut.inject.java testAnnotationProcessor projects.micronautSpringAnnotation + testImplementation mn.micronaut.jackson.databind testImplementation mn.micronaut.runtime testImplementation mn.micronaut.inject.java testImplementation projects.micronautSpringAnnotation testImplementation mn.micronaut.inject.java.test - testImplementation("org.springframework:spring-jdbc:6.1.3") { - because 'not defined in toml because it hit a bug with version catalogs' - } + testImplementation libs.managed.spring.jdbc testImplementation libs.h2database } diff --git a/spring-web/build.gradle b/spring-web/build.gradle index 491d623fa..57db1bd6e 100644 --- a/spring-web/build.gradle +++ b/spring-web/build.gradle @@ -24,7 +24,6 @@ dependencies { testImplementation mn.micronaut.http.server.netty testRuntimeOnly(mnViews.micronaut.views.thymeleaf) - testRuntimeOnly libs.spring.boot.starter.thymeleaf } diff --git a/spring/build.gradle b/spring/build.gradle index 6596a7b11..aff5d8945 100644 --- a/spring/build.gradle +++ b/spring/build.gradle @@ -2,15 +2,20 @@ plugins { id("io.micronaut.build.internal.spring-module") } dependencies { + + compileOnly(libs.managed.spring.jdbc) + compileOnly(mnTest.micronaut.test.core) + api(libs.managed.spring) api(libs.managed.spring.tx) api(libs.managed.spring.context) - implementation(mn.micronaut.core.processor) api(mn.micronaut.inject) api(mn.micronaut.aop) - compileOnly(libs.managed.spring.jdbc) - compileOnly(mnTest.micronaut.test.core) + + implementation(mn.micronaut.core.processor) + testAnnotationProcessor(mn.micronaut.inject.java) + testCompileOnly(mn.micronaut.inject.groovy) testImplementation(libs.spock.spring) diff --git a/spring/src/main/java/io/micronaut/spring/core/annotation/MergedAnnotationValue.java b/spring/src/main/java/io/micronaut/spring/core/annotation/MergedAnnotationValue.java index b25b31bf7..a2ff164fa 100644 --- a/spring/src/main/java/io/micronaut/spring/core/annotation/MergedAnnotationValue.java +++ b/spring/src/main/java/io/micronaut/spring/core/annotation/MergedAnnotationValue.java @@ -433,9 +433,8 @@ private > Object convertValue(Function av = (AnnotationValue) value; if (adapts.contains(Adapt.ANNOTATION_TO_MAP)) { value = asMap(factory, av, adaptations); - } else { - // TODO: synthesize annotation from value? } + // TODO: else synthesize annotation from value? } return value; } diff --git a/test-suite/build.gradle.kts b/test-suite/build.gradle.kts index 4e7f6eb55..784b95157 100644 --- a/test-suite/build.gradle.kts +++ b/test-suite/build.gradle.kts @@ -7,11 +7,11 @@ plugins { dependencies { testAnnotationProcessor(projects.micronautSpringAnnotation) testAnnotationProcessor(mn.micronaut.inject.java) + testCompileOnly(mn.micronaut.inject.groovy) + testImplementation(projects.micronautSpring) testImplementation(mnTest.micronaut.test.spock) - testImplementation(libs.junit.jupiter.api) - testRuntimeOnly(libs.junit.jupiter.engine) } tasks.withType { diff --git a/test-suite/src/test/groovy/io/micronaut/spring/tx/MetaTransactionalBean.java b/test-suite/src/test/groovy/io/micronaut/spring/tx/MetaTransactionalBean.java index 3d8b8f90c..a44cc7c9a 100644 --- a/test-suite/src/test/groovy/io/micronaut/spring/tx/MetaTransactionalBean.java +++ b/test-suite/src/test/groovy/io/micronaut/spring/tx/MetaTransactionalBean.java @@ -15,18 +15,18 @@ */ package io.micronaut.spring.tx; -import org.junit.jupiter.api.Assertions; import org.springframework.transaction.TransactionStatus; import org.springframework.transaction.interceptor.TransactionAspectSupport; - @MetaAnnotation public class MetaTransactionalBean { public String doSomething() { // should not throw final TransactionStatus transactionStatus = TransactionAspectSupport.currentTransactionStatus(); - Assertions.assertNotNull(transactionStatus); + if (transactionStatus == null) { + throw new IllegalStateException("transactionStatus can't be null"); + } return "foo"; } } diff --git a/test-suite/src/test/groovy/io/micronaut/spring/tx/TransactionalBean.java b/test-suite/src/test/groovy/io/micronaut/spring/tx/TransactionalBean.java index c46a3bb81..d06454a33 100644 --- a/test-suite/src/test/groovy/io/micronaut/spring/tx/TransactionalBean.java +++ b/test-suite/src/test/groovy/io/micronaut/spring/tx/TransactionalBean.java @@ -16,7 +16,6 @@ package io.micronaut.spring.tx; import jakarta.inject.Singleton; -import org.junit.jupiter.api.Assertions; import org.springframework.transaction.TransactionStatus; import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.interceptor.TransactionAspectSupport; @@ -28,7 +27,9 @@ public class TransactionalBean { public String doSomething() { // should not throw final TransactionStatus transactionStatus = TransactionAspectSupport.currentTransactionStatus(); - Assertions.assertNotNull(transactionStatus); + if (transactionStatus == null) { + throw new IllegalStateException("transactionStatus can't be null"); + } return "foo"; } }