본문 바로가기

Tool

[TeamCity] SpringBoot 웹어플리케이션 gradle build시 CustomMessageMissingMethodException 발생

728x90
반응형

 

<현상>

TeamCity 첫번째 STEP : gradle clean bootWar 시 에러발생

Starting: C:\Develop\Gradle\gradle-7.4.1\bin\gradle.bat --init-script C:\Develop\TeamCity\buildAgent\plugins\gradle-runner\scripts\init.gradle -Dorg.gradle.daemon=false -b build.gradle clean bootWar
in directory: C:\Develop\TeamCity\buildAgent\work\c25fb4bc0a8c3d3a
To honour the JVM settings for this build a single-use Daemon process will be forked. See https://docs.gradle.org/7.4.1/userguide/gradle_daemon.html#sec:disabling_the_daemon
Daemon will be stopped at the end of the build
> Configure project :
Starting Gradle in TeamCity build 4
FAILURE: Build failed with an exception.
org.gradle.internal.metaobject.AbstractDynamicObject$CustomMessageMissingMethodException: Could not find method compile() for arguments [directory 'WebContent/WEB-INF/lib'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
* Where:
Build file 'C:\Develop\TeamCity\buildAgent\work\c25fb4bc0a8c3d3a\build.gradle' line: 76
* What went wrong:
A problem occurred evaluating root project 'admin'.
> Could not find method compile() for arguments [directory 'WebContent/WEB-INF/lib'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
* Try:
> Run with --stacktrace option to get the stack trace.

[TeamCity] Gradle Exception -&nbsp;org.gradle.internal.metaobject.AbstractDynamicObject$CustomMessageMissingMethodException

<확인>

maven central를 사용하지 않는 라이브러리 문제인줄 알았으나 Gradle 6 으로 세팅되어 있는 어플리케이션에 Gradle 7 으로 build하여 생기는 문제로 확인(Gradle6에서 Gradle7로 버전업되면서 지원하는 명령어들이 많이 변경되었다.)

compile fileTree(dir: "WebContent/WEB-INF/lib", include: '*.jar')

<해결방법>

Gradle Build Step 에서 Gradle home path를 6버전으로 변경하여 build 하면 해결된다.

%GRADLE6_HOME% = C:\Develop\Gradle\gradle-6.9.1

[TeamCity] Gradle Build Step

 

728x90
반응형