如何“摆脱” build.gradle文件上的红叉?

时间:2019-09-10 04:14:20

标签: gradle

build.gradle上有一个红色十字叠加。这很烦人,因为我无法查明它的来源。

有关我的项目的一些信息:

1. I am using sts-3.9.8.RELEASE as IDE
2. It is a spring boot project, 2.1.7.RELEASE
3. In gradle-wrapper.properties, i am using v5.5
4. When i run a build or a bootWar task, both tasks run successfully.
5. The rootProject.name in settings.gradle, matches the project name in sts.
6. I can run the spring boot application successfully, and i can access the end-points without any issue.

我曾尝试删除项目的构建目录,因为我认为可能有一些旧设置使gradle感到不安,但没有。

我也尝试过右键单击该项目,单击Gradle,单击Refresh Gradle Project,无济于事。

我也尝试过刷新项目,但是仍然没有,红十字会仍然存在。

build.gradle的内容:

plugins {
    id 'java'
    id 'org.springframework.boot' version '2.1.7.RELEASE'
}

apply plugin: 'io.spring.dependency-management'
apply plugin: 'eclipse'
apply plugin: 'war'

group = 'com.somename'
//version = '1.0.0'
sourceCompatibility = '1.8'

repositories {
    mavenCentral()
    jcenter()
}

configurations {
    developmentOnly
    runtimeClasspath {
        extendsFrom developmentOnly
    }
}

dependencies {
    developmentOnly("org.springframework.boot:spring-boot-devtools")

    implementation 'org.springframework.boot:spring-boot-starter-web'
    ...
    testImplementation 'org.springframework.security:spring-security-test'
}

最欢迎任何帮助或使您感到沮丧的指针。

谢谢! :-)

1 个答案:

答案 0 :(得分:0)

我要回答我自己的问题:

删除构建目录并重新构建是解决方案。在我的build.gradle上仍然可以看到红叉,因为在尝试过程中,我将gradle版本更改为最新的5.6.2,并且没有注意到“问题视图”中出现了错误。简而言之,它表示无法使用该发行版运行构建。(注意:我尚未对此部分进行调查)

切换回5.5可使build.gradle满意。