RestDocs - include file not found

2022. 12. 16. 22:58ERROR

RestDocs로 문서화를 진행하던 도중에 다음의 에러가 발생했다.

include file not found
Unresolved directive in index.adoc - include::../../build/generated-snippets/post-update/http-response.adoc[]

 

src/docs/asciidoc 디렉토리에 index.adoc을 생성하여 다음과 같이 작성했는데,
화면 오른쪽의 preview가 잘 나오는 것을 보고 build/generated-snippets 하위의 파일들을 잘 읽어들였음을 확인할 수 있었다.

 

다만 문제는 gradle.build를 실행해서 index.adoc을 static/docs/index.html로 복사하는 과정에서 발생한 것이다.

왜 여기서는 .adoc 파일을 못 읽을까 하고 로그를 보았는데

include file not found: C:/Users/user/build/generated-snippets/post-save/http-response.adoc :: index.adoc ::

접근하는 디렉토리가 C: /User/user/build/generated-snippets로 설정되어있었다.
이 프로젝트는 C:/Users/user/Downloads/ 디렉토리 하위에 있으므로
 C:/Users/user/Downloads/jpaBoard/build/generated-snippets 경로로 접근해야 한다.

아래 캡쳐는 index.adoc 상단에 기재한 문법인데 :snippets: 부분은 index.html을 생성할 때 접근하는 경로로 쓰인다고 한다.

정상적인 경로로 접근하기 위해 빨간 네모박스 부분을 제거했다.

 

그리고 빌드하니 index.html이 정상적으로 생성되었다.

 

경로 문제는 정말이지 힘들다