使用swagger生成API的json文件

时间:2025-03-18 17:08:28
<plugin> <groupId></groupId> <artifactId>swagger-maven-plugin</artifactId> <version>3.1.0</version> <configuration> <apiSources> <apiSource> <springmvc>false</springmvc> <!-- false为JAX-RS --> <locations></locations> <schemes>http,https</schemes> <host></host> <basePath>/rtprest/rest</basePath> <info> <title>RTP REST APIs</title> <version>v1</version> <description>This is a sample for swagger-maven-plugin</description> <termsOfService> /kongchen/swagger-maven-plugin </termsOfService> <contact> <email>kongchen@</email> <name>Kong Chen</name> <url></url> </contact> <license> <url>/licenses/LICENSE-2.</url> <name>Apache 2.0</name> </license> </info> <templatePath>${basedir}/src/main/resources/templates/</templatePath> <outputPath>${basedir}/src/main/resources/generated/</outputPath> <swaggerDirectory>${basedir}/src/main/resources/generated/swagger-ui</swaggerDirectory> <!-- <attachSwaggerArtifact>true</attachSwaggerArtifact> --> <!-- <jsonExampleValues>true</jsonExampleValues> --> </apiSource> </apiSources> </configuration> <executions> <execution> <phase>compile</phase> <goals> <goal>generate</goal> </goals> </execution> </executions> </plugin>