spring boot2.0+swagger自动生成PDF和HTML格式的API文档

参考链接:https://blog.csdn.net/qq_29534483/article/details/81227308

 

1、添加maven依赖


    io.springfox
    springfox-swagger2
    2.8.0


    io.springfox
    springfox-swagger-ui
    2.8.0



    io.github.swagger2markup
    swagger2markup
    1.3.3

2、添加生成ASCIIDOC所需要maven插件:



    io.github.swagger2markup
    swagger2markup-maven-plugin
    1.2.0
    
        
        http://localhost:8888/v2/api-docs
        src/main/resources/docs/asciidoc/generated
        
            
            ASCIIDOC
        
    

3、添加输出PDF和HTML的maven插件:



    org.asciidoctor
    asciidoctor-maven-plugin
    1.5.3
    
    
        
            org.asciidoctor
            asciidoctorj-pdf
            1.5.0-alpha.10.1
        
        
            org.jruby
            jruby-complete
            1.7.21
        
    
    
    
        src/main/resources/docs/asciidoc/generated
        coderay
        
            left
        
    
    
    
        
            output-html
            generate-resources
            
                process-asciidoc
            
            
                html5
                src/main/resources/docs/asciidoc/html
            
        

        
            output-pdf
            generate-resources
            
                process-asciidoc
            
            
                pdf
                src/main/resources/docs/asciidoc/pdf
            
        

    

4、按照上面插件里配置的路经在对应目录手动创建对应名字的空文件夹

docs/   和  /docs/asciidoc两个

5、依次运行指令

mvn asciidoctor:process-asciidoc
mvn swagger2markup:convertSwagger2markup
mvn generate-resources

 

参考链接:https://blog.csdn.net/qq_29534483/article/details/81227308

你可能感兴趣的:(spring boot2.0+swagger自动生成PDF和HTML格式的API文档)