Created
October 29, 2017 19:07
-
-
Save azbarcea/05b55f0e660d1b4d335479cb602deb48 to your computer and use it in GitHub Desktop.
Example to use swagger-maven-plugin in a multi-module java project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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>[email protected]</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