Java 如何使用Asciidoctor maven插件从通过springfox staticdocs生成的ascii格式的ascii文档生成html文档

Java 如何使用Asciidoctor maven插件从通过springfox staticdocs生成的ascii格式的ascii文档生成html文档,java,spring-boot,swagger-2.0,asciidoctor,springfox,Java,Spring Boot,Swagger 2.0,Asciidoctor,Springfox,我使用Swagger 2生成api文档,swaggwer的json输出通过springfox staticdocs生成ascii静态文档。ascii格式的静态文档是在junit测试类中生成的。现在我想通过asciidoctor maven插件从测试阶段生成的ascii文档生成html文档,但是不知何故html文档没有生成,我甚至看不到asciidoc目标的执行过程。由于ascii文档是在测试阶段生成的,所以我将“process ascidoc”目标绑定到准备包阶段。我做错什么了吗 mvn包 SL

我使用Swagger 2生成api文档,swaggwer的json输出通过springfox staticdocs生成ascii静态文档。ascii格式的静态文档是在junit测试类中生成的。现在我想通过asciidoctor maven插件从测试阶段生成的ascii文档生成html文档,但是不知何故html文档没有生成,我甚至看不到asciidoc目标的执行过程。由于ascii文档是在测试阶段生成的,所以我将“process ascidoc”目标绑定到准备包阶段。我做错什么了吗

