Peter Penzov
Peter Penzov

Reputation: 1588

Open webpages generated by restdocs

I want to display static pages using Spring Boot. I tried this configuration:

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

repositories {
    maven { url 'https://repo.spring.io/milestone' }
    maven { url 'https://repo.spring.io/snapshot' }
    mavenCentral()
    mavenLocal()
}

group = 'com.example'

sourceCompatibility = 11
targetCompatibility = 11

ext {
    restdocsVersion = '3.0.0-SNAPSHOT'
    snippetsDir = file('src/static/docs')
}

configurations {
    asciidoctorExtensions
}

dependencies {
    asciidoctorExtensions "org.springframework.restdocs:spring-restdocs-asciidoctor:$restdocsVersion"
    implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '2.6.3'

    implementation 'io.projectreactor.netty:reactor-netty-http:1.0.15'


    testImplementation 'io.rest-assured:rest-assured:4.5.0'
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.0'
    testImplementation "org.springframework.restdocs:spring-restdocs-restassured:$restdocsVersion"
    testImplementation 'org.springframework:spring-test'
    testImplementation('org.junit.vintage:junit-vintage-engine') {
        exclude group: 'org.hamcrest', module: 'hamcrest-core'
    }

    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.0'
}

test {
    outputs.dir snippetsDir
    useJUnitPlatform()
}

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

jar {
    dependsOn asciidoctor
    from ("${asciidoctor.outputDir}/html5") {
        into 'static/docs'
    }
}

I placed several .adoc files under this file location:

enter image description here

I started the project as a Spring Boot project but when I open http://localhost:8080/docs/index.html I get white label error:

Do you know how I can serve this content as web pages?

Upvotes: 0

Views: 162

Answers (0)

Related Questions