에러내용
private OrderSpecifier<?> getMembersOrder(Pageable pageable) {
^ (use --enable-preview to enable unnamed classes)
동적 쿼리를 위해 OrderSpecifier를 잘 써왔는데.. 오늘따라 갑자기 노란색 밑줄이 생기면서 컴파일 에러가 발생했다.
자바 21로 프로젝트를 진행중인데 자바 19 이상부터 새로운 미리보기 기능(unnamed classes)을 사용해야 한다고 한다.
Maven : pom.xml 에 추가
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>19</source>
<target>19</target>
<compilerArgs> <!-- 이 부분 추기 -->
<arg>--enable-preview</arg>
</compilerArgs>
</configuration>
</plugin>
</plugins>
</build>
Gradle : build.gradle 에 추가
tasks.withType(JavaCompile) {
options.compilerArgs += '--enable-preview'
}
tasks.withType(Test) {
jvmArgs += '--enable-preview'
}
이렇게 enable-preview를 켜주면 정상적으로 작동된다. 이 새로운 미리보기 기능이 왜 OrderSpecifier에 걸렸는지 알수없는데.... 쨋든 추가하면 잘 돌아간다.
enable-preview 에 대한 설명 참고
'Today I Run' 카테고리의 다른 글
로컬 우분투서버에 백엔드 배포하기 (0) | 2024.08.24 |
---|---|
로컬 우분투에 postgres 띄우기 (0) | 2024.08.21 |
Facade Pattern 이해하고 서비스에 적용하기 (1) | 2024.07.03 |
[TroubleShooting] Error creating bean with name 'jpaAuditingHandler': Cannot resolve reference to bean 'jpaMappingContext' while setting constructor argument (0) | 2024.06.09 |
[GoogleStudyJam] AI와 어사 탈출하기(수료완료!) (1) | 2024.05.29 |