s_y_130
About SY
s_y_130
전체 방문자
오늘
어제
  • 분류 전체보기
    • JAVA
      • 더 자바 8
      • JAVA
      • JAVA (JVM)
    • Computer Science
      • CS Basic
      • OOP
      • Design Pattern
      • Network
      • HTTP
      • WEB
      • OS
    • DataBase
      • DB theory
      • MySQL
      • Redis
    • Collection Framework
      • 구현
    • Data Structure
      • Linear
      • Non-Linear
    • Algorithm
      • Basic
      • 응용
      • 완전 탐색(Brute Force)
      • 다익스트라
      • Algorithm Problem
    • Spring
      • 스프링 핵심 원리 - 기본편
      • 스프링 MVC 1편 - 백엔드 웹 개발 핵심 기술
      • 스프링 MVC 2편 - 백엔드 웹 개발 핵심 기술
      • 스프링 DB 1편 - 데이터 접근 핵심 원리
      • 스프링 DB 2편 - 데이터 접근 활용 기술
      • 스프링 핵심 원리 - 고급편
      • 스프링 부트 - 핵심 원리와 활용
      • 재고시스템으로 알아보는 동시성이슈 해결방법
      • 개념
      • 테스트
      • Annotation
      • Error Log
    • TEST
      • 부하 테스트
      • Practical Testing: 실용적인 테스트..
    • JPA
      • 자바 ORM 표준 JPA 프로그래밍
      • 1편- 실전! 스프링 부트와 JPA 활용
      • 2편- 실전! 스프링 부트와 JPA 활용
      • 실전! 스프링 데이터 JPA
      • 실전! Querydsl
      • 개념
    • Open Source
    • Book Study
      • Morden Java in Action
      • Real MySQL 8.0 Vol.1
      • TDD : By Example
    • AWS
      • EC2
    • git
    • AI
      • Machine Learning
      • Deep Learning
      • TensorFlow
      • PyTorch
      • YOLO
      • Data Analysis
      • Ai code Error
      • Numpy
    • MY
    • WEB
      • Django
      • WEB 개념
      • React
      • Maven
    • Python
    • 기초수학

블로그 메뉴

  • 홈
  • 태그
  • 방명록

공지사항

인기 글

태그

최근 댓글

최근 글

티스토리

hELLO · Designed By 정상우.
s_y_130

About SY

[SPRING] Asciidoctor 빌드 오류(asGemPath())
Spring/Error Log

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

2022. 12. 16. 18:56

 

에러 발생 🚨

Some problems were found with the configuration of task ':asciidoctor' (type 'AsciidoctorTask'). - In plugin 'org.asciidoctor.convert' type 'org.asciidoctor.gradle.AsciidoctorTask' method 'asGemPath()' should not be annotated with: @Optional, @InputDirectory.

 

이번 에러는  작성한 .adoc 템플릿 문서 html로 변환하는 과정에서 발생하였다.

 

asGemPath()에 문제가 있다면서 안된다.

확인을 해보니 스니펫에 adoc파일들은 만들어지는데 html이 안만들어졌다.

 

 

문제 파악🚒

gradle 버전이 변경되면서 발생한 오류다.

최근 gradle6에서 7로 버전을 올렸는데 버전을 올리자마자 발생했다.

검색을 해보니 org.asciidoctor.convert(v 1.5.9) 플러그인이 아직 gradle7과는 호환이 안되는 것 같다.

 

 

해결

해결은 2가지 방법으로 가능했다.

1. Gradle 다운그레이드

정말 간단한 방법으로 gradle 버전을 다시 내려주면 된다.

[gradle 버전 변경 방법]

 

 

2. 플러그인 및 build.gradle 수정

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

plugins{
  // id 'org.asciidoctor.convert' version "1.5.9" 
  id 'org.asciidoctor.jvm.convert' version "3.3.2" 
}

먼저 플러그인을 org.asciidoctor.convert에서 org.asciidoctor.jvm.convert로 변경해준다.

configurations {
        asciidoctorExtensions
}

그리고 asciidoctorExtensions를 사용할 수 있도록 설정해준다.

asciidoctorExtensions는 기존의 asciidoctor를 대체한다.

dependencies{
//  asciidoctor 'org.springframework.restdocs:spring-restdocs-asciidoctor'
  asciidoctorExtensions 'org.springframework.restdocs:spring-restdocs-asciidoctor'
}

dependencies 부분의 asciidoctor를 asciidoctorExtensions로 수정해준다.

만약 configurations에 asciidoctorExtensions를 선언하지 않으면 알 수 없는 명령어 라면서 실행이 안된다.

asciidoctor {
        dependsOn test
        configurations 'asciidoctorExtensions' // 이부분!
        inputs.dir snippetsDir
  }

마지막으로 asciidoctor task에다가 configurations ‘asciidoctorExtensions’ 구문을 추가해주면 끝이다.

plugins{
  id 'org.asciidoctor.jvm.convert' version "3.3.2" 
}

configurations {
  asciidoctorExtensions
}

ext {
  snippetsDir = file("${buildDir}/generated-snippets")
}

dependencies {
  testImplementation 'org.testcontainers:junit-jupiter:1.16.2'
  asciidoctorExtensions 'org.springframework.restdocs:spring-restdocs-asciidoctor'
  testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc:2.0.6.RELEASE'
}

test {
  outputs.dir snippetsDir
  useJUnitPlatform()
  finalizedBy 'asciidoctor'
}


asciidoctor {
  dependsOn test
  configurations 'asciidoctorExtensions'
  inputs.dir snippetsDir
}

최종적으로 이런 모습이 된다.

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

나같은 경우에는 /build/docs/html5 에서 html5가 없어지고 /build/docs/asciidoc에 생성되었다.

static으로 copy를 할 때 경로를 다시 확인해봐야 할 듯 하다.

 

 

나는 해결 방법 1번으로 해당 오류를 해결했다.

그러고나서 등장한 에러는....

 

이것도 해결하러 가자ㅠㅠ


 

참고

https://jinseobbae.github.io/spring/2022/01/26/gradle-asciidoc-error.html

https://dmaolon00.tistory.com/112?category=963524 

https://namsick96.github.io/build%20tool/Gradle_version_change_at_Intellij/

 

    'Spring/Error Log' 카테고리의 다른 글
    • execution failed for task ':asciidoctor'. > (loaderror) no such file to load -- asciidoctor/logging
    s_y_130
    s_y_130

    티스토리툴바