• 카테고리

    질문 & 답변
  • 세부 분야

    백엔드

  • 해결 여부

    미해결

build관련 질문드립니다.

23.03.29 09:36 작성 23.03.29 14:32 수정 조회수 2.63k

0

안녕하세요 영한님.

스프링 입문 로드맵부터 지금까지 정말 좋은 강의 감사합니다.

로컬에서는 compileQuerydsl도 정상적으로 작동되고 Q클래스도 잘 생성 되는데
결국에 배포를 하기 위해서는 build를 해야 하는데 해당 부분에서 계속 문제가 생겨서 질문드립니다.

아래는 설정파일입니다.

querydsl관련 중복 에러만 발생하여 다른 라이브러리는 제외하고 해당 부분만 올렸습니다.

 

buildscript {
    ext {
        queryDslVersion = "5.0.0"
    }
}

plugins {
    id 'java'
    id 'org.springframework.boot' version '3.0.3'
    id 'io.spring.dependency-management' version '1.1.0'
    id "com.ewerk.gradle.plugins.querydsl" version "1.0.10"
}

group = 'heyuniverse'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17'

configurations {
    compileOnly {
        extendsFrom annotationProcessor
    }
}

repositories {
    mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'com.querydsl:querydsl-jpa:5.0.0:jakarta'
    annotationProcessor "com.querydsl:querydsl-apt:${dependencyManagement.importedProperties['querydsl.version']}:jakarta"
    annotationProcessor "jakarta.persistence:jakarta.persistence-api"
    annotationProcessor "jakarta.annotation:jakarta.annotation-api"
}
tasks.named('test') {
    useJUnitPlatform()
}

def querydslDir = "$buildDir/generated/querydsl"


clean {
    delete file(querydslDir)
}

querydsl {
    jpa = true
    querydslSourcesDir = querydslDir
}

sourceSets {
    main.java.srcDir querydslDir
}

configurations {
    querydsl.extendsFrom compileClasspath
}
compileQuerydsl {
    options.annotationProcessorPath = configurations.querydsl
}
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip

아래는 배포를 위해 build시 발생하는 에러 로그입니다.

> Task :compileJava FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.6/userguide/command_line_interface.html#sec:command_line_warnings

3 actionable tasks: 3 executed

FAILURE: Build failed with an exception.

* What went wrong:

Execution failed for task ':compileJava'.

> Compilation failed; see the compiler error output for details.

Attempt to recreate a file for type xxxx.xxxx.QClass

Attempt to recreate a file for type xxxx.xxxx.QClass

Attempt to recreate a file for type xxxx.xxxx.QClass

Attempt to recreate a file for type xxxx.xxxx.QClass


인텔리제이 ,gradle 양쪽 다 캐쉬 삭제 후 실행 해봐도 결과는 같았고,

gradle 버전이 문제인가 하여 8.0으로 업그레이드 해봐도 해결이 되지는 않았습니다.

이틀 넘게 종일 매달려봐도 도무지 질문할 곳이 없어서 남겨봅니다 ,,

 

 

답변 1

답변을 작성해보세요.

1

y2gcoder님의 프로필

y2gcoder

2023.03.29

안녕하세요, 박민규 님. 공식 서포터즈 y2gcoder 입니다.

QueryDSL의 설정법은 워낙 다양해서 더 어렵다고 생각합니다.
해당 링크(클릭)를 참고하셔서 밑의 tasks.named('test') {} 이하 항목을 다 날려보시고 QClass를 생성하는 방법으로 해보시는 것을 추천드립니다.
저는 위의 링크에 있는 설정 + Intellij Build Tool에서 Gradle로 설정해서 다른 것 만져주는 것 없이 사용하고 있습니다.


감사합니다.

박민규님의 프로필

박민규

질문자

2023.03.29

플러그인을 또 주입 받은게 문제였네요 ㅜㅜ 감사합니다.

y2gcoder님의 프로필

y2gcoder

2023.03.29

파이팅입니다!

wodlszz님의 프로필

wodlszz

2023.11.15

build and run using과 run test using을 gradle로 사용하시는건가요??

저두 그렇게하는데 그렇게하면 QuerydslApplication이 동작하지 않고 Process 'command '/Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1

이 에러가 발생하는데 어떻게 해결해야하나요??

y2gcoder님의 프로필

y2gcoder

2023.11.16

Zulu 말고 다른 jdk 벤더를 사용햐보시겠습니까? Corretto는 잘 작동하고 있습니다! 그래도 안된다면 따로 질문으로 남겨주시면 감사하겠습니다:)