简体   繁体   中英

Swagger : Multiple locations for API not being picked up

In my project there are different packages containing Rest APIs

e.g.
com.mypackage.rest
com.mypackage2.rest
com.mypackage3.rest

I want to document all those.

I have a maven project having swagger plugin where in locations I am trying to specify multiple locations for Rest API as following

<locations>
  com.mypackage.rest;
  com.mypackage2.rest;
  com.mypackage3.rest
</locations>

But when I do mvn clean install, it is not generating swagger json file.

PS. If I am using only one location, json file is being generated properly. Also if I try to put it as following, only last package json file is getting generated.

<locations>com</locations>

Need help!

<locations>com.mypackage.rest;com.mypackage2.rest;com.mypackage3.rest</locations> should do the trick, at least it works for me (version 3.1.x)

In the future (not yet released) the syntax will be:

<locations>
<location>com.mypackage.rest</location>
<location>com.mypackage2.rest</location>
<location>com.mypackage3.rest</location>
</locations>

See https://github.com/kongchen/swagger-maven-plugin/issues/328

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM