swagger导出API文档出现空指针异常

 swagger导出API文档,执行命令:

mvn swagger2markup:convertSwagger2markup -e

 出现空指针异常,异常信息如下:


ERROR org.apache.maven.cli.MavenCli - Failed to execute goal io.github.swagger2markup:swagger2markup-maven-plugin:1.3.7:convertSwagger2markup (default-cli) on project healthy-customer-service: Failed to execute goal 'convertS
wagger2markup': NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal io.github.swagger2markup:swagger2markup-maven-plugin:1.3.7:convertSwagger2markup (default-cli) on project healthy-customer-service: Failed to execute goa
l 'convertSwagger2markup'
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
        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:116)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
        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:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoFailureException: Failed to execute goal 'convertSwagger2markup'
        at io.github.swagger2markup.Swagger2MarkupMojo.execute(Swagger2MarkupMojo.java:92)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
        ... 20 more
Caused by: java.lang.NullPointerException
        at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:770)
        at com.google.common.collect.NaturalOrdering.compare(NaturalOrdering.java:35)
        at com.google.common.collect.NaturalOrdering.compare(NaturalOrdering.java:25)
        at com.google.common.collect.ByFunctionOrdering.compare(ByFunctionOrdering.java:43)
        at com.google.common.collect.CompoundOrdering.compare(CompoundOrdering.java:41)
        at java.util.TimSort.countRunAndMakeAscending(TimSort.java:355)
        at java.util.TimSort.sort(TimSort.java:220)
        at java.util.Arrays.sort(Arrays.java:1512)
        at java.util.ArrayList.sort(ArrayList.java:1454)
        at io.github.swagger2markup.internal.component.ParameterTableComponent.apply(ParameterTableComponent.java:67)
        at io.github.swagger2markup.internal.component.PathOperationComponent.buildParametersSection(PathOperationComponent.java:198)
        at io.github.swagger2markup.internal.component.PathOperationComponent.apply(PathOperationComponent.java:100)
        at io.github.swagger2markup.internal.document.PathsDocument.applyPathOperationComponent(PathsDocument.java:223)
        at io.github.swagger2markup.internal.document.PathsDocument.buildOperation(PathsDocument.java:207)
        at io.github.swagger2markup.internal.document.PathsDocument.lambda$null$1(PathsDocument.java:133)
        at java.lang.Iterable.forEach(Iterable.java:75)
        at io.github.swagger2markup.internal.document.PathsDocument.lambda$buildsPathsSection$2(PathsDocument.java:133)
        at java.util.TreeMap.forEach(TreeMap.java:1005)
        at io.github.swagger2markup.internal.document.PathsDocument.buildsPathsSection(PathsDocument.java:127)
        at io.github.swagger2markup.internal.document.PathsDocument.apply(PathsDocument.java:103)
        at io.github.swagger2markup.Swagger2MarkupConverter.applyPathsDocument(Swagger2MarkupConverter.java:197)
        at io.github.swagger2markup.Swagger2MarkupConverter.toFile(Swagger2MarkupConverter.java:240)
        at io.github.swagger2markup.Swagger2MarkupMojo.swaggerToMarkup(Swagger2MarkupMojo.java:123)
        at io.github.swagger2markup.Swagger2MarkupMojo.execute(Swagger2MarkupMojo.java:89)
        ... 22 more
[main] ERROR org.apache.maven.cli.MavenCli -
[main] ERROR org.apache.maven.cli.MavenCli - Re-run Maven using the -X switch to enable full debug logging.
[main] ERROR org.apache.maven.cli.MavenCli -
[main] ERROR org.apache.maven.cli.MavenCli - For more information about the errors and possible solutions, please read the following articles:
[main] ERROR org.apache.maven.cli.MavenCli - [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

原因是注解 ApiImplicitParam中name为空,把name值填充后,导出成功!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值