Skip to content

Instantly share code, notes, and snippets.

@azbarcea
Created Oct 29, 2017
Embed
What would you like to do?
Example to use swagger-maven-plugin in a multi-module java project
<build>
<plugins>
<pluginManagement>
<!-- swagger.json - generate API documentation -->
<plugin>
<groupId>com.github.kongchen</groupId>
<artifactId>swagger-maven-plugin</artifactId>
<version>${swagger-maven-plugin-version}</version>
<configuration>
<apiSources>
<apiSource>
<schemes>http,https</schemes>
<basePath>/api</basePath>
<info>
<title>${project.name}</title>
<termsOfService>Please read on https://example.com/terms-of-service</termsOfService>
<description>${project.description}. More on: http://example.com/${project.artifactId}</description>
<contact>
<name>Example LLC
</name>
<url>https://example.com</url>
<email>contact@example.com</email>
</contact>
<license>
<name>Apache License v2.0</name>
<url>https://www.apache.org/licenses/LICENSE-2.0.html</url>
</license>
<version>${project.version}</version>
</info>
<swaggerDirectory>${project.build.directory}/swagger-ui</swaggerDirectory>
<!--
Do not use: swaggerFileName, as it will be used as classifier.
In a multi-module project will have different classifier for different APIs
-->
<outputFormats>json</outputFormats>
<attachSwaggerArtifact>true</attachSwaggerArtifact>
</apiSource>
</apiSources>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment