build.gradle 파일에서 wrapper 부분을 수정했다.
wrapper {
gradleVersion = '6.4.1'
}
문제들을 만났다.
Could not create task ':admin:npmInstall'.
Replacing an existing task that may have already been used by other plugins is not supported. Use a different name for this task ('npmInstall').
코드를 바꾼다.
task npmInstall(type: NpmTask, overwrite: true) {
...
}
→
npmInstall {
...
}
* What went wrong:
Execution failed for task ':admin:nodeSetup'.
> Could not resolve all files for configuration ':admin:detachedConfiguration50'.
> Could not find org.nodejs:node:10.16.3.
Searched in the following locations:
- https://nodejs.org/dist/v10.16.3/ivy.xml
Required by:
project :admin
의존성 관리하는 코드를 바꾼다.
apply plugin: "com.moowork.node"
→
apply plugin: "com.github.node-gradle.node"
classpath "com.moowork.gradle:gradle-node-plugin:1.3.1"
→
classpath "com.github.node-gradle:gradle-node-plugin:2.2.4"
https://plugins.gradle.org/plugin/com.github.node-gradle.node
* What went wrong:
A problem was found with the configuration of task ':
admin:npmInstall' (type 'NpmInstallTask').
> No value has been specified for property 'packageJsonFile'.
위 1. npmInstall override failure 문제
의 해결방법이 잘못되었다.
다시 코드를 수정한다.
npmInstall {
...
}
→
task adminNpmInstall(type: NpmTask) {
workingDir = file("src/main/front/")
args = ['install']
}
adminNpmInstall일 필요는 없다. 이름을 만들면 된다.
args = ['install'] 부분이 npmInstall 작업임을 나타낸다.
자세한 오버라이딩 방법은 링크에 있다.
https://github.com/node-gradle/gradle-node-plugin/blob/master/docs/usage.md
컴파일 에러가 났다.
error: cannot infer type arguments for SomePageResult<>
SomePageResult<R> result = new SomePageResult<>();
...
error: cannot find symbol
result.hasNext = this.isHasNext();
하나씩 해결한다.
isHasNext는 lombok으로 생성된 메서드다.
@Getter
public class SomePageResult<T> {
...
private boolean hasNext;
isHasNext에서 컴파일 에러가 났으므로, lombok에서 문제가 생긴 것으로 본다.
annotationProcessor task를 추가하라고 한다.
https://stackoverflow.com/questions/35236104/gradle-build-fails-on-lombok-annotated-classes
의존성 코드를 추가한다.
annotationProcessor 'org.projectlombok:lombok:1.18.8'
문제는 해결됐다.
이게 왜 필요한지는 모르겠다.
Gradle에서 5.0부터 incremental annotation processing을 지원한다고 한다.
링크를 참고한다.
https://docs.gradle.org/5.0/userguide/java_plugin.html#sec:incremental_annotation_processing
* What went wrong:
Execution failed for task ':service:compileQuerydsl'.
> Annotation processor 'com.querydsl.apt.jpa.JPAAnnotationProcessor' not found
ewerk/gradle-plugins github issue에 비슷한 이슈가 있다.
https://github.com/ewerk/gradle-plugins/issues/112
방법이 나온다.
i looked close issue ,that somebody give a config
compileQuerydsl {
options.annotationProcessorPath = configurations.querydsl
}
코드를 추가한다.
compileQuerydsl {
options.annotationProcessorPath = configurations.querydsl
// java 언어로 밑처럼 표현할 수 있을 것 같다.
// compileOptions.setAnnotationProcessorPath(project.getConfigurations().getByName("querydsl"))
// annotationProcessorPath는 FileCollection 타입이고, configuration은 fileCollection 타입을 상속한다.
}
문제는 해결됐다.
하지만 코드가 어떻게 문제를 해결했는지 이해를 못했다.
https://github.com/ewerk/gradle-plugins/issues/112
위 링크에서 queryDsl 플러그인 contributor가, queryDsl 플러그인이 gradle 5+와 호환이 불가능하다고 했다.
하지만, 2019.10월에 gradle 5 호환 이슈가 닫혔다.
https://github.com/ewerk/querydsl-plugin/issues/3
호환 이슈는 해결된 것으로 보인다.
compileQueryDsl은 JavaCompile task를 상속한다.
javaCompile는 compileOptions 필드를 가지고 있다.
그래서 밑 코드가 가능하다.
compileQuerydsl {
options.annotationProcessorPath = configurations.querydsl
// java 언어로 밑처럼 표현할 수 있을 것 같다.
// compileOptions.setAnnotationProcessorPath(project.getConfigurations().getByName("querydsl"))
// annotationProcessorPath는 FileCollection 타입이고, configuration은 fileCollection 타입을 상속한다.
}
error: package org.apache.commons.lang does not exist
import static org.apache.commons.lang.StringUtils.stripStart;
찾아보니까 코드 어디에서도 lang 의존성을 추가하는 부분은 없다.
lang을 사용하는 코드를 모두 lang3를 사용하게끔 바꾸었다.
import static org.apache.commons.lang.StringUtils.stripStart;
→
import static org.apache.commons.lang3.StringUtils.stripStart;
문제는 해결됐다.
왜 lang은 의존성에 추가된 걸까?
그리고 gradle을 업그레이드하면서 왜 lang을 library로 인식하지 못하게 된 걸까?
모르겠다.
Caused by: java.lang.NoSuchFieldException: $jacocoAccess
at java.base/java.lang.Class.getField(Class.java:2005)
at org.jacoco.agent.rt.internal_290345e.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:137)
... 9 more
https://github.com/vaskoz/core-java9-impatient/issues/11
해결방법이 있다.
jacoco의 toolVersion을 올려서 해결한다.
jacoco {
toolVersion = "0.8.0"
}
→
jacoco {
toolVersion = "0.8.2"
}
toolVersion과 jacocoAccess field의 관계는 모른다.
사실 알고보니 이건 gradle 업그레이드가 아니라 java 버전이 문제였다.
java 8 버전으로 ./gradlew build를 실행하면 이 문제가 나타나지 않을 것이다.
삽질하면서 알게 된 것