Swagger Maven Plugin

This plugin is intended to use the Swagger Core library to generate OpenAPI documentation from a JAX-RS based REST service with as little change as possible. This allows for @SwaggerDefinition, @ReaderListener and ModelConverters to work the same way as with the core Swagger library.


The plugin is considered production ready. The version 2.x.x of the plugin is supporting generation of OpenAPI version 3 specifications using Swagger 2.x. To generate OpenAPI version 2 specifications using Swagger 1.x use the latest 1.x.x version of the plugin.

Maven Central Javadoc Build status Known Vulnerabilities


To have Swagger generate the OpenAPI specifications as part of the build add in the plugin to the POM.


This will run the generation in the prepare-package lifecycle stage of the Maven build.

Specifying Packages with JAX-RS Endpoints

The packages containing JAX-RS endpoints must be configured using the resourcePackages element. See the minimal configuration above.

Properties of Swagger model

Most general properties of the Swagger model is configurable using the swaggerConfig element. Note this may also be configured through the @OpenAPIDefinition annotation - see Customizing your auto-generated Swagger Definitions.

          <description>Endpoint URL</description>
          <email>[email protected]</email>
          <name>My Name</name>


The generated OpenAPI specifications may be installed and deployed as Maven artifact. To enable this add the configuration parameter attachSwaggerArtifact.



Thanks to Yukai Kong for his work on Swagger Maven plugin. This plugin is heavily inspired by that.