Swagger2Markup / spring-swagger2markup-demo

A demo project template using Swagger2Markup, Spring Boot, Springfox and spring-restdocs
397 stars 259 forks source link

PDF not generated - Maven #7

Closed pitou35 closed 8 years ago

pitou35 commented 8 years ago

Hello,

I'm trying to generate html5 and PDF with maven package ascii......in your own project That's ok with html, curl but maven can't continu with outputpdf. I have this:

[INFO] --- asciidoctor-maven-plugin:1.5.3:process-asciidoc (output-html) @ spring-swagger2markup-demo --- io/console not supported; tty will not be manipulated [INFO] Rendered D:\spring-swagger2markup-demo-master\src\docs\asciidoc\index.adoc [INFO] [INFO] --- asciidoctor-maven-plugin:1.5.3:process-asciidoc (output-pdf) @ spring-swagger2markup-demo --- io/console not supported; tty will not be manipulated [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 20.175s [INFO] Finished at: Fri Jun 17 10:18:57 GMT+01:00 2016 [INFO] Final Memory: 45M/312M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.asciidoctor:asciidoctor-maven-plugin:1.5.3:process-asciidoc (output-pdf) on project spring-swagger2markup-demo: Execution output-pdf of goal org.asciidoctor:asciidoctor-maven-plugin:1.5.3:process-asciidoc failed: (Errno::ENOENT) C:/Users/ptotaro/.m2/repository/org/asciidoctor/asciidoctorj-pdf/1.5.0-alpha.10.1/asciidoctorj-pdf-1.5.0-alpha.10.1.jar!D:/gems/addressable-2.3.8/data/unicode.data -> [Help 1] [ERROR]

I saw that it can come from a version problem with asciidoctor-J do you have an idea ? thx

RobWin commented 8 years ago

Hi, Please have a look at https://github.com/Swagger2Markup/swagger2markup-maven-project-template/blob/master/pom.xml

pitou35 commented 8 years ago

thx for your answer, but I try to understand how it works because I have a Springboot project using springfox, so can I use this maven template to generate Resources parts in PDF file ?

RobWin commented 8 years ago

Sry. What I mean is that this pom.xml already includes the fix that the PDF generation works.

If you use and like Swagger2markup, we would love to get your GitHub Stars.

pitou35 commented 8 years ago

thx a lot

pitou35 commented 8 years ago

Hello again,

do you know this error ?

[ERROR] Failed to execute goal io.github.swagger2markup:swagger2markup-maven-plugin:1.0.0:convertSwagger2markup (default) on project Orchestrator: Failed to execute goal 'convertSwagger2markup': text must not be blank -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal io.github.swagger2markup:swagger2markup-maven-plugin:1.0.0:convertSwagger2markup (default) on project Orchestrator: Failed to execute goal 'convertSwagger2markup' at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196) at org.apache.maven.cli.MavenCli.main(MavenCli.java:141) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352) at org.codehaus.classworlds.Launcher.main(Launcher.java:47) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144) Caused by: org.apache.maven.plugin.MojoFailureException: Failed to execute goal 'convertSwagger2markup' at io.github.swagger2markup.Swagger2MarkupMojo.execute(Swagger2MarkupMojo.java:74) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209) ... 25 more Caused by: java.lang.IllegalArgumentException: text must not be blank at org.apache.commons.lang3.Validate.notBlank(Validate.java:451) at io.github.swagger2markup.markup.builder.internal.asciidoc.AsciiDocBuilder.paragraph(AsciiDocBuilder.java:91) at io.github.swagger2markup.internal.document.builder.OverviewDocumentBuilder.buildContactInfoSection(OverviewDocumentBuilder.java:127) at io.github.swagger2markup.internal.document.builder.OverviewDocumentBuilder.build(OverviewDocumentBuilder.java:88) at io.github.swagger2markup.Swagger2MarkupConverter.toFolder(Swagger2MarkupConverter.java:174) at io.github.swagger2markup.Swagger2MarkupMojo.execute(Swagger2MarkupMojo.java:69) ... 27 more

THX a lot

RobWin commented 8 years ago

There seems to be a contact field in your Swagger spec which must not be empty.

io.github.swagger2markup.markup.builder.internal.asciidoc.AsciiDocBuilder.paragraph(AsciiDocBuilder.java:91) at io.github.swagger2markup.internal.document.builder.OverviewDocumentBuilder.buildContactInfoSection(OverviewDocumentBuilder.java:127) at

pitou35 commented 8 years ago

what kind of contact field ?

in your test class ?

public class SwaggerConfig {

@Bean
public Docket restApi() {
    return new Docket(DocumentationType.SWAGGER_2)
            .apiInfo(apiInfo())
            .select()
            .paths(Predicates.and(ant("/**"), Predicates.not(ant("/error")), Predicates.not(ant("/management/**")), Predicates.not(ant("/management*"))))
            .build();
}

private ApiInfo apiInfo() {
    return new ApiInfoBuilder()
            .title("Swagger Petstore")
            .description("Petstore API Description")
            .contact(new Contact("TestName", "http:/test-url.com", "test@test.de"))
            .license("Apache 2.0")
            .licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html")
            .version("1.0.0")
            .build();
}
pitou35 commented 8 years ago

or is that a problem with dependency ?

the only I changed compared to your pom.xml is this:

io.springfox springfox-swagger2 2.4.0
pitou35 commented 8 years ago

1

pitou35 commented 8 years ago

Oh, I got it

now it works, it wasn't the good place

Thx, that's a great tool

RobWin commented 8 years ago

What what was the reason?

pitou35 commented 8 years ago

my new docket... was empty. By comment the test<, I didn't notice that the generation pointed on my own apiinfo and not yours.

just an idiot mistake