【问题标题】:springdoc-openapi-maven-plugin configuration isn't appliedspringdoc-openapi-maven-plugin 配置未应用
【发布时间】:2021-10-17 19:49:25
【问题描述】:

我目前正在测试 springdoc 以将其集成到其他项目中。我发现,maven 插件不应用任何配置设置,例如输出文件名 无法设置。如果我调用mvn verify,插件只会生成target/openapi.json! 我做错了什么?

该项目只有一个带有一些 openapi 注释的示例控制器。

绒球

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.5.3</version>
        <relativePath /> <!-- lookup parent from repository -->
    </parent>
    <groupId>codes.thischwa</groupId>
    <artifactId>pg</artifactId>
    <version>0.1.0-SNAPSHOT</version>
    <name>SpringBootPlayground</name>

    <properties>
        <java.version>11</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springdoc</groupId>
            <artifactId>springdoc-openapi-core</artifactId>
            <version>1.1.49</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>pre-integration-test</id>
                        <goals>
                            <goal>start</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>post-integration-test</id>
                        <goals>
                            <goal>stop</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.springdoc</groupId>
                <artifactId>springdoc-openapi-maven-plugin</artifactId>
                <version>1.3</version>
                <configuration>
                    <apiDocsUrl>http://localhost:8080/v3/api-docs</apiDocsUrl>
                    <outputfilename>api.json</outputfilename>
                    <outputdir>${basedir}</outputdir>
                </configuration>
                <executions>
                    <execution>
                        <id>integration-test</id>
                        <phase>integration-test</phase>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

这是一个错误吗?还是我的耳朵有问题?

【问题讨论】:

    标签: java spring-boot maven spring-boot-maven-plugin springdoc-openapi-maven-plugin


    【解决方案1】:

    看起来有些错别字/大小写错误

    是 outputFileName 和 outputDir。

    【讨论】:

    • 我是从博客上复制粘贴的,笨蛋。非常感谢!
    猜你喜欢
    • 2021-11-09
    • 2020-12-07
    • 2023-03-04
    • 2021-10-14
    • 2022-12-13
    • 2020-10-02
    • 2020-11-18
    • 2022-09-30
    • 2022-07-15
    相关资源
    最近更新 更多