Gradle — Upgrading from 6.5

JinHyeong bak
19 min readJan 3, 2022

--

Upgrading the Wrapper version

./gradlew wrapper — gradle-version 7.3.3

Upgrading Java11 from java1.8

build.gradle

sourceCompatibility = '11'
targetCompatibility = '11'

문제:

9:38:50 PM: Executing 'build'...> Task :common:compileJava UP-TO-DATE
> Task :common:processResources UP-TO-DATE
> Task :common:classes UP-TO-DATE
> Task :common:jar UP-TO-DATE
> Task :server: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.3.3/userguide/command_line_interface.html#sec:command_line_warnings
4 actionable tasks: 1 executed, 3 up-to-date
FAILURE: Build failed with an exception.* What went wrong:
Execution failed for task ':server:compileJava'.
> invalid source release: 11
* 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.orgBUILD FAILED in 792ms

해법:

설명:

문제:

java: warning: source release 11 requires target release 11

해법:

설명:

문제: Gradle 7 업데이트 후 google appengine 배포 실패

빌드 시 실패:

> Task :bot:explodeWar FAILED
Execution optimizations have been disabled for task ':bot:explodeWar' to ensure correctness due to the following reasons:
- Gradle detected a problem with the following location: '/Users/kakao/projects-my/new-world/bot/build/libs/bot-0.0.1-SNAPSHOT.war'. Reason: Task ':bot:explodeWar' uses this output of task ':bot:bootWar' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.3.3/userguide/validation_problems.html#implicit_dependency for more details about this problem.
:bot:explodeWar (Thread[Execution worker for ':' Thread 3,5,main]) completed. Took 0.017 secs.
FAILURE: Build failed with an exception.* What went wrong:
A problem was found with the configuration of task ':bot:explodeWar' (type 'ExplodeWarTask').
- In plugin 'com.google.cloud.tools.gradle.appengine.standard.AppEngineStandardPlugin' type 'com.google.cloud.tools.gradle.appengine.standard.ExplodeWarTask' property 'explodedAppDirectory' is missing an input or output annotation.
Reason: A property without annotation isn't considered during up-to-date checking.Possible solutions:
1. Add an input or output annotation.
2. Mark it as @Internal.
Please refer to https://docs.gradle.org/7.3.3/userguide/validation_problems.html#missing_annotation for more details about this problem.* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.orgDeprecated 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.3.3/userguide/command_line_interface.html#sec:command_line_warningsExecution optimizations have been disabled for 1 invalid unit(s) of work during this build to ensure correctness.
Please consult deprecation warnings for more details.
BUILD FAILED in 11s

명령어를 변경하고 다시 실행: bot-0.0.1-SNAPSHOT.war 파일이 없음? :bot:war SKIPPED 가 스킵되었다.
> Task :bot:war SKIPPED
Skipping task ‘:bot:war’ as task onlyIf is false.
:bot:war (Thread[Execution worker for ‘:’,5,main]) completed. Took 0.0 secs.
:bot:explodeWar (Thread[Execution worker for ‘:’,5,main]) started.

./gradlew :bot:clean :bot:explodeWar --info...
> Task :bot:classes
Skipping task ':bot:classes' as it has no actions.
:bot:classes (Thread[Execution worker for ':',5,main]) completed. Took 0.0 secs.
:bot:war (Thread[Execution worker for ':',5,main]) started.
> Task :bot:war SKIPPED
Skipping task ':bot:war' as task onlyIf is false.
:bot:war (Thread[Execution worker for ':',5,main]) completed. Took 0.0 secs.
:bot:explodeWar (Thread[Execution worker for ':',5,main]) started.
> Task :bot:explodeWar FAILED
:bot:explodeWar (Thread[Execution worker for ':',5,main]) completed. Took 0.0 secs.
FAILURE: Build failed with an exception.* What went wrong:
Execution failed for task ':bot:explodeWar'.
> Cannot expand ZIP '/xxx/bot/build/libs/bot-0.0.1-SNAPSHOT.war' as it does not exist.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.orgDeprecated 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.3.3/userguide/command_line_interface.html#sec:command_line_warnings

