Skip to content

Instantly share code, notes, and snippets.

@azbarcea
Created October 29, 2017 19:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save azbarcea/05b55f0e660d1b4d335479cb602deb48 to your computer and use it in GitHub Desktop.
Save azbarcea/05b55f0e660d1b4d335479cb602deb48 to your computer and use it in GitHub Desktop.
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