NoClassDefFoundError在使用swagger2Markup时发生。

huangapple go评论101阅读模式
英文:

NoClassDefFoundError occurs when using the swagger2Markup

问题

**swagger2Markup maven**
```xml
<dependency>
    <groupId>io.github.swagger2markup</groupId>
    <artifactId>swagger2markup</artifactId>
    <version>1.3.1</version>
</dependency>

测试方法
当我运行这个方法时,出现了错误

    @Test
    public void generateAsciiDocs() throws Exception {
        // 输出Ascii格式
        Swagger2MarkupConfig config = new Swagger2MarkupConfigBuilder()
                .withMarkupLanguage(MarkupLanguage.ASCIIDOC)
                .withOutputLanguage(Language.ZH)
                .withPathsGroupedBy(GroupBy.TAGS)
                .withGeneratedExamples()
                .withoutInlineSchema()
                .build();

        Swagger2MarkupConverter.from(new URL("http://localhost:8088/v2/api-docs?group=api"))
                .withConfig(config)
                .build()
                .toFolder(Paths.get("src/docs/asciidoc/generated/all"));
    }

稍后运行

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/beanutils/BeanIntrospector

什么是 NoClassDefFoundError?


<details>
<summary>英文:</summary>

**swagger2Markup maven**

<dependency>
<groupId>io.github.swagger2markup</groupId>
<artifactId>swagger2markup</artifactId>
<version>1.3.1</version>
</dependency>

**test method**
When I run this method, it goes wrong
@Test
public void generateAsciiDocs() throws Exception {
    //    输出Ascii格式
    Swagger2MarkupConfig config = new Swagger2MarkupConfigBuilder()
            .withMarkupLanguage(MarkupLanguage.ASCIIDOC)
            .withOutputLanguage(Language.ZH)
            .withPathsGroupedBy(GroupBy.TAGS)
            .withGeneratedExamples()
            .withoutInlineSchema()
            .build();

    Swagger2MarkupConverter.from(new URL(&quot;http://localhost:8088/v2/api-docs?group=api&quot;))
            .withConfig(config)
            .build()
            .toFolder(Paths.get(&quot;src/docs/asciidoc/generated/all&quot;));
}
**run later**

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/beanutils/BeanIntrospector

# what the NoClassDefFoundError ???



</details>


# 答案1
**得分**: 0

因为Maven依赖于冲突。

<details>
<summary>英文:</summary>

Because maven Rely on the conflict

</details>



huangapple
  • 本文由 发表于 2020年4月3日 19:51:25
  • 转载请务必保留本文链接:https://go.coder-hub.com/61011275.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定