DependencyManagement to force scope

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

DependencyManagement to force scope

softwarepills
I usually think in DependencyManagement as a "by default" section, i mean, the version and scope you set in DependencyManagement is the version and scope you get if ommited in the real dependency in the POM and child POMs.

But, i have found that if i insert  provided scope in the DependencyManagement section, any compile dependency and transitive compile dependency will be "upgraded" to provided.

Is this correct? Is this the intended behavior? If yes, this is a inetresting tool to exclude artifacts form being packaged, right?

Reply | Threaded
Open this post in threaded view
|

RE: DependencyManagement to force scope

Jörg Schaible-3
softwarepills wrote:

> I usually think in DependencyManagement as a "by default" section, i
> mean, the version and scope you set in DependencyManagement is the
> version and scope you get if ommited in the real dependency in the POM
> and child POMs.
>
> But, i have found that if i insert  provided scope in the
> DependencyManagement section, any compile dependency and transitive
> compile dependency will be "upgraded" to provided.
>
> Is this correct?

Yes.

> Is this the intended behavior?

Yes.

> If yes, this is a inetresting tool to exclude artifacts form being packaged, right?

Yes.

:)

You'll need M2.0.6 or greater though ...

-Jörg

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: DependencyManagement to force scope

softwarepills
In reply to this post by softwarepills
Short and clear.

I didn't found this in either the two books of Maven or in the Maven docs.

Thanks a lot.

softwarepills wrote
I usually think in DependencyManagement as a "by default" section, i mean, the version and scope you set in DependencyManagement is the version and scope you get if ommited in the real dependency in the POM and child POMs.

But, i have found that if i insert  provided scope in the DependencyManagement section, any compile dependency and transitive compile dependency will be "upgraded" to provided.

Is this correct? Is this the intended behavior? If yes, this is a inetresting tool to exclude artifacts form being packaged, right?
Reply | Threaded
Open this post in threaded view
|

RE: DependencyManagement to force scope

softwarepills
In reply to this post by Jörg Schaible-3
To clarify more the matter.

Should we think about DependencyManagement no only as a default value provider, but also as a modifier of inherited dependencies?
Does it apply to other parameters like the <version> itself and <optional>?.

Jörg Schaible-3 wrote
softwarepills wrote:
> I usually think in DependencyManagement as a "by default" section, i
> mean, the version and scope you set in DependencyManagement is the
> version and scope you get if ommited in the real dependency in the POM
> and child POMs.
>
> But, i have found that if i insert  provided scope in the
> DependencyManagement section, any compile dependency and transitive
> compile dependency will be "upgraded" to provided.
>
> Is this correct?

Yes.

> Is this the intended behavior?

Yes.

> If yes, this is a inetresting tool to exclude artifacts form being packaged, right?

Yes.

:)

You'll need M2.0.6 or greater though ...

-Jörg

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Reply | Threaded
Open this post in threaded view
|

RE: DependencyManagement to force scope

Anders Hammar
I'm not sure about the optional tag, but it does apply to version. DependencyManagement is where you can  specify the version to use for transitive dependencies.
http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Management

/Anders

softwarepills wrote
To clarify more the matter.

Should we think about DependencyManagement no only as a default value provider, but also as a modifier of inherited dependencies?
Does it apply to other parameters like the <version> itself and <optional>?.

Jörg Schaible-3 wrote
softwarepills wrote:
> I usually think in DependencyManagement as a "by default" section, i
> mean, the version and scope you set in DependencyManagement is the
> version and scope you get if ommited in the real dependency in the POM
> and child POMs.
>
> But, i have found that if i insert  provided scope in the
> DependencyManagement section, any compile dependency and transitive
> compile dependency will be "upgraded" to provided.
>
> Is this correct?

Yes.

> Is this the intended behavior?

Yes.

> If yes, this is a inetresting tool to exclude artifacts form being packaged, right?

Yes.

:)

You'll need M2.0.6 or greater though ...

-Jörg

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Reply | Threaded
Open this post in threaded view
|

RE: DependencyManagement to force scope

softwarepills
I see. Thank you.

So we can modify version, version an scope, but not, only scope. This is a problem when you only want using it to "upgrade" a dependency to "provided". Then you are also manipulatig the version that should be resolved by Maven.

So it seems its not a good idea using it to exclude a "sticky" transitive dependency that someone has set as compile but in your context is provided, right?

Anders Hammar wrote
I'm not sure about the optional tag, but it does apply to version. DependencyManagement is where you can  specify the version to use for transitive dependencies.
http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Management

/Anders

softwarepills wrote
To clarify more the matter.

Should we think about DependencyManagement no only as a default value provider, but also as a modifier of inherited dependencies?
Does it apply to other parameters like the <version> itself and <optional>?.

Jörg Schaible-3 wrote
softwarepills wrote:
> I usually think in DependencyManagement as a "by default" section, i
> mean, the version and scope you set in DependencyManagement is the
> version and scope you get if ommited in the real dependency in the POM
> and child POMs.
>
> But, i have found that if i insert  provided scope in the
> DependencyManagement section, any compile dependency and transitive
> compile dependency will be "upgraded" to provided.
>
> Is this correct?

Yes.

> Is this the intended behavior?

Yes.

> If yes, this is a inetresting tool to exclude artifacts form being packaged, right?

Yes.

:)

You'll need M2.0.6 or greater though ...

-Jörg

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Reply | Threaded
Open this post in threaded view
|

RE: DependencyManagement to force scope

Anders Hammar
Well, as I see things, if you specify the artifact as provided then you also want to define the version that is provided. IMO you do want to use the same version in your Maven build as you're going to use in the targeted environment. In fact, this was one of my key points in a Maven talk I did at our local jug earlier this week.
Why would you use a different version (and/or implementation) in your build than you're going to use when deployd?