mvn包

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building user-service 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ user-service ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 48 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ user-service ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ user-service ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Application\sts33\maxplayarea\UserService\src\test\resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ user-service ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-surefire-plugin:2.17:test (default-test) @ user-service ---
[INFO] Surefire report directory: C:\Application\sts33\maxplayarea\UserService\target\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.dox.microservice.user.test.UserServiceControllerTest
19:43:58.515 [main] DEBUG o.s.t.c.j.SpringJUnit4ClassRunner - SpringJUnit4ClassRunner constructor called with [class com.dox.microservice.user.test.UserServiceControllerTest].
19:43:58.529 [main] DEBUG o.s.test.context.BootstrapUtils - Instantiating TestContextBootstrapper from class [org.springframework.test.context.web.WebTestContextBootstrapper]
19:43:58.548 [main] DEBUG o.s.t.c.w.WebTestContextBootstrapper - Found explicit ContextLoader class [org.springframework.boot.test.SpringApplicationContextLoader] for context configuration attributes [ContextConfigurationAttributes@fad74ee declaringClass = 'com.dox.microservice.user.test.UserServiceControllerTest', classes = '{class com.dox.microservice.user.configuration.UserConfiguration}', locations = '{}', inheritLocations = true, initializers = '{}', inheritInitializers = true, name = [null], contextLoaderClass = 'org.springframework.boot.test.SpringApplicationContextLoader']
19:43:58.552 [main] DEBUG o.s.t.c.support.ActiveProfilesUtils - Could not find an 'annotation declaring class' for annotation type [org.springframework.test.context.ActiveProfiles] and class [com.dox.microservice.user.test.UserServiceControllerTest]
19:43:58.555 [main] DEBUG o.s.t.c.w.WebTestContextBootstrapper - @TestExecutionListeners is not present for class [com.dox.microservice.user.test.UserServiceControllerTest]: using defaults.
19:43:58.565 [main] INFO  o.s.t.c.w.WebTestContextBootstrapper - Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener]
19:43:58.585 [main] INFO  o.s.t.c.w.WebTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@27d415d9, org.springframework.test.context.support.DependencyInjectionTestExecutionListener@5c18298f, org.springframework.test.context.support.DirtiesContextTestExecutionListener@31f924f5, org.springframework.test.context.transaction.TransactionalTestExecutionListener@5579bb86, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@5204062d]
19:43:58.587 [main] DEBUG o.s.t.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.dox.microservice.user.test.UserServiceControllerTest]
19:43:58.587 [main] DEBUG o.s.t.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.dox.microservice.user.test.UserServiceControllerTest]
19:43:58.588 [main] DEBUG o.s.t.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.dox.microservice.user.test.UserServiceControllerTest]
19:43:58.588 [main] DEBUG o.s.t.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.dox.microservice.user.test.UserServiceControllerTest]
19:43:58.591 [main] DEBUG o.s.t.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.dox.microservice.user.test.UserServiceControllerTest]
19:43:58.591 [main] DEBUG o.s.t.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.dox.microservice.user.test.UserServiceControllerTest]
19:43:58.668 [main] DEBUG o.s.core.env.StandardEnvironment - Adding [systemProperties] PropertySource with lowest search precedence
19:43:58.669 [main] DEBUG o.s.core.env.StandardEnvironment - Adding [systemEnvironment] PropertySource with lowest search precedence
19:43:58.669 [main] DEBUG o.s.core.env.StandardEnvironment - Initialized StandardEnvironment with PropertySources [systemProperties,systemEnvironment]
19:43:58.671 [main] DEBUG o.s.core.env.StandardEnvironment - Adding [integrationTest] PropertySource with search precedence immediately lower than [systemEnvironment]
2016-02-19 19:43:58.963  INFO 17088 --- [           main] o.a.maven.surefire.booter.ForkedBooter   : Starting ForkedBooter v2.17 on max-WS03 with PID 17088 (C:\Users\max\.m2\repository\org\apache\maven\surefire\surefire-booter\2.17\surefire-booter-2.17.jar started by max in C:\Application\sts33\maxplayarea\UserService)
2016-02-19 19:43:58.987  INFO 17088 --- [           main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@70325e14: startup date [Fri Feb 19 19:43:58 IST 2016]; root of context hierarchy
2016-02-19 19:43:59.150  INFO 17088 --- [           main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2016-02-19 19:43:59.309  INFO 17088 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'encrypt.CONFIGURATION_PROPERTIES' of type [class org.springframework.cloud.bootstrap.encrypt.KeyProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-02-19 19:43:59.309  INFO 17088 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'encryptionBootstrapConfiguration' of type [class org.springframework.cloud.bootstrap.encrypt.EncryptionBootstrapConfiguration$$EnhancerBySpringCGLIB$$af423f62] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-02-19 19:43:59.361  INFO 17088 --- [           main] o.a.maven.surefire.booter.ForkedBooter   : Started ForkedBooter in 0.62 seconds (JVM running for 1.307)

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v1.2.4.RELEASE)


Results :

Tests run: 5, Failures: 0, Errors: 0, Skipped: 0

[INFO] 
[INFO] --- maven-jar-plugin:2.5:jar (default-jar) @ user-service ---
[INFO] Building jar: C:\Application\sts33\maxplayarea\UserService\target\user-service-0.0.1-SNAPSHOT.jar
[INFO] 
[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ user-service ---
[INFO] Installing C:\Application\sts33\maxplayarea\UserService\target\user-service-0.0.1-SNAPSHOT.jar to C:\Users\max\.m2\repository\com\dox\microservice\user\user-service\0.0.1-SNAPSHOT\user-service-0.0.1-SNAPSHOT.jar
[INFO] Installing C:\Application\sts33\maxplayarea\UserService\pom.xml to C:\Users\max\.m2\repository\com\dox\microservice\user\user-service\0.0.1-SNAPSHOT\user-service-0.0.1-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 16.008s
[INFO] Finished at: Fri Feb 19 19:44:11 IST 2016
[INFO] Final Memory: 19M/336M
[INFO] ------------------------------------------------------------------------
pom.xml代码段:

   <project>
    ...   
     <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>2.2.2</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-staticdocs</artifactId>
            <version>2.2.2</version>
            <scope>test</scope>
        </dependency>

    </dependencies>

        <build>
        <defaultGoal>process-resources</defaultGoal>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.asciidoctor</groupId>
                    <artifactId>asciidoctor-maven-plugin</artifactId>
                    <version>1.5.2</version>
                    <configuration>
                        <sourceDirectory>src/docs/asciidoc</sourceDirectory>
                        <outputDirectory>target/docs/asciidoc</outputDirectory>
                        <backend>html</backend>
                        <doctype>book</doctype>
                    </configuration>
                    <executions>
                        <execution>
                            <id>output-html</id> 
                            <phase>prepare-package</phase>
                            <goals>
                                <goal>process-asciidoc</goal>
                            </goals>
                            <configuration>
                                <backend>html5</backend>
                                <sourceHighlighter>coderay</sourceHighlighter>
                             </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
            </pluginManagement>
        </build>
        <repositories>
            <repository>
                <id>spring-releases</id>
                <url>https://repo.spring.io/libs-release</url>
            </repository>
        </repositories>

    </project>
@Test
public void convertSwaggerToAsciiDoc() throws Exception {
    this.mockMvc.perform(get("/v2/api-docs?group=user")
            .accept(MediaType.APPLICATION_JSON))
            .andDo(Swagger2MarkupResultHandler.outputDirectory("src/docs/asciidoc").build())
            .andExpect(status().isOk());
}