简体   繁体   English

文件不是使用 Swagger codegen 插件生成的

[英]files aren't generated using Swagger codegen plugin

I can't generate the models / controllers / services in any way, I run this command mvn clean install but it generates the files in target/generate-sources,I have used json but also yaml, How can I make this generate it for me in src/main?我无法以任何方式生成模型/控制器/服务,我运行此命令 mvn clean install 但它在目标/生成源中生成文件,我使用了 json 以及 yaml,我怎样才能让它为我在 src/main?

Here is my pom.xml, project - https://github.com/FreeTrainingZone/identityverification-repo这是我的 pom.xml,项目 - https://github.com/FreeTrainingZone/identityverification-repo

<?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.6.4</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.freetrainingzone</groupId>
    <artifactId>identityverification </artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>identityverification </name>
    <description>Identity Verification  REST API</description>
    <properties>
        <java.version>17</java.version>
        <reqjson.file>${project.basedir}/src/main/resources/identityverificationservice.json</reqjson.file>
    </properties>
    <dependencies>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-validation</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>2.0.1.Final</version>
        </dependency>

        <dependency>
            <groupId>javax.annotation</groupId>
            <artifactId>javax.annotation-api</artifactId>
            <version>1.3.2</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.13.2</version>
        </dependency>
        <dependency>
            <groupId>io.swagger.core.v3</groupId>
            <artifactId>swagger-annotations</artifactId>
            <version>2.1.13</version>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>

            <plugin>

                <groupId>io.swagger.codegen.v3</groupId>
                <artifactId>swagger-codegen-maven-plugin</artifactId>
                <version>3.0.33</version>

                <dependencies>
                    <dependency>
                        <groupId>com.github.jknack</groupId>
                        <artifactId>handlebars</artifactId>
                        <version>4.3.0</version>
                    </dependency>
                </dependencies>

                <executions>
                    <execution>
                        <id>request-service</id>
                        <!--
                        <goals>

                            <goal>generate</goal>

                        </goals>
                        -->
                        <configuration>
                            <inputSpec>${reqjson.file}</inputSpec>
                            <artifactId>contract-service</artifactId>
                            <output>${project.basedir}/target/generated-sources/swagger</output>
                            <language>spring</language>
                            <generateApis>true</generateApis>
                            <generateModels>true</generateModels>
                            <modelPackage>com.freetrainingzone.identityverification.model</modelPackage>
                            <apiPackage>com.freetrainingzone.identityverification.controller.api</apiPackage>
                            <generateSupportingFiles>false</generateSupportingFiles>
                            <configOptions>
                                <interfaceOnly>false</interfaceOnly>
                                <library>spring-boot</library>
                                <singleContentTypes>true</singleContentTypes>
                                <sourceFolder>/</sourceFolder>
                                <dateLibrary>java17</dateLibrary>
                            </configOptions>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

        </plugins>
    </build>

</project>

Modify file gradle/swagger.gradle修改文件gradle/swagger.gradle

openApiGenerate {
    outputDir = "$rootDir".toString()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 Swagger codegen 中更改生成的支持文件的包 - Change the package of generated supporting files in Swagger codegen 如何修改使用cxf-codegen插件创建的生成文件,然后进行编译? - How can I modify generated files ,created using cxf-codegen plugin and then compile? 如何使用 swagger-codegen-maven 插件在 boolean 上生成 getter - how to generate getter on boolean using swagger-codegen-maven plugin 如何使用 swagger-codegen-plugin (maven) 生成客户端代码? - How to generate client code using with swagger-codegen-plugin (maven)? 使用swagger codegen插件通过几个yaml文件生成代码 - generate code via several yaml file using swagger codegen plugin Swagger - 自定义codegen生成的单个类 - Swagger - customising a single class generated by codegen OpenAPI Generator / Swagger Codegen:如何在生成所有文件后添加函数 - OpenAPI Generator / Swagger Codegen: How to add a function after all files have been generated Swagger Codegen,Maven插件:限制服务器生成 - Swagger Codegen, Maven Plugin: Restrict Server Generation Swagger codegen 插件在 getter 上生成约束 - Swagger codegen plugin generates constraints on getters 如何使用 springdoc-openapi-maven-plugin 和 swagger-codegen-maven-plugin 生成客户端代码? - How to generate client code using springdoc-openapi-maven-plugin and swagger-codegen-maven-plugin?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM