spring-projects / spring-restdocs

Test-driven documentation for RESTful services
https://spring.io/projects/spring-restdocs
Apache License 2.0
1.16k stars 736 forks source link

Exception when building rest-notes-spring-data-rest #253

Closed AdelinGhanaem closed 8 years ago

AdelinGhanaem commented 8 years ago

When I try to build rest-notes-spring-data-rest project with mvn clean install I get FileNotFoundException

2016-06-02 14:56:18.026  INFO 47760 --- [           main] o.s.b.test.SpringBootMockServletContext  : Initializing Spring FrameworkServlet ''
2016-06-02 14:56:18.026  INFO 47760 --- [           main] o.s.t.web.servlet.TestDispatcherServlet  : FrameworkServlet '': initialization started
2016-06-02 14:56:18.028  INFO 47760 --- [           main] o.s.t.web.servlet.TestDispatcherServlet  : FrameworkServlet '': initialization completed in 2 ms
Tests run: 10, Failures: 0, Errors: 10, Skipped: 0, Time elapsed: 4.505 sec <<< FAILURE! - in com.example.notes.ApiDocumentation
tagUpdateExample(com.example.notes.ApiDocumentation)  Time elapsed: 0.276 sec  <<< ERROR!
org.springframework.restdocs.generate.RestDocumentationGenerationException: java.io.FileNotFoundException: target\generated-snippets\tag-update-example\request-fields.adoc (The system cannot find the path specified)
        at java.io.FileOutputStream.open0(Native Method)
        at java.io.FileOutputStream.open(FileOutputStream.java:270)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:162)
        at org.springframework.restdocs.snippet.StandardWriterResolver.resolve(StandardWriterResolver.java:92)
        at org.springframework.restdocs.snippet.TemplatedSnippet.document(TemplatedSnippet.java:62)
        at org.springframework.restdocs.generate.RestDocumentationGenerator.handle(RestDocumentationGenerator.java:196)
        at org.springframework.restdocs.mockmvc.RestDocumentationResultHandler.handle(RestDocumentationResultHandler.java:54)
        at org.springframework.test.web.servlet.MockMvc$1.andDo(MockMvc.java:177)
        at com.example.notes.ApiDocumentation.tagUpdateExample(ApiDocumentation.java:335)

errorExample(com.example.notes.ApiDocumentation)  Time elapsed: 0.101 sec  <<< ERROR!
org.springframework.restdocs.generate.RestDocumentationGenerationException: java.io.FileNotFoundException: target\generated-snippets\error-example\response-fields.adoc (The system cannot find the path specified)
        at java.io.FileOutputStream.open0(Native Method)
        at java.io.FileOutputStream.open(FileOutputStream.java:270)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:162)
        at org.springframework.restdocs.snippet.StandardWriterResolver.resolve(StandardWriterResolver.java:92)
        at org.springframework.restdocs.snippet.TemplatedSnippet.document(TemplatedSnippet.java:62)
        at org.springframework.restdocs.generate.RestDocumentationGenerator.handle(RestDocumentationGenerator.java:196)
        at org.springframework.restdocs.mockmvc.RestDocumentationResultHandler.handle(RestDocumentationResultHandler.java:54)
        at org.springframework.test.web.servlet.MockMvc$1.andDo(MockMvc.java:177)
        at com.example.notes.ApiDocumentation.errorExample(ApiDocumentation.java:100)

noteUpdateExample(com.example.notes.ApiDocumentation)  Time elapsed: 0.054 sec  <<< ERROR!
org.springframework.restdocs.generate.RestDocumentationGenerationException: java.io.FileNotFoundException: target\generated-snippets\note-update-example\request-fields.adoc (The system cannot find the path specified)
        at java.io.FileOutputStream.open0(Native Method)
        at java.io.FileOutputStream.open(FileOutputStream.java:270)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:162)
        at org.springframework.restdocs.snippet.StandardWriterResolver.resolve(StandardWriterResolver.java:92)
        at org.springframework.restdocs.snippet.TemplatedSnippet.document(TemplatedSnippet.java:62)
        at org.springframework.restdocs.generate.RestDocumentationGenerator.handle(RestDocumentationGenerator.java:196)
        at org.springframework.restdocs.mockmvc.RestDocumentationResultHandler.handle(RestDocumentationResultHandler.java:54)
        at org.springframework.test.web.servlet.MockMvc$1.andDo(MockMvc.java:177)
        at com.example.notes.ApiDocumentation.noteUpdateExample(ApiDocumentation.java:284)

