nerdErg / swagger4jaxrs

This is a Grails plugin that adds Swagger support to document REST APIs of any Grails projects that use the Grails JAX-RS (JSR 311) plugin.
Apache License 2.0
10 stars 10 forks source link

Updated BuildConfig to promote compatibility. #13

Closed aaron-brown closed 10 years ago

aaron-brown commented 10 years ago

Since I develop in 2.1.1 for now, I've modified the BuildConfig so that it does a few nifty things:

  1. It sets up spock correctly based on Grails version, at least for 2.0/2.1 and 2.2 .
  2. I've disabled the export of the dependency on spock resources, as that was causing major problems and should not be included in applications anyway; that is only for the plugin and should remain only in the plugin.
  3. I've disabled the export of jaxrs. While I understand that may make it convenient, I feel that it is more appropriate to allow the application to specify what version of JaxRS is it is using. Since I am running 2.1.1, JaxRS 0.9 is my compatible version. Otherwise, I would have to specifically export jaxrs from this plugin's transitive dependencies, just to include my version; this is not good plugin practice.
aruizca commented 10 years ago

Hi Aaron!!

Thank you very much for your contribution. Sorry I did not reply earlier but I was busy having my first child :-)

I will have a quick look and merge as soon as I can.

Cheers mate!

aaron-brown commented 10 years ago

No prob, Congrats.

I will have another separate PR shortly that will make that bean automatically wired, so that users only have to set up the information in the grails-app/conf/Config.groovy file.

Also, if you are not keen on disabling the JaxRS export, there are two options:

  1. Put a dependsOn field in the Swagger4jaxrsGrailsPlugin, which I am going to do in the next PR, that looks like so:
dependsOn = [
    jaxrs: "0.8 > *"
]
  1. Use the regex-solution for configuring the spock plugin to also export the appropriate JaxRS version based on Grails version.
aaron-brown commented 10 years ago

Mentioned pull request is #14.

aruizca commented 10 years ago

Hi Aaron, regarding the point 3 of your pull request, I understand that you can always override the version of jax-rs in your host application anyway, and the jax-rs plugin is a mandatory dependency. So I will just upgrade the jax-rs version requirement to >= 0.9 but leaving clear in the doco that you should explicitly include in your host app BuildConfig.groovy the jax-rs version 0.10 dependency declaration if you are using Grails 2.3.x