Questions about 'provided' scope and dependency 'excludes' when using Grails plugins

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Questions about 'provided' scope and dependency 'excludes' when using Grails plugins

Benjamin Wolff
Hi,

I have observed a behaviour in my project and would like to ask if someone can confirm this behaviour?

Regarding the 'provided' scope of dependencies in a Grails plugin, it seems that this scope is not provided from a plugin to the main app that uses the plugin, correct?

Example:

BuildConfig.groovy of a plugin:
dependencies {
    provided 'x.y:bla:1.0'
}

plugins {
    provided 'x.y:blubb:1.0'
}

So in the application that uses the plugin, these two dependencies would not appear? The Maven docs about provided also state that it's not inherited.

The other question is about the 'excludes' statement for dependency declarations (plugins and dependencies block). Say I declare a dependency to a Grails plugin and to a regular dependency in the BuildConfig.groovy of my application like this:
plugins {
    compile(x.y:bla:1.0') { // 'bla' is a Grails plugin here
        excludes 'some-dep'
    }
}

It looks like this exclude only causes other 'plugin' dependencies to be excluded, and not dependencies that are declared in the 'dependencies' block of the plugin's BuildConfig.groovy. Is that actually the intended behaviour?

I hope I made myself clear enough, don't hesitate to ask for more information. As I mentioned, this is the behaviour I observed, I just want to make sure it's the intended behaviour and I'm not experiencing some dependency-hades anonamlies.

Thanks!

Cheers,
Ben
Cheers,
Ben
Reply | Threaded
Open this post in threaded view
|

Re: Questions about 'provided' scope and dependency 'excludes' when using Grails plugins

sergiomichels
Use the scope "provided" when in some way the application or plugin that use your plugin will provide the dependency. In another words, your plugin will not export this dependencies. This is the case when you need some dependency to run your plugin but don't want to tight to a specific version.

"Excludes" should work with the plugins and dependencies block too. Maybe you're confused by your first problem? Normally I need to use excludes when two plugins need different versions of the same dependency.
 

--
Sérgio Michels


On Thu, Jul 4, 2013 at 8:32 AM, Benjamin Wolff <[hidden email]> wrote:
Hi,

I have observed a behaviour in my project and would like to ask if someone
can confirm this behaviour?

Regarding the 'provided' scope of dependencies in a Grails plugin, it seems
that this scope is not provided from a plugin to the main app that uses the
plugin, correct?

Example:

BuildConfig.groovy of a plugin:


So in the application that uses the plugin, these two dependencies would not
appear? The Maven docs about provided also state that it's not inherited.

The other question is about the 'excludes' statement for dependency
declarations (plugins and dependencies block). Say I declare a dependency to
a Grails plugin and to a regular dependency in the BuildConfig.groovy of my
application like this:


It looks like this exclude only causes other 'plugin' dependencies to be
excluded, and not dependencies that are declared in the 'dependencies' block
of the plugin's BuildConfig.groovy. Is that actually the intended behaviour?

I hope I made myself clear enough, don't hesitate to ask for more
information. As I mentioned, this is the behaviour I observed, I just want
to make sure it's the intended behaviour and I'm not experiencing some
dependency-hades anonamlies.

Thanks!

Cheers,
Ben



-----
Cheers,
Ben
--
View this message in context: http://grails.1312388.n4.nabble.com/Questions-about-provided-scope-and-dependency-excludes-when-using-Grails-plugins-tp4646317.html
Sent from the Grails - user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|

Re: Questions about 'provided' scope and dependency 'excludes' when using Grails plugins

Benjamin Wolff
In reply to this post by Benjamin Wolff
I have to correct one of my question. It seems that the excludes of transitive jar dependency actually works! It was another mistake.

So the only question left is about the non-inheritance of the 'provided' scope.

Cheers,
Ben
Cheers,
Ben