indexExample(com.example.notes.ApiDocumentation)  Time elapsed: 0.011 sec  <<< ERROR!
org.springframework.restdocs.generate.RestDocumentationGenerationException: java.io.FileNotFoundException: target\generated-snippets\index-example\links.adoc (The system cannot find the path specified)
        at java.io.FileOutputStream.open0(Native Method)
        at java.io.FileOutputStream.open(FileOutputStream.java:270)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:162)
        at org.springframework.restdocs.snippet.StandardWriterResolver.resolve(StandardWriterResolver.java:92)
        at org.springframework.restdocs.snippet.TemplatedSnippet.document(TemplatedSnippet.java:62)
        at org.springframework.restdocs.generate.RestDocumentationGenerator.handle(RestDocumentationGenerator.java:196)
        at org.springframework.restdocs.mockmvc.RestDocumentationResultHandler.handle(RestDocumentationResultHandler.java:54)
        at org.springframework.test.web.servlet.MockMvc$1.andDo(MockMvc.java:177)
        at com.example.notes.ApiDocumentation.indexExample(ApiDocumentation.java:113)

tagsListExample(com.example.notes.ApiDocumentation)  Time elapsed: 0.135 sec  <<< ERROR!
org.springframework.restdocs.generate.RestDocumentationGenerationException: java.io.FileNotFoundException: target\generated-snippets\tags-list-example\links.adoc (The system cannot find the path specified)
        at java.io.FileOutputStream.open0(Native Method)
        at java.io.FileOutputStream.open(FileOutputStream.java:270)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:162)
        at org.springframework.restdocs.snippet.StandardWriterResolver.resolve(StandardWriterResolver.java:92)
        at org.springframework.restdocs.snippet.TemplatedSnippet.document(TemplatedSnippet.java:62)
        at org.springframework.restdocs.generate.RestDocumentationGenerator.handle(RestDocumentationGenerator.java:196)
        at org.springframework.restdocs.mockmvc.RestDocumentationResultHandler.handle(RestDocumentationResultHandler.java:54)
        at org.springframework.test.web.servlet.MockMvc$1.andDo(MockMvc.java:177)
        at com.example.notes.ApiDocumentation.tagsListExample(ApiDocumentation.java:225)

notesListExample(com.example.notes.ApiDocumentation)  Time elapsed: 0.041 sec  <<< ERROR!
org.springframework.restdocs.generate.RestDocumentationGenerationException: java.io.FileNotFoundException: target\generated-snippets\notes-list-example\links.adoc (The system cannot find the path specified)
        at java.io.FileOutputStream.open0(Native Method)
        at java.io.FileOutputStream.open(FileOutputStream.java:270)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:162)
        at org.springframework.restdocs.snippet.StandardWriterResolver.resolve(StandardWriterResolver.java:92)
        at org.springframework.restdocs.snippet.TemplatedSnippet.document(TemplatedSnippet.java:62)
        at org.springframework.restdocs.generate.RestDocumentationGenerator.handle(RestDocumentationGenerator.java:196)
        at org.springframework.restdocs.mockmvc.RestDocumentationResultHandler.handle(RestDocumentationResultHandler.java:54)
        at org.springframework.test.web.servlet.MockMvc$1.andDo(MockMvc.java:177)
        at com.example.notes.ApiDocumentation.notesListExample(ApiDocumentation.java:135)

