You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Paul Benedict <pb...@apache.org> on 2014/04/14 19:03:45 UTC
Thoughts on overriding scope in a profile without needing version
I have a need that (I don't think) Maven supports. But I would like to hear
from the Maven developers on the feature.
My application targets different appservers. I have all my dependencies
specified under <dependencyManagement>, but I use different profiles
(appserver specific) to change which dependencies are provided by the
container. I really don't like the requirement that I must respecify the
version whose scope I am changing -- especially since the artifact is
already being globally managed.
I wish I could just either (1) omit the version and have it be inherited
from my global dependency management or (2) use a wildcard saying I don't
care what version you find.
<profile>
<id>jboss</id>
<dependencyManagement>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</groupId>
<scope>provided</scope>
</dependency>
</dependencyManagement>
</profile>
I pref #1 but #2 should just be as safe since it's impossible (?) to have
duplicate group:artifact:type dependencies. The biggest hack of all, I
suppose, is to use some sort of range from [1.0,) but that's actually quite
an abuse just to get what I want.
Thoughts?
--
Cheers,
Paul
Re: Thoughts on overriding scope in a profile without needing version
Posted by Paul Benedict <pb...@apache.org>.
Yes, I am aware of moving versions out into variables when they need to be
referenced multiple times. I just don't think the repetition is needed; the
artifact is basically chosen by the global dependency management; the
version really becomes irrelevant in my profile usage.
Would this be suitable Maven enhancement?
On Mon, Apr 14, 2014 at 2:02 PM, Alexander Kriegisch <
Alexander@kriegisch.name> wrote:
> You can use a property in your root POM and refer to it in all your
> dependencyManagement sections. While this is not perfect, it works. I am
> enclosing depMgmt sections in profiles whenever I need to override scope
> for a certain dependency. It is not quite what I want, but does the trick.
>
> --
> Alexander Kriegisch
>
>
> > Am 14.04.2014 um 19:03 schrieb Paul Benedict <pb...@apache.org>:
> >
> > I have a need that (I don't think) Maven supports. But I would like to
> hear
> > from the Maven developers on the feature.
> >
> > My application targets different appservers. I have all my dependencies
> > specified under <dependencyManagement>, but I use different profiles
> > (appserver specific) to change which dependencies are provided by the
> > container. I really don't like the requirement that I must respecify the
> > version whose scope I am changing -- especially since the artifact is
> > already being globally managed.
> >
> > I wish I could just either (1) omit the version and have it be inherited
> > from my global dependency management or (2) use a wildcard saying I don't
> > care what version you find.
> >
> > <profile>
> > <id>jboss</id>
> > <dependencyManagement>
> > <dependency>
> > <groupId>commons-logging</groupId>
> > <artifactId>commons-logging</groupId>
> > <scope>provided</scope>
> > </dependency>
> > </dependencyManagement>
> > </profile>
> >
> > I pref #1 but #2 should just be as safe since it's impossible (?) to have
> > duplicate group:artifact:type dependencies. The biggest hack of all, I
> > suppose, is to use some sort of range from [1.0,) but that's actually
> quite
> > an abuse just to get what I want.
> >
> > Thoughts?
> >
> > --
> > Cheers,
> > Paul
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>
--
Cheers,
Paul
Re: Thoughts on overriding scope in a profile without needing version
Posted by Alexander Kriegisch <Al...@Kriegisch.name>.
You can use a property in your root POM and refer to it in all your dependencyManagement sections. While this is not perfect, it works. I am enclosing depMgmt sections in profiles whenever I need to override scope for a certain dependency. It is not quite what I want, but does the trick.
--
Alexander Kriegisch
> Am 14.04.2014 um 19:03 schrieb Paul Benedict <pb...@apache.org>:
>
> I have a need that (I don't think) Maven supports. But I would like to hear
> from the Maven developers on the feature.
>
> My application targets different appservers. I have all my dependencies
> specified under <dependencyManagement>, but I use different profiles
> (appserver specific) to change which dependencies are provided by the
> container. I really don't like the requirement that I must respecify the
> version whose scope I am changing -- especially since the artifact is
> already being globally managed.
>
> I wish I could just either (1) omit the version and have it be inherited
> from my global dependency management or (2) use a wildcard saying I don't
> care what version you find.
>
> <profile>
> <id>jboss</id>
> <dependencyManagement>
> <dependency>
> <groupId>commons-logging</groupId>
> <artifactId>commons-logging</groupId>
> <scope>provided</scope>
> </dependency>
> </dependencyManagement>
> </profile>
>
> I pref #1 but #2 should just be as safe since it's impossible (?) to have
> duplicate group:artifact:type dependencies. The biggest hack of all, I
> suppose, is to use some sort of range from [1.0,) but that's actually quite
> an abuse just to get what I want.
>
> Thoughts?
>
> --
> Cheers,
> Paul
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org