swagger-maven-plugin自动生成(springmvc项目)

时间:2025-04-02 07:16:08
<!--增加swagger-plugin--> <plugin> <groupId></groupId> <artifactId>swagger-maven-plugin</artifactId> <version>3.1.4</version>(貌似别的版本不行,耗了挺长时间的) <configuration> <apiSources> <apiSource> <springmvc>true</springmvc> <locations> <location></location> </locations> <schemes> <scheme>http</scheme> <scheme>https</scheme> </schemes> <host>xxxx</host> <basePath>/api</basePath> <info> <title>Swagger Maven Plugin Sample</title> <version>v1</version> <description> This is a sample. </description> <termsOfService> /kongchen/swagger-maven-plugin </termsOfService> <contact> <email>xxx</email> <name>xxx</name> <url>xxx</url> </contact> <license> <url>/licenses/LICENSE-2.</url> <name>Apache 2.0</name> </license> </info> <swaggerDirectory>${basedir}/src/main/generated/swagger-ui</swaggerDirectory> </apiSource> </apiSources> </configuration> <executions> <execution> <phase>compile</phase> <goals> <goal>generate</goal> </goals> </execution> </executions> </plugin>