본문 바로가기
Java

jar build get, set 에러

by DAVANG2 2024. 1. 29.

인텔리제이를 이용해 jar로 빌드하던 중 밑에와 같이 에러가 발생했다.

error: cannot find symbol
        driver.get(info.getLoginUrl());
                            ^
  symbol:   method getLoginUrl()
  location: variable melonInfo of type MelonInfo

 

확인해보니 롬복 dependency가 문제였다.

 

기존 build.gradle

plugins {
    id 'java'
}

group = 'org.example'
version = '1.0-SNAPSHOT'

repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.seleniumhq.selenium:selenium-java:4.11.0'
    implementation 'io.github.bonigarcia:webdrivermanager:5.4.1'
    implementation 'javazoom:jlayer:1.0.1'
    
        // 롬복 dependency
    compileOnly 'org.projectlombok:lombok:1.18.28'
    
    implementation 'net.sourceforge.tess4j:tess4j:5.7.0'
    testImplementation platform('org.junit:junit-bom:5.9.1')
    testImplementation 'org.junit.jupiter:junit-jupiter'
}

test {
    useJUnitPlatform()
}

 

수정 된 build.gradle

plugins {
    id 'java'
    id 'com.github.johnrengelman.shadow' version '7.1.2'  // Shadow
    id 'io.spring.dependency-management' version '1.0.11.RELEASE'
}

group = 'org.example'
version = '1.0-SNAPSHOT'

repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.seleniumhq.selenium:selenium-java:4.11.0'
    implementation 'io.github.bonigarcia:webdrivermanager:5.4.1'
    implementation 'javazoom:jlayer:1.0.1'
    
    // 롬복 dependency
    compileOnly 'org.projectlombok:lombok:1.18.24'
    annotationProcessor 'org.projectlombok:lombok:1.18.24'
    testCompileOnly 'org.projectlombok:lombok:1.18.24'
    
    implementation 'net.sourceforge.tess4j:tess4j:5.7.0'
    testImplementation platform('org.junit:junit-bom:5.9.1')
    testImplementation 'org.junit.jupiter:junit-jupiter'
}

test {
    useJUnitPlatform()
}

 

다시 jar로 빌드하니 정상으로 실행된다.

'Java' 카테고리의 다른 글

jar build시 외부 라이브러리가 존재하지 않음  (0) 2024.01.29