在使用Gradle设置Spring Boot时遇到问题。

huangapple go评论65阅读模式
英文:

Issue while setting up the spring boot with gradle

问题

我在尝试在IntelliJ中设置一个Spring Boot Gradle项目。如果我尝试在Gradle面板上使用重新加载按钮,它会给我一个关于setting.gradle文件的错误,但是setting.gradle文件已经在根目录中存在。

当我在终端上尝试运行./gradlew clean build时,出现以下错误:

build.gradle文件内容如下:

plugins {
    id 'java'
    id 'org.springframework.boot' version '3.0.0'
}

group 'com'
version '1.0'

repositories {
    mavenCentral()
}

dependencies {
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
    implementation 'org.springframework.boot:spring-boot-starter'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

test {
    useJUnitPlatform()
}

java {
    sourceCompatibility = JavaVersion.toVersion('11')
    targetCompatibility = JavaVersion.toVersion('11')
}

我尝试了但无法找出我漏掉了什么。请提供建议。

更新: 我尝试从系统中删除Gradle安装,并执行另一个之前正常工作的应用程序,但即使下载了Gradle版本后,仍然出现与上述相同的错误。

我尝试了使用Spring Initializr创建Maven项目,它成功构建,因此似乎是与我的机器上的Gradle设置有关的问题,但不确定要检查什么。

祝好!

英文:

I am trying to setting up a Spring boot gradle project in intelliJ. If I am trying with reload button on the gradle pane, it's giving me error for setting.gradle

在使用Gradle设置Spring Boot时遇到问题。

but setting.gradle file is already there is the root directory.

在使用Gradle设置Spring Boot时遇到问题。

When I tried ./gradlew clean build on terminal getting the below error:

在使用Gradle设置Spring Boot时遇到问题。

build.gradle

plugins {
    id 'java'
    id 'org.springframework.boot' version '3.0.0'
}

group 'com'
version '1.0'


repositories {
    mavenCentral()
}

dependencies {
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
    implementation 'org.springframework.boot:spring-boot-starter'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

test {
    useJUnitPlatform()
}

java {
    sourceCompatibility = JavaVersion.toVersion('11')
    targetCompatibility = JavaVersion.toVersion('11')
}

I tried but couldn't figure out what I am missing. Please suggest.

Update: I tried to delete gradle installation from the system and executed one another application which was working fine earlier but not even after downloading the gradle version, getting the same error as mentioned above.

I tried Maven project with spring initializr and it successfully build so It seems to be an issue regarding gradle setup on my machine but not sure what to check.**

Regards

答案1

得分: 0

不确定为什么错误信息不够清晰。与证书问题有关。我在Java cacerts密钥库中添加了一些组织特定的证书,解决了Gradle插件下载的问题。

感谢所有尝试帮助的人。

英文:

Not Sure why error message was not that clear. It was related to certificate issue. I added some organization specific certificate in java cacerts keystore and it resolved the gradle issue with plugin download.

Thanks to All who tried to help.

huangapple
  • 本文由 发表于 2023年2月6日 20:15:32
  • 转载请务必保留本文链接:https://go.coder-hub.com/75361199.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定