我正在使用swagger-codegen-maven-plugin 2.4.7版本来生成项目。它生成maven-jar-plugin2.6版本,但我需要3.1.2版本。
有没有一种方法来生成自定义插件版本?
生成的pom.xml:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>2.6</version> <executions> <execution> <goals> <goal>jar</goal> <goal>test-jar</goal> </goals> </execution> </executions> <configuration> </configuration> </plugin>
通缉pom.xml:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>3.1.2</version> <executions> <execution> <goals> <goal>test-jar</goal> </goals> </execution> </executions> <configuration> </configuration> </plugin>
发布于 2019-07-16 13:06:24
Swagger的输出是基于胡子模板。例如,Java + jersey2库的pom.xml模板可在这里获得:
Swagger允许您使用自定义模板覆盖内置模板。您可以这样做:
codegen-templates)。pom.mustache模板从此链接下载到该文件夹。
https://github.com/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen/src/main/resources/Java/libraries/jersey2/pom.mustachepom.mustache并根据需要更新maven-jar-plugin版本和配置。pom.xml中,在<templateDirectory>参数中指定codegen-templates文件夹的路径:
io.swagger swagger-codegen-maven-plugin 2.4.7生成https://petstore.swagger.io/v2/swagger.yaml java jersey2 ${project.basedir}/codegen-模板现在Swagger将根据您的自定义pom.xml模板生成pom.mustache。
https://stackoverflow.com/questions/57054071
复制相似问题