해법: 설정 추가

war {
enabled=true
}

enabled=true 후 파일 생성 성공함

/xxx/bot/build/libs/bot-0.0.1-SNAPSHOT.war

문제:

> Task :bot:explodeWar FAILED
:bot:explodeWar (Thread[Execution worker for ':',5,main]) completed. Took 0.005 secs.
FAILURE: Build failed with an exception.* What went wrong:
A problem was found with the configuration of task ':bot:explodeWar' (type 'ExplodeWarTask').
- In plugin 'com.google.cloud.tools.gradle.appengine.standard.AppEngineStandardPlugin' type 'com.google.cloud.tools.gradle.appengine.standard.ExplodeWarTask' property 'explodedAppDirectory' is missing an input or output annotation.
Reason: A property without annotation isn't considered during up-to-date checking.Possible solutions:
1. Add an input or output annotation.
2. Mark it as @Internal.
Please refer to https://docs.gradle.org/7.3.3/userguide/validation_problems.html#missing_annotation for more details about this problem.* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.orgDeprecated 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.3.3/userguide/command_line_interface.html#sec:command_line_warningsBUILD FAILED in 2s

해법: com.google.cloud.tools:appengine-gradle-plugin:1.+ 에서 com.google.cloud.tools:appengine-gradle-plugin:2.4.2 로 업데이트

버전 업데이트

> Task :bot:classes
Skipping task ':bot:classes' as it has no actions.
:bot:classes (Thread[Execution worker for ':',5,main]) completed. Took 0.0 secs.
:bot:war (Thread[Execution worker for ':',5,main]) started.
> Task :bot:war
Excluding []
Excluding []
Caching disabled for task ':bot:war' because:
Build cache is disabled
Task ':bot:war' is not up-to-date because:
Output property 'archiveFile' file /Users/kakao/projects-my/new-world/bot/build/libs/bot-0.0.1-SNAPSHOT.war has been removed.
:bot:war (Thread[Execution worker for ':',5,main]) completed. Took 0.953 secs.
:bot:explodeWar (Thread[Execution worker for ':',5,main]) started.
> Task :bot:explodeWar
Caching disabled for task ':bot:explodeWar' because:
Build cache is disabled
Task ':bot:explodeWar' is not up-to-date because:
No history is available.
:bot:explodeWar (Thread[Execution worker for ':',5,main]) completed. Took 0.499 secs.
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.3.3/userguide/command_line_interface.html#sec:command_line_warnings

설명:

문제:

> Task :bot:appengineDeploy FAILED
Caching disabled for task ':bot:appengineDeploy' because:
Build cache is disabled
Task ':bot:appengineDeploy' is not up-to-date because:
Task has not declared any outputs despite executing actions.
:bot:appengineDeploy (Thread[Execution worker for ':',5,main]) completed. Took 0.004 secs.
FAILURE: Build failed with an exception.* What went wrong:
Execution failed for task ':bot:appengineDeploy'.
> Deployment projectId must be defined or configured to read from system state
1. Set appengine.deploy.projectId = 'my-project-id'
2. Set appengine.deploy.projectId = 'GCLOUD_CONFIG' to use project from gcloud config.
3. Using appengine.deploy.projectId = 'APPENGINE_CONFIG' has been deprecated.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.orgDeprecated 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.3.3/userguide/command_line_interface.html#sec:command_line_warningsExecution optimizations have been disabled for 1 invalid unit(s) of work during this build to ensure correctness.
Please consult deprecation warnings for more details.
BUILD FAILED in 2m 36s

해법:

appengine {
deploy {
version = "GCLOUD_CONFIG"
projectId = "GCLOUD_CONFIG"
}
}

Gradle — version catalog?

7.0 릴리스에서 Gradle은 버전 카탈로그를 실험적 기능으로 도입합니다. 버전 카탈로그를 사용하면 빌드 작성자가 기존 구성 파일에서 타사 종속성의 종속성 좌표(그룹, 아티팩트, 버전)를 중앙 집중화하고 유형이 안전한 방식으로 실제 종속성을 선언할 수 있습니다.

--

--