文件不是使用Swagger代码生成插件生成的

njthzxwz  于 2022-11-06  发布在  其他
关注(0)|答案(1)|浏览(167)

我不能以任何方式生成模型/控制器/服务,我运行这个命令mvn清洁安装,但它生成的文件在目标/generate-sources,我已经使用json,但也yaml,我怎么能让这个为我生成它在src/main?
下面是我的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>
guicsvcw

guicsvcw1#

修改文件gradle/swagger.gradle

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

修改文件pom.xml

<configuration>
    <output>${project.basedir}/src/main</output>

相关问题