notesCreateExample(com.example.notes.ApiDocumentation)  Time elapsed: 0.016 sec  <<< ERROR!
org.springframework.restdocs.generate.RestDocumentationGenerationException: java.io.FileNotFoundException: target\generated-snippets\notes-create-example\request-fields.adoc (The system cannot find the path specified)
        at java.io.FileOutputStream.open0(Native Method)
        at java.io.FileOutputStream.open(FileOutputStream.java:270)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:162)
        at org.springframework.restdocs.snippet.StandardWriterResolver.resolve(StandardWriterResolver.java:92)
        at org.springframework.restdocs.snippet.TemplatedSnippet.document(TemplatedSnippet.java:62)
        at org.springframework.restdocs.generate.RestDocumentationGenerator.handle(RestDocumentationGenerator.java:196)
        at org.springframework.restdocs.mockmvc.RestDocumentationResultHandler.handle(RestDocumentationResultHandler.java:54)
        at org.springframework.test.web.servlet.MockMvc$1.andDo(MockMvc.java:177)
        at com.example.notes.ApiDocumentation.notesCreateExample(ApiDocumentation.java:165)

tagsCreateExample(com.example.notes.ApiDocumentation)  Time elapsed: 0.014 sec  <<< ERROR!
org.springframework.restdocs.generate.RestDocumentationGenerationException: java.io.FileNotFoundException: target\generated-snippets\tags-create-example\request-fields.adoc (The system cannot find the path specified)
        at java.io.FileOutputStream.open0(Native Method)
        at java.io.FileOutputStream.open(FileOutputStream.java:270)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:162)
        at org.springframework.restdocs.snippet.StandardWriterResolver.resolve(StandardWriterResolver.java:92)
        at org.springframework.restdocs.snippet.TemplatedSnippet.document(TemplatedSnippet.java:62)
        at org.springframework.restdocs.generate.RestDocumentationGenerator.handle(RestDocumentationGenerator.java:196)
        at org.springframework.restdocs.mockmvc.RestDocumentationResultHandler.handle(RestDocumentationResultHandler.java:54)
        at org.springframework.test.web.servlet.MockMvc$1.andDo(MockMvc.java:177)
        at com.example.notes.ApiDocumentation.tagsCreateExample(ApiDocumentation.java:243)

noteGetExample(com.example.notes.ApiDocumentation)  Time elapsed: 0.039 sec  <<< ERROR!
org.springframework.restdocs.generate.RestDocumentationGenerationException: java.io.FileNotFoundException: target\generated-snippets\note-get-example\links.adoc (The system cannot find the path specified)
        at java.io.FileOutputStream.open0(Native Method)
        at java.io.FileOutputStream.open(FileOutputStream.java:270)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:162)
        at org.springframework.restdocs.snippet.StandardWriterResolver.resolve(StandardWriterResolver.java:92)
        at org.springframework.restdocs.snippet.TemplatedSnippet.document(TemplatedSnippet.java:62)
        at org.springframework.restdocs.generate.RestDocumentationGenerator.handle(RestDocumentationGenerator.java:196)
        at org.springframework.restdocs.mockmvc.RestDocumentationResultHandler.handle(RestDocumentationResultHandler.java:54)
        at org.springframework.test.web.servlet.MockMvc$1.andDo(MockMvc.java:177)
        at com.example.notes.ApiDocumentation.noteGetExample(ApiDocumentation.java:203)

tagGetExample(com.example.notes.ApiDocumentation)  Time elapsed: 0.006 sec  <<< ERROR!
org.springframework.restdocs.generate.RestDocumentationGenerationException: java.io.FileNotFoundException: target\generated-snippets\tag-get-example\links.adoc (The system cannot find the path specified)
        at java.io.FileOutputStream.open0(Native Method)
        at java.io.FileOutputStream.open(FileOutputStream.java:270)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:162)
        at org.springframework.restdocs.snippet.StandardWriterResolver.resolve(StandardWriterResolver.java:92)
        at org.springframework.restdocs.snippet.TemplatedSnippet.document(TemplatedSnippet.java:62)
        at org.springframework.restdocs.generate.RestDocumentationGenerator.handle(RestDocumentationGenerator.java:196)
        at org.springframework.restdocs.mockmvc.RestDocumentationResultHandler.handle(RestDocumentationResultHandler.java:54)
        at org.springframework.test.web.servlet.MockMvc$1.andDo(MockMvc.java:177)
        at com.example.notes.ApiDocumentation.tagGetExample(ApiDocumentation.java:306)

