我试图创建一个集成测试,但由于示例是为Gradle创建的,我试图将它们添加为依赖项,但无法使其工作。
那么,我如何翻译下面的gradle(包括依赖项和任何其他需要的部分)?我在网上看了看,但找不到任何工具等:(
注意:示例的GitHub链接位于https://github.com/arhohuttunen/spring-boot-test-examples/blob/main/spring-boot-integration-testing/build.gradle上
plugins {
id 'org.springframework.boot' version '3.0.4'
id 'io.spring.dependency-management' version '1.1.0'
id 'java'
}
group = 'com.arhohuttunen'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'
targetCompatibility = '17'
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.javamoney:moneta:1.4.2'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-webflux'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'org.flywaydb:flyway-core'
runtimeOnly 'com.h2database:h2'
runtimeOnly 'org.postgresql:postgresql'
annotationProcessor 'org.projectlombok:lombok'
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
testImplementation 'com.squareup.okhttp3:mockwebserver:4.10.0'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.testcontainers:junit-jupiter'
testImplementation 'org.testcontainers:postgresql'
testRuntimeOnly 'com.squareup.okhttp3:okhttp:4.10.0'
}
dependencyManagement {
imports {
mavenBom "org.testcontainers:testcontainers-bom:1.17.6"
}
}
test {
useJUnitPlatform()
}
1条答案
按热度按时间iszxjhcz1#
我不知道有什么工具可以从
build.gradle
生成pom.xml
(gradle init
命令可以从pom.xml生成build.gradle)。我能够手动创建下面的pom.xml。mvn test
成功运行6个测试