티스토리 뷰

오류

배포 자동화를 구현했는데, bulid하는데에 오류가 발생했길래 봤더니

spring-rest-docs에서 오류가 발생한것을 발견했습니다.

asGemPath()에 문제가 있다면서 갑자기 안되는 문제였습니다.

원인

gradle 버전이 안맞아서 발생하는 오류라고 합니다.

버전을 낮춰보라고 하네요.

 

 

 

그러나, 제 경우에는 버전을 6.5로 낮춰도 같은 문제가 발생했습니다.

 

해결

➡️ 플러그인 및 build.gradle 수정

플러그인과 build.gradle의 코드 일부를 수정해서 해결 할 수 있습니다.

plugins {
    id 'java'
    id 'org.springframework.boot' version '3.2.1'
    id 'io.spring.dependency-management' version '1.1.4'
//    id "org.asciidoctor.convert" version "1.5.9.2" << 주석 처리
    id 'org.asciidoctor.jvm.convert' version "3.3.2" // << 이 부분을 추가
}
  • 먼저, 플러그인을 org.asciidoctor.convert에서 org.asciidoctor.jvm.convert로 변경해줍니다.
configurations {
        asciidoctorExtensions
}
  • 그리고 asciidoctorExtensions를 사용할 수 있도록 설정해줍니다. asciidoctorExtensions는 기존의 asciidoctor를 대체합니다.
dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-web'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
//    asciidoctor 'org.springframework.restdocs:spring-restdocs-asciidoctor' << 주석 처리
    asciidoctorExtensions 'org.springframework.restdocs:spring-restdocs-asciidoctor' // << 이 부분 추가
    testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc' 
}
  • dependencies 부분의 asciidoctor를 asciidoctorExtensions로 수정해줍니다. 만약 configurations에 asciidoctorExtensions를 선언하지 않으면 알 수 없는 명령어 라면서 실행이 안되므로, 꼭 수정해주세요.
asciidoctor {
    inputs.dir snippetsDir
    dependsOn test
    configurations 'asciidoctorExtensions'
}
  • 마지막으로 asciidoctor task에다가 configurations ‘asciidoctorExtensions’ 구문을 추가해주면 끝입니다.

단, 이렇게 할 경우 html의 경로가 달리집니다.

이 글을 참고 한 블로그의 필자의 경우에는 /build/docs/html5 에서 html5가 없어지고 /build/docs/asciidoc에 생성되었다고 하는데, static으로 copy를 할 때 경로를 다시 확인해봐야 할 듯 합니다.

참고

Configuring asciidoctor when using Spring Restdoc

 

Configuring asciidoctor when using Spring Restdoc

I'm adopting Spring Rest Docs and the test successfully created *.adoc files. I made api-guide.doc file in src/docs/asciidoc directory to create html, but when I run asciidoc as a gradle task, it

stackoverflow.com

 

[SPRING] Asciidoctor 빌드 오류(asGemPath())

 

[SPRING] Asciidoctor 빌드 오류(asGemPath())

오류

jinseobbae.github.io

 

공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
more
«   2025/05   »
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
글 보관함