/Anders

softwarepills wrote
I see. Thank you.

So we can modify version, version an scope, but not, only scope. This is a problem when you only want using it to "upgrade" a dependency to "provided". Then you are also manipulatig the version that should be resolved by Maven.

So it seems its not a good idea using it to exclude a "sticky" transitive dependency that someone has set as compile but in your context is provided, right?

Anders Hammar wrote
I'm not sure about the optional tag, but it does apply to version. DependencyManagement is where you can  specify the version to use for transitive dependencies.
http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Management

/Anders

softwarepills wrote
To clarify more the matter.

Should we think about DependencyManagement no only as a default value provider, but also as a modifier of inherited dependencies?
Does it apply to other parameters like the <version> itself and <optional>?.

Jörg Schaible-3 wrote
softwarepills wrote:
> I usually think in DependencyManagement as a "by default" section, i
> mean, the version and scope you set in DependencyManagement is the
> version and scope you get if ommited in the real dependency in the POM
> and child POMs.
>
> But, i have found that if i insert  provided scope in the
> DependencyManagement section, any compile dependency and transitive
> compile dependency will be "upgraded" to provided.
>
> Is this correct?

Yes.

> Is this the intended behavior?

Yes.

> If yes, this is a inetresting tool to exclude artifacts form being packaged, right?

Yes.

:)

You'll need M2.0.6 or greater though ...

-Jörg

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Reply | Threaded
Open this post in threaded view
|

RE: DependencyManagement to force scope

softwarepills
Yes, it has sense.

Thank you.

Anders Hammar wrote
Well, as I see things, if you specify the artifact as provided then you also want to define the version that is provided. IMO you do want to use the same version in your Maven build as you're going to use in the targeted environment. In fact, this was one of my key points in a Maven talk I did at our local jug earlier this week.
Why would you use a different version (and/or implementation) in your build than you're going to use when deployd?

/Anders

softwarepills wrote
I see. Thank you.

So we can modify version, version an scope, but not, only scope. This is a problem when you only want using it to "upgrade" a dependency to "provided". Then you are also manipulatig the version that should be resolved by Maven.

So it seems its not a good idea using it to exclude a "sticky" transitive dependency that someone has set as compile but in your context is provided, right?

Anders Hammar wrote
I'm not sure about the optional tag, but it does apply to version. DependencyManagement is where you can  specify the version to use for transitive dependencies.
http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Management

/Anders

softwarepills wrote
To clarify more the matter.

Should we think about DependencyManagement no only as a default value provider, but also as a modifier of inherited dependencies?
Does it apply to other parameters like the <version> itself and <optional>?.

Jörg Schaible-3 wrote
softwarepills wrote:
> I usually think in DependencyManagement as a "by default" section, i
> mean, the version and scope you set in DependencyManagement is the
> version and scope you get if ommited in the real dependency in the POM
> and child POMs.
>
> But, i have found that if i insert  provided scope in the
> DependencyManagement section, any compile dependency and transitive
> compile dependency will be "upgraded" to provided.
>
> Is this correct?

Yes.

> Is this the intended behavior?

Yes.

> If yes, this is a inetresting tool to exclude artifacts form being packaged, right?

Yes.

:)

You'll need M2.0.6 or greater though ...

-Jörg

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Reply | Threaded
Open this post in threaded view
|

RE: DependencyManagement to force scope

softwarepills
In reply to this post by Anders Hammar
I have just remeber my problems with this: in many cases you define the versions with DepencyManagement in a parent POM to align them in all the modules, but, for one child (or via import scope) module you want them to be provided beacause other module provides them. Then, in your child pom you don't want to set the version again, as it is the reponsability of the parent POM. Yes, you can upgrade to provided in the direct dependencies section, but what about the transitive ones?.

So i think there is a common use case in where it is very usefull to modify declare only the scope but not the version in the DependencyManagement.

Anders Hammar wrote
Well, as I see things, if you specify the artifact as provided then you also want to define the version that is provided. IMO you do want to use the same version in your Maven build as you're going to use in the targeted environment. In fact, this was one of my key points in a Maven talk I did at our local jug earlier this week.
Why would you use a different version (and/or implementation) in your build than you're going to use when deployd?

/Anders

softwarepills wrote
I see. Thank you.

So we can modify version, version an scope, but not, only scope. This is a problem when you only want using it to "upgrade" a dependency to "provided". Then you are also manipulatig the version that should be resolved by Maven.

So it seems its not a good idea using it to exclude a "sticky" transitive dependency that someone has set as compile but in your context is provided, right?

Anders Hammar wrote
I'm not sure about the optional tag, but it does apply to version. DependencyManagement is where you can  specify the version to use for transitive dependencies.
http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Management

/Anders

softwarepills wrote
To clarify more the matter.

Should we think about DependencyManagement no only as a default value provider, but also as a modifier of inherited dependencies?
Does it apply to other parameters like the <version> itself and <optional>?.

Jörg Schaible-3 wrote
softwarepills wrote:
> I usually think in DependencyManagement as a "by default" section, i
> mean, the version and scope you set in DependencyManagement is the
> version and scope you get if ommited in the real dependency in the POM
> and child POMs.
>
> But, i have found that if i insert  provided scope in the
> DependencyManagement section, any compile dependency and transitive
> compile dependency will be "upgraded" to provided.
>
> Is this correct?

Yes.

> Is this the intended behavior?

Yes.

> If yes, this is a inetresting tool to exclude artifacts form being packaged, right?

Yes.

:)

You'll need M2.0.6 or greater though ...

-Jörg

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org