Running com.example.notes.GettingStartedDocumentation
2016-06-02 14:56:18.040  INFO 47760 --- [           main] o.s.t.c.support.AbstractContextLoader    : Could not detect default resource locations for test class [com.example.notes.GettingStartedDocumentation]: no resource found for suffixes {-context.xml, Context.groovy}.
2016-06-02 14:56:18.043  INFO 47760 --- [           main] o.s.t.c.web.WebTestContextBootstrapper   : Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener]
2016-06-02 14:56:18.043  INFO 47760 --- [           main] o.s.t.c.web.WebTestContextBootstrapper   : Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@2c15034f, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@43b4ec0c, org.springframework.test.context.support.DependencyInjectionTestExecutionListener@148b6f95, org.springframework.test.context.support.DirtiesContextTestExecutionListener@5ee581db, org.springframework.test.context.transaction.TransactionalTestExecutionListener@5a6efe33, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@3e5ebdfe]
2016-06-02 14:56:18.089  INFO 47760 --- [           main] o.s.b.test.SpringBootMockServletContext  : Initializing Spring FrameworkServlet ''
2016-06-02 14:56:18.090  INFO 47760 --- [           main] o.s.t.web.servlet.TestDispatcherServlet  : FrameworkServlet '': initialization started
2016-06-02 14:56:18.092  INFO 47760 --- [           main] o.s.t.web.servlet.TestDispatcherServlet  : FrameworkServlet '': initialization completed in 2 ms
2016-06-02 14:56:18.097  INFO 47760 --- [           main] o.s.b.test.SpringBootMockServletContext  : Initializing Spring FrameworkServlet ''
2016-06-02 14:56:18.097  INFO 47760 --- [           main] o.s.t.web.servlet.TestDispatcherServlet  : FrameworkServlet '': initialization started
2016-06-02 14:56:18.099  INFO 47760 --- [           main] o.s.t.web.servlet.TestDispatcherServlet  : FrameworkServlet '': initialization completed in 2 ms
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.012 sec <<< FAILURE! - in com.example.notes.GettingStartedDocumentation
index(com.example.notes.GettingStartedDocumentation)  Time elapsed: 0.002 sec  <<< ERROR!
org.springframework.restdocs.generate.RestDocumentationGenerationException: java.io.FileNotFoundException: target\generated-snippets\index\1\curl-request.adoc (The system cannot find the path specified)
        at java.io.FileOutputStream.open0(Native Method)
        at java.io.FileOutputStream.open(FileOutputStream.java:270)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:162)
        at org.springframework.restdocs.snippet.StandardWriterResolver.resolve(StandardWriterResolver.java:92)
        at org.springframework.restdocs.snippet.TemplatedSnippet.document(TemplatedSnippet.java:62)
        at org.springframework.restdocs.generate.RestDocumentationGenerator.handle(RestDocumentationGenerator.java:196)
        at org.springframework.restdocs.mockmvc.RestDocumentationResultHandler.handle(RestDocumentationResultHandler.java:54)
        at org.springframework.test.web.servlet.MockMvc.applyDefaultResultActions(MockMvc.java:195)
        at org.springframework.test.web.servlet.MockMvc.perform(MockMvc.java:163)
        at com.example.notes.GettingStartedDocumentation.index(GettingStartedDocumentation.java:81)

