JAX-RS: Get swagger.json For Free!

JAX-RS analyzer maven plugin examines JAX-RS resources in your Java EE project and generates the swagger.json definition. There are no runtime dependencies, additional annotations or configuration required, you only have to include the plugin to your maven build and then mvn clean install your project:

				<!-- Available backends, defaults to plaintext -->
				<!-- <backend>plaintext</backend> -->

The recent release (swaggerina) of headlands ships with swagger-ui with the spec generated by the JAX-RS analyzer plugin. A drop-in WAR is also available.

Big thanks to Sebastian Daschner, an airhacks alumni, for this time-saver. I think you should star the repo: https://github.com/sdaschner/jaxrs-analyzer :-).

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting


Does SWAGGER works with subresource locator ? I tested an old version and this doesn't work ! Thank's

Posted by Yahiaoui on May 11, 2015 at 12:05 PM CEST #

But what is 'Swagger'?

Posted by javaservant on May 11, 2015 at 02:23 PM CEST #

Thanks for the great information and tip. This will make the process of documenting JAX-RS so much easier.

Posted by John Yeary on May 12, 2015 at 01:54 PM CEST #

Hi Adam, this is really great and very important for restful apis. I am also using a maven plugin which scans JaxRS annotations and generated json file describing the API in swagger spec format:


The interesting here is that you can enhance your API with javadoc tags (instead of using Swagger annotations).

I've also blogged about it here: https://rpestano.wordpress.com/2014/12/21/some-words-on-javaee-rest-and-swagger/

Posted by rmpestano on May 14, 2015 at 01:21 PM CEST #

Does JAX-RS Analyzer Maven plugin need a Java SE greater than 1.7?
Our CM is saying that JAX-RS Analyzer does not run with JAVA SE 1.7.


Posted by BN on March 14, 2016 at 07:59 PM CET #

This is a great plugin but we wanted to see if following 2 features are supported:
1. When the swagger is generated there is no description. Is there some way to generate description from java doc at every service method?

2. Would it be possible to give a list of URIs for which the swagger needs to be generated. From the plugin perspective may be give reference of external file "include-uris" and default to all URIs if not provided.

Posted by Samir Shaik on May 23, 2018 at 12:10 PM CEST #

Post a Comment:
  • HTML Syntax: NOT allowed
...the last 150 posts
...the last 10 comments