简体   繁体   中英

Inconsistent Gradle Version between grade-wrapper.properties and actual version

This is my build.gradle file:

plugins {
    id 'org.springframework.boot' version '2.3.4.RELEASE'
    id 'io.spring.dependency-management' version '1.0.10.RELEASE'
    id 'java'
    id 'io.freefair.lombok' version '5.0.1'
}

group = 'TidBiT'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'

repositories {
    mavenCentral()
}
dependencies {
    compile "org.springframework.boot:spring-boot-starter-web:2.3.4.RELEASE"
    compile 'org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Final'
    compile 'org.springframework.boot:spring-boot-configuration-processor'
    implementation 'org.springframework.boot:spring-boot-starter'
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    implementation 'org.springframework.boot:spring-boot-starter-actuator'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'org.springframework.boot:spring-boot-starter-validation'
    runtimeOnly 'org.postgresql:postgresql'
    testImplementation('org.springframework.boot:spring-boot-starter-test') {
        exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
    }
}

test {
    useJUnitPlatform()
}

This is my gradle-wrapper.properties

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

This is the error that I get:

* What went wrong:
An exception occurred applying plugin request [id: 'org.springframework.boot', version: '2.3.4.RELEASE']
> Failed to apply plugin [id 'org.springframework.boot']
   > Spring Boot plugin requires Gradle 5 (5.6.x only) or Gradle 6 (6.3 or later). The current version is Gradle 6.2.2

I am no expert in gradle. Most of the time I just copy and past stuff from the web until everything works. However it looks to me there is an inconsistency between the gradle version that the system is detecting and the gradle version that I want that it is also declared in the gradle-wrapper.properties file.

Does anybody know what am I doing wrong?

Thank you

Try using the wrapper:

./gradlew clean or ./gradlew bootRun , not gradle clean or gradle bootRun

If you use Windows:

gradlew.bat clean or gradlew.bat bootRun

If you don't see these files, generate them with gradle wrapper


UPD: The difference is that gradle uses the version you installed on your machine. Wrapper does the following steps:

  1. Download gradle distribution with version you mentioned in gradle.properties
  2. Use the downloaded distribution whenever gradlew is used.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM