swagger codegen maven插件最佳实践

swagger codegen maven插件最佳实践,maven,swagger-codegen,Maven,Swagger Codegen,我正在pom中使用swagger codegen maven插件生成一个客户端。以下是我的插件信息: <plugins> <plugin> <groupId>io.swagger</groupId> <artifactId>swagger-codegen-maven-plugin</artifactId> <version>2.4.9</version

我正在pom中使用swagger codegen maven插件生成一个客户端。以下是我的插件信息:

<plugins>
    <plugin>
        <groupId>io.swagger</groupId>
        <artifactId>swagger-codegen-maven-plugin</artifactId>
        <version>2.4.9</version>
        <executions>
            <execution>
                <goals>
                    <goal>generate</goal>
                </goals>
                <configuration>
                    <inputSpec>${project.basedir}/src/main/resources/api.json</inputSpec>
                    <language>java</language>
                </configuration>
            </execution>
        </executions>
    </plugin>
</plugins>

昂首阔步
swagger codegen maven插件
2.4.9
生成
${project.basedir}/src/main/resources/api.json
JAVA
使用:

java版本“1.8.0_221”

ApacheMaven 3.6.1

我在运行mvn compile时出现了很多错误,因为在我的repo中找不到包名

[错误] //目标/生成的源代码/swagger/src/main/java/io/swagger/client/model/.java:[18,23] 包com.google.gson不存在

为了克服错误并实现成功的mvn编译,我必须在pom的依赖项中命名缺少的包,例如

<dependencies>
    <dependency>
        <groupId>io.gsonfire</groupId>
        <artifactId>gson-fire</artifactId>
        <version>1.0.0</version>
    </dependency>
</dependencies>

io.gsonfire
格森火灾
1.0.0
我不认为这是最佳实践,因为我必须自己指定版本,而不知道源代码使用的实际版本

我的问题是,当存在无法通过swagger codegen插件解决的包时,使用maven生成客户机的最佳实践是什么?或者,请告知我发现的解决问题的解决方案是否是这种情况下的最佳实践

谢谢。

有关详细信息,请参阅此。截至2019年12月31日,尚未修复。我今天无法使用Gradle和Swagger Codegen版本,而不需要传输或添加一些缺少的依赖项。有关更多详细信息,请参阅此。截至2019年12月31日,尚未修复。我今天无法使用Gradle和Swagger Codegen版本,而不需要转移或添加一些缺少的依赖项。