본문 바로가기
공부/프로그래밍

[gradle] build 실패(No cached version of available for offline mode)

by demonic_ 2019. 8. 27.
반응형

결론: 다음명령어를 실행하자

gradlew build --stacktrace

 


 

build 를 하면 다음과 같은에러가 발생한다

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'sender-spring'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not resolve org.springframework.boot:spring-boot-gradle-plugin:2.1.0.RELEASE.
     Required by:
         project :
      > No cached version of org.springframework.boot:spring-boot-gradle-plugin:2.1.0.RELEASE available for offline mode.

* 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

CONFIGURE FAILED in 0s

 

인터넷을 찾아보니 아래와 같이 하라고 하는데, 문제는 Intellij Ultimate 버전에선 그런 버튼이 없었다.

Preferences > Build, Execution, Deployment > Compiler 
또는 
Preferences -> Build, Execution, Deployment -> Gradle -> Offline work.

 

찾아보니 해당 옵션은 안드로이드 스튜디오에만 있는 듯 하다

 

Try 문구를 보면 --stacktrace 옵션을 주어 실행해보라고 권장되어 있다. 

그래서 터미널을 열고 다음 명령어를 실행했다.

 

(윈도우 기준, cmd 창을 열고 해당 폴더에서 아래 명령어 수행)

gradlew build --stacktrace

그러더니 아래와 같이 뜨면서 다운로드를 받고 있다.

Gradle 로 자동 build 했지만 실제로 다운로드를 하지 않아 발생한 듯 보인다.

Microsoft Windows [Version 10.0.15063]
(c) 2017 Microsoft Corporation. All rights reserved.

C:\git\sender-spring>gradle build --stacktrace
'gradle'은(는) 내부 또는 외부 명령, 실행할 수 있는 프로그램, 또는
배치 파일이 아닙니다.

C:\git\sender-spring>gradlew build --stacktrace

Welcome to Gradle 4.8.1!

Here are the highlights of this release:
 - Dependency locking
 - Maven Publish and Ivy Publish plugins improved and marked stable
 - Incremental annotation processing enhancements
 - APIs to configure tasks at creation time

For more details see https://docs.gradle.org/4.8.1/release-notes.html

Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details
Download https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-gradle-plugin/2.1.0.RELEASE/spring-boot-gradle-plugin-2.1.0.RELEASE.pom
Download https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-tools/2.1.0.RELEASE/spring-boot-tools-2.1.0.RELEASE.pom
Download https://repo.maven.apache.org/maven2/org/spockframework/spock-spring/1.1-groovy-2.4/spock-spring-1.1-groovy-2.4.jar

...


> Task :compileTestJava
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

> Task :test
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass (file:/C:/Users/office-public/.gradle/caches/modules-2/files-2.1/org.codehaus.groovy/groovy-all/2.4.9/3334e99a8baae12d6e014d444149e337ceb99a00/groovy-all-2.4
.9.jar) to method java.lang.Object.finalize()
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClass
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
20190825 19:33:05.608 [Thread-7] INFO o.a.k.c.p.KafkaProducer : [Producer clientId=producer-1] Closing the Kafka producer with timeoutMillis = 30000 ms.
20190825 19:33:05.617 [Thread-7] INFO c.z.h.HikariDataSource : HikariPool-2 - Shutdown initiated...
20190825 19:33:05.657 [Thread-7] INFO c.z.h.HikariDataSource : HikariPool-2 - Shutdown completed.
20190825 19:33:05.658 [Thread-7] INFO c.z.h.HikariDataSource : HikariPool-1 - Shutdown initiated...
20190825 19:33:05.706 [Thread-7] INFO c.z.h.HikariDataSource : HikariPool-1 - Shutdown completed.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
See https://docs.gradle.org/4.8.1/userguide/command_line_interface.html#sec:command_line_warnings

 

이후 실행하니 정상작동 했다.

 

추후 gradle 에다가 레파지토리를 추가할때마다 에러가 났었는데

그때마다 gradlew build --stacktrace 명령어를 실행하니 제대로 의존성 확인하여 컴파일 되었다.

 

 

끝.

반응형

댓글