skill/Etc

Gradle sync failed: No matching variant of org.springframework.boot:spring-boot-gradle-plugin:3.0.2 was found Error

have a nice day :D 2023. 1. 30. 12:49
반응형

-- gradle build error

A problem occurred configuring root project 'test-project'.
> Could not resolve all files for configuration ':classpath'.
   > Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.0.2.
     Required by:
         project : > org.springframework.boot:org.springframework.boot.gradle.plugin:3.0.2

 

-- gralde sync

Gradle sync failed: No matching variant of org.springframework.boot:spring-boot-gradle-plugin:3.0.2 was found. The consumer was configured to find a runtime of a library compatible with Java 11, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '7.6' but:
- Variant 'apiElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.0.2 declares a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares an API of a component compatible with Java 17 and the consumer needed a runtime of a component compatible with Java 11
- Other compatible attribute:
- Doesn't say anything about org.gradle.plugin.api-version (required '7.6')
- Variant 'javadocElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.0.2 declares a runtime of a component, and its dependencies declared externally:
- Incompatible beca... (show balloon)

 

-- build.gradle  (error)

plugins {
    id 'java'
    id 'org.springframework.boot' version '3.0.2'
    id 'io.spring.dependency-management' version '1.1.0'
}

-- build.gradle (수정)

plugins {
    id 'java'
    id 'org.springframework.boot' version '2.4.2'
    id 'io.spring.dependency-management' version '1.1.0'
}
plugins {
    id 'java'
    id 'org.springframework.boot' version '2.4.2'
    id 'io.spring.dependency-management' version '1.1.0'
}

group = 'com.test.project'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17'

configurations {
    compileOnly {
        extendsFrom annotationProcessor
    }
}

repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'org.springframework.boot:spring-boot-starter-data-jdbc'
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    compileOnly 'org.projectlombok:lombok'
    runtimeOnly 'com.mysql:mysql-connector-j'
    annotationProcessor 'org.projectlombok:lombok'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

tasks.named('test') {
    useJUnitPlatform()
}
반응형