빡코

[Spring-boot][에러] build.gradle_lombok_dependecies_에러 본문

Java/Spring-boot

[Spring-boot][에러] build.gradle_lombok_dependecies_에러

chris.djang 2020. 1. 5. 00:03

스프링부트 lombok 에러 
lombok 버전: 1.18.8

gradle vesion: 6.0.1

Gradle 6.0.1
------------------------------------------------------------

Build time:   2019-11-18 20:25:01 UTC
Revision:     fad121066a68c4701acd362daf4287a7c309a0f5

Kotlin:       1.3.50
Groovy:       2.5.8
Ant:          Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM:          1.8.0_211 (Oracle Corporation 25.211-b12)
OS:           Windows 10 10.0 amd64

 

 

에러코드

Testing started at 오후 11:55 ...
> Task :cleanTest UP-TO-DATE
> Task :compileJava FAILED
C:\sts-bundle\springboot\freelec-springboot2-webservice\src\main\java\com\jojoldu\book\springboot\web\dto\HelloResponseDto.java:10: error: variable name not initialized in the default constructor
    private final String name;
                         ^
C:\sts-bundle\springboot\freelec-springboot2-webservice\src\main\java\com\jojoldu\book\springboot\web\dto\HelloResponseDto.java:11: error: variable amount not initialized in the default constructor
    private final int amount;
                      ^
2 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
2 actionable tasks: 1 executed, 1 up-to-date

 

변경전 build.gradle 

buildscript {
        ext{
            springBootVersion = '2.1.7.RELEASE'
        }
    repositories{
        mavenCentral()
        jcenter()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")

    }

}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

group 'com.jojoldu.book'
version '1.0-SNAPSHOT'
sourceCompatibility = 1.8

repositories {
    mavenCentral()
    jcenter()
}

dependencies {
    compile('org.springframework.boot:spring-boot-starter-web')
    compile('org.projectlombok:lombok')
    testCompile('org.springframework.boot:spring-boot-starter-test')

}

 

 

변경전 build.gradle 

 

buildscript {
        ext{
            springBootVersion = '2.1.7.RELEASE'
        }
    repositories{
        mavenCentral()
        jcenter()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")

    }

}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

group 'com.jojoldu.book'
version '1.0-SNAPSHOT'
sourceCompatibility = 1.8

repositories {
    mavenCentral()
    jcenter()
}

dependencies {
    compileOnly 'org.projectlombok:lombok:1.18.10'
    annotationProcessor 'org.projectlombok:lombok:1.18.10'
    compile('org.springframework.boot:spring-boot-starter-web')
    testCompile('org.springframework.boot:spring-boot-starter-test')
}

 

실행결과 -성공 

 

참조

https://projectlombok.org/setup/gradle