티스토리 뷰
개발/개발 기타
[gradle] jib 의존성 있을때 빌드 오류 - runtime of a library compatible with Java 8
정선생 2024. 4. 3. 13:18반응형
도커 이미지로 만들기위해 jib 의존성도 존재하는데, jar 로 빌드하기위해 build 하는데 아래와 같은 오류가 발생된다.
재밌는건, 내 로컬 PC 나 다른 서버에서 빌드할땐 아무런 문제가 없는데 jenkins 서버쪽에서만 나타나는 문제였다. 둘다 jdk 1.8 이었고 다른점은 gradle 버전이 다르다는것이었다.
jenkins 쪽은 gradle_6.9.2 이었고, 수동으로 빌드하던 gradle 버전은 7.5 라는것 정도가 달랐다.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project '프로젝트명'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not resolve com.google.guava:guava:32.1.2-jre.
Required by:
project : > com.google.cloud.tools.jib:com.google.cloud.tools.jib.gradle.plugin:3.4.2 > com.google.cloud.tools:jib-gradle-plugin:3.4.2
> The consumer was configured to find a runtime of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally. However we cannot choose between the following variants of com.google.guava:guava:32.1.2-jre:
- androidRuntimeElements
- jreRuntimeElements
All of them match the consumer attributes:
- Variant 'androidRuntimeElements' capabilities com.google.collections:google-collections:32.1.2-jre and com.google.guava:guava:32.1.2-jre declares a runtime of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally:
- Unmatched attributes:
- Provides attribute 'org.gradle.jvm.environment' with value 'android' but the consumer didn't ask for it
- Provides release status but the consumer didn't ask for it
- Variant 'jreRuntimeElements' capabilities com.google.collections:google-collections:32.1.2-jre and com.google.guava:guava:32.1.2-jre declares a runtime of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally:
- Unmatched attributes:
- Provides attribute 'org.gradle.jvm.environment' with value 'standard-jvm' but the consumer didn't ask for it
- Provides release status but the consumer didn't ask for it
The following variants were also considered but didn't match the requested attributes:
- Variant 'androidApiElements' capabilities com.google.collections:google-collections:32.1.2-jre and com.google.guava:guava:32.1.2-jre declares a library compatible with Java 8, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares an API of a component and the consumer needed a runtime of a component
- Variant 'jreApiElements' capabilities com.google.collections:google-collections:32.1.2-jre and com.google.guava:guava:32.1.2-jre declares a library compatible with Java 8, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares an API of a component and the consumer needed a runtime of a component
> Could not resolve com.google.guava:guava:30.1.1-android.
Required by:
project : > com.google.cloud.tools.jib:com.google.cloud.tools.jib.gradle.plugin:3.4.2 > com.google.cloud.tools:jib-gradle-plugin:3.4.2 > com.google.http-client:google-http-client:1.42.2
> The consumer was configured to find a runtime of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally. However we cannot choose between the following variants of com.google.guava:guava:32.1.2-jre:
- androidRuntimeElements
- jreRuntimeElements
All of them match the consumer attributes:
- Variant 'androidRuntimeElements' capabilities com.google.collections:google-collections:32.1.2-jre and com.google.guava:guava:32.1.2-jre declares a runtime of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally:
- Unmatched attributes:
- Provides attribute 'org.gradle.jvm.environment' with value 'android' but the consumer didn't ask for it
- Provides release status but the consumer didn't ask for it
- Variant 'jreRuntimeElements' capabilities com.google.collections:google-collections:32.1.2-jre and com.google.guava:guava:32.1.2-jre declares a runtime of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally:
- Unmatched attributes:
- Provides attribute 'org.gradle.jvm.environment' with value 'standard-jvm' but the consumer didn't ask for it
- Provides release status but the consumer didn't ask for it
The following variants were also considered but didn't match the requested attributes:
- Variant 'androidApiElements' capabilities com.google.collections:google-collections:32.1.2-jre and com.google.guava:guava:32.1.2-jre declares a library compatible with Java 8, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares an API of a component and the consumer needed a runtime of a component
- Variant 'jreApiElements' capabilities com.google.collections:google-collections:32.1.2-jre and com.google.guava:guava:32.1.2-jre declares a library compatible with Java 8, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares an API of a component and the consumer needed a runtime of a component
> Could not resolve com.google.guava:guava:31.0.1-android.
Required by:
project : > com.google.cloud.tools.jib:com.google.cloud.tools.jib.gradle.plugin:3.4.2 > com.google.cloud.tools:jib-gradle-plugin:3.4.2 > com.google.auth:google-auth-library-oauth2-http:1.10.0
> The consumer was configured to find a runtime of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally. However we cannot choose between the following variants of com.google.guava:guava:32.1.2-jre:
- androidRuntimeElements
- jreRuntimeElements
All of them match the consumer attributes:
- Variant 'androidRuntimeElements' capabilities com.google.collections:google-collections:32.1.2-jre and com.google.guava:guava:32.1.2-jre declares a runtime of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally:
- Unmatched attributes:
- Provides attribute 'org.gradle.jvm.environment' with value 'android' but the consumer didn't ask for it
- Provides release status but the consumer didn't ask for it
- Variant 'jreRuntimeElements' capabilities com.google.collections:google-collections:32.1.2-jre and com.google.guava:guava:32.1.2-jre declares a runtime of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally:
- Unmatched attributes:
- Provides attribute 'org.gradle.jvm.environment' with value 'standard-jvm' but the consumer didn't ask for it
- Provides release status but the consumer didn't ask for it
The following variants were also considered but didn't match the requested attributes:
- Variant 'androidApiElements' capabilities com.google.collections:google-collections:32.1.2-jre and com.google.guava:guava:32.1.2-jre declares a library compatible with Java 8, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares an API of a component and the consumer needed a runtime of a component
- Variant 'jreApiElements' capabilities com.google.collections:google-collections:32.1.2-jre and com.google.guava:guava:32.1.2-jre declares a library compatible with Java 8, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares an API of a component and the consumer needed a runtime of a component
> Could not resolve com.google.guava:guava:29.0-android.
Required by:
project : > com.google.cloud.tools.jib:com.google.cloud.tools.jib.gradle.plugin:3.4.2 > com.google.cloud.tools:jib-gradle-plugin:3.4.2 > com.google.http-client:google-http-client:1.42.2 > io.opencensus:opencensus-contrib-http-util:0.31.1
> The consumer was configured to find a runtime of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally. However we cannot choose between the following variants of com.google.guava:guava:32.1.2-jre:
- androidRuntimeElements
- jreRuntimeElements
All of them match the consumer attributes:
- Variant 'androidRuntimeElements' capabilities com.google.collections:google-collections:32.1.2-jre and com.google.guava:guava:32.1.2-jre declares a runtime of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally:
- Unmatched attributes:
- Provides attribute 'org.gradle.jvm.environment' with value 'android' but the consumer didn't ask for it
- Provides release status but the consumer didn't ask for it
- Variant 'jreRuntimeElements' capabilities com.google.collections:google-collections:32.1.2-jre and com.google.guava:guava:32.1.2-jre declares a runtime of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally:
- Unmatched attributes:
- Provides attribute 'org.gradle.jvm.environment' with value 'standard-jvm' but the consumer didn't ask for it
- Provides release status but the consumer didn't ask for it
The following variants were also considered but didn't match the requested attributes:
- Variant 'androidApiElements' capabilities com.google.collections:google-collections:32.1.2-jre and com.google.guava:guava:32.1.2-jre declares a library compatible with Java 8, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares an API of a component and the consumer needed a runtime of a component
- Variant 'jreApiElements' capabilities com.google.collections:google-collections:32.1.2-jre and com.google.guava:guava:32.1.2-jre declares a library compatible with Java 8, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares an API of a component and the consumer needed a runtime of a component
* 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
해결방법
jenkins 쪽 gradle 버전을 올리는게 좋겠지만, 여러사람이 쓰고 있다보니 또 다른 문제가 발생할까봐
내쪽에서 해결하는걸 찾아보니 jib 쪽 버전을 3.4.1 을 3.3.1 버전으로 낮추니 오류없이 빌드가 성공했다. (이유는 나도 잘 모르겠다)
https://plugins.gradle.org/plugin/com.google.cloud.tools.jib/3.3.1
반응형
'개발 > 개발 기타' 카테고리의 다른 글
[gradle] gradle plugin 사용시 오류 : Execution failed for task ':compileKotlin'. (0) | 2024.04.04 |
---|
댓글