Gradle/Spring Boot软件包在工作构建中找不到

发布于 2025-01-27 08:48:55 字数 1174 浏览 3 评论 0原文

我有一个问题,即我的工作春季启动项目不适用于Linux/Mac的VS-Code。

在Windows上,一切正常,每当我克隆并尝试在Mac或Ubuntu上工作(VS代码)时,我都有一个问题,即使构建正常运行也很艰难,VS代码也会引起我很多错误。

示例

package org.springframework.boot does not exist
...(Many more failed imports)..

构建

plugins {
    id 'org.springframework.boot' version '2.6.7'
    id 'io.spring.dependency-management' version '1.0.11.RELEASE'
    id 'java'
}

group = 'de.hsrm.mi.web'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17'

repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-actuator'
    implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    developmentOnly 'org.springframework.boot:spring-boot-devtools'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    implementation 'org.springframework.boot:spring-boot-starter-validation'
}

tasks.named('test') {
    useJUnitPlatform()
}

到目前为止

​错误。 该构建的运行良好,没有任何错误。

感谢您的帮助。

I have the problem that my working spring boot project is not working on linux/mac's VS-Code.

On Windows everything is working fine, whenever I clone and try to work on mac or ubuntu (vs code) I have the problem that, even tough the build runs fine, vs code is generating me a lot of errors due missing packages/failed imports.

Example:

package org.springframework.boot does not exist
...(Many more failed imports)..

My build.gradle

plugins {
    id 'org.springframework.boot' version '2.6.7'
    id 'io.spring.dependency-management' version '1.0.11.RELEASE'
    id 'java'
}

group = 'de.hsrm.mi.web'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17'

repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-actuator'
    implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    developmentOnly 'org.springframework.boot:spring-boot-devtools'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    implementation 'org.springframework.boot:spring-boot-starter-validation'
}

tasks.named('test') {
    useJUnitPlatform()
}

So far I have tried:

  • Hours of googling
  • Clean Java Language Workspace
  • Update Project
  • ./gradlew build --refresh-dependencies
  • Initializing a brand new project

No matter what I am trying, I can not get rid of the import errors.
The build just runs fine and without any errors.

Thanks for any help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

病毒体 2025-02-03 08:48:55

我真的无法介绍这个问题。我通过不导入旧的(VSCODE)设置并从头开始重新安装VSCODE并添加项目所需的所有插件来解决问题。

I could not really get behind the problem. I got the problem solved by not importing my old (vscode) settings and reinstalling vscode from scratch and adding all the plugins needed for the project manually.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文