creatingANote(com.example.notes.GettingStartedDocumentation)  Time elapsed: 0.002 sec  <<< ERROR!
org.springframework.restdocs.generate.RestDocumentationGenerationException: java.io.FileNotFoundException: target\generated-snippets\creating-a-note\1\curl-request.adoc (The system cannot find the path specified)
        at java.io.FileOutputStream.open0(Native Method)
        at java.io.FileOutputStream.open(FileOutputStream.java:270)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:162)
        at org.springframework.restdocs.snippet.StandardWriterResolver.resolve(StandardWriterResolver.java:92)
        at org.springframework.restdocs.snippet.TemplatedSnippet.document(TemplatedSnippet.java:62)
        at org.springframework.restdocs.generate.RestDocumentationGenerator.handle(RestDocumentationGenerator.java:196)
        at org.springframework.restdocs.mockmvc.RestDocumentationResultHandler.handle(RestDocumentationResultHandler.java:54)
        at org.springframework.test.web.servlet.MockMvc.applyDefaultResultActions(MockMvc.java:195)
        at org.springframework.test.web.servlet.MockMvc.perform(MockMvc.java:163)
        at com.example.notes.GettingStartedDocumentation.createNote(GettingStartedDocumentation.java:109)
        at com.example.notes.GettingStartedDocumentation.creatingANote(GettingStartedDocumentation.java:89)

2016-06-02 14:56:18.108  INFO 47760 --- [       Thread-2] o.s.w.c.s.GenericWebApplicationContext   : Closing org.springframework.web.context.support.GenericWebApplicationContext@692f203f: startup date [Thu Jun 02 14:56:13 EEST 2016]; root of context hierarchy
2016-06-02 14:56:18.111  INFO 47760 --- [       Thread-2] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2016-06-02 14:56:18.112  INFO 47760 --- [       Thread-2] org.hibernate.tool.hbm2ddl.SchemaExport  : HHH000227: Running hbm2ddl schema export
2016-06-02 14:56:18.115  INFO 47760 --- [       Thread-2] org.hibernate.tool.hbm2ddl.SchemaExport  : HHH000230: Schema export complete

Results :

Tests in error:
  ApiDocumentation.errorExample:100 ? RestDocumentationGeneration java.io.FileNo...
  ApiDocumentation.indexExample:113 ? RestDocumentationGeneration java.io.FileNo...
  ApiDocumentation.noteGetExample:203 ? RestDocumentationGeneration java.io.File...
  ApiDocumentation.noteUpdateExample:284 ? RestDocumentationGeneration java.io.F...
  ApiDocumentation.notesCreateExample:165 ? RestDocumentationGeneration java.io....
  ApiDocumentation.notesListExample:135 ? RestDocumentationGeneration java.io.Fi...
  ApiDocumentation.tagGetExample:306 ? RestDocumentationGeneration java.io.FileN...
  ApiDocumentation.tagUpdateExample:335 ? RestDocumentationGeneration java.io.Fi...
  ApiDocumentation.tagsCreateExample:243 ? RestDocumentationGeneration java.io.F...
  ApiDocumentation.tagsListExample:225 ? RestDocumentationGeneration java.io.Fil...
  GettingStartedDocumentation.creatingANote:89->createNote:109 ? RestDocumentationGeneration
  GettingStartedDocumentation.index:81 ? RestDocumentationGeneration java.io.Fil...

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

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.392 s
[INFO] Finished at: 2016-06-02T14:56:18+03:00
[INFO] Final Memory: 28M/275M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test (default-test) on project rest-notes-spring-data-rest: There are test failures.
[ERROR]
[ERROR] Please refer to C:\Code\foo\spring-restdocs\samples\rest-notes-spring-data-rest\target\surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

[‎02-‎Jun-‎16 3:03 PM] java -version java version "1.8.0_91" Java(TM) SE Runtime Environment (build 1.8.0_91-b14) Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode) mvn -version C:\ Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T18:41:47+02:00) Maven home: C:\Tools\apache-maven-3.3.9\bin.. Java version: 1.8.0_77, vendor: Oracle Corporation Java home: <C:\Program Files\Java\jdk1.8.0_77\jre> Default locale: en_US, platform encoding: Cp1251 OS name: "windows 10", version: "10.0", arch: "amd64", family: "dos"

AdelinGhanaem commented 8 years ago

The problem was in windows terminal ... some registers was changed so when open a new terminal the file path is C:> not C:\User>