오류 발생 명령어
./gradlew clean build
오류메세지
FAILURE: Build failed with an exception.
* What went wrong:
Gradle could not start your build.
> Could not create service of type FileHasher using BuildSessionServices.createFileHasher().
> java.io.FileNotFoundException: /var/www/udemy_server_practice_springboot/.gradle/6.7.1/fileHashes/fileHashes.lock (Permission denied)
오류 원인
이 오류는 Gradle이 빌드를 시작하는 동안 특정 파일(fileHashes.lock)에 접근할 수 없기 때문에 발생했다.
그 원인은 권한 부족(Permission denied) 오류로 인해 Gradle이 .gradle 디렉터리에 있는 파일을 생성하거나 수정하지 못하기 때문이다.
해결 방법
방법 1. chown, chmod 를 활용해 해당 디렉터리의 접근 권한을 바꿔준다.
방법 2. 명령어 자체를 관리자 권한으로 실행시킨다.
채택한 해결 방법
방법 2를 채택하였다.
처음에 사용한 명령어 앞에 sudo를 붙여 다시 명령어를 실행하였다.
sudo ./gradlew clean build