0

I followed the testng sample of spring-restdocs 1.1.0.BUILD-SNAPSHOT. I am able to generate the adoc file through gradle. But when I am using the maven its not generating the doc files.

Mmy pom.xml has the following details:

<dependency> 
    <groupId>org.springframework.restdocs</groupId>
    <artifactId>spring-restdocs-mockmvc</artifactId>
    <version>1.1.0.BUILD-SNAPSHOT</version>
    <scope>test</scope>
</dependency>
<plugin> 
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <configuration>
        <includes>
            <include>**/*TestNgApplicationTests.java</include>
        </includes>
    </configuration>
</plugin>
<plugin> 
    <groupId>org.asciidoctor</groupId>
    <artifactId>asciidoctor-maven-plugin</artifactId>
    <version>1.5.2.1</version>
    <executions>
        <execution>
            <id>generate-docs</id>
            <phase>prepare-package</phase> 
            <goals>
                <goal>process-asciidoc</goal>
            </goals>
            <configuration>
                <backend>html</backend>
                <doctype>book</doctype>
                <attributes>
                    <snippets>${snippetsDirectory}</snippets> 
                </attributes>
            </configuration>
        </execution>
    </executions>
</plugin>
<plugin>
    <artifactId>maven-resources-plugin</artifactId>
    <executions>
        <execution>
            <id>copy-resources</id>
            <phase>prepare-package</phase>
            <goals>
                <goal>copy-resources</goal>
            </goals>
            <configuration>
                <outputDirectory>${project.build.directory}/classes/static/docs</outputDirectory>
                <resources>
                    <resource>
                        <directory>${project.build.directory}/generated-docs</directory>
                    </resource>
                </resources>
            </configuration>
        </execution>
    </executions>
</plugin>
Thomas Bormans
  • 5,156
  • 6
  • 34
  • 51
  • Where are your `.adoc` files located? The Maven Asciidoctor plugin uses a different default location to the Gradle Asciidoctor plugin – Andy Wilkinson Mar 04 '16 at 11:50

1 Answers1

2

Try to run using this command from your terminal:

$> mvn package
  • The generated files should be under /target.
    • generated snippets should be under /target/generated-snippets.
    • generated .html should be under /target/generated-docs.

Make sure you have your generated-snippets directory configured to /target directory on your test class:

@Rule
public RestDocumentation restDocumentation = 
    new RestDocumentation("target/generated-snippets");
inafalcao
  • 1,415
  • 1
  • 11
  • 25
  • Thanks , previously I was running with TestNG test cases which are not generating the docs , but with the latest restdocs versions its able to generate the docs – Prasanta Mohanty Apr 28 '16 at 14:54