You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Joerg Hohwiller <jo...@j-hohwiller.de> on 2008/02/04 22:13:24 UTC

conditional dependencies

Hi there,

I am using conditional dependencies in the form that I use variables
in the dependencies and profiles to set these variables.

Now I currently wonder what to do if a dependency is only required under 
specific situations. E.g. stax or jsr250 is included in java6 while
you need dependencies on external artifacts for java5.
Has someone experience with that?
Is it best to use a variable for the scope and set it to "provided" for java6?
Or is it possible to add a dependency into the profile section?

Thanks
   Jörg

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


Re: conditional dependencies

Posted by Joerg Hohwiller <jo...@j-hohwiller.de>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> Hi Jorg
Hi Jon,
> 
> Yeah just set up profiles for Java5 and java6 each specifying the unique dependencies for the jdk.
So what you are saying is that it really works to declare a dependency within a
profile section? I have NOT tried this again since maven 2.0.4. but it did not
work properly then.
And shouldn't there be POMs with packaging "pom" in central repo to do this for
stax, jsr250, etc., so it is a centralized feature?
Then everybody could just add a dependency on "stax-profile" (or however one
would call it) with type "pom" and that is all.
> 
> Jon 
Thanks so far...
  Jörg
> 
> -----Original Message-----
> From: Joerg Hohwiller [mailto:joerg@j-hohwiller.de] 
> Sent: 04 February 2008 21:13
> To: Maven Users List
> Subject: conditional dependencies
> 
> Hi there,
> 
> I am using conditional dependencies in the form that I use variables in the dependencies and profiles to set these variables.
> 
> Now I currently wonder what to do if a dependency is only required under specific situations. E.g. stax or jsr250 is included in java6 while you need dependencies on external artifacts for java5.
> Has someone experience with that?
> Is it best to use a variable for the scope and set it to "provided" for java6?
> Or is it possible to add a dependency into the profile section?
> 
> Thanks
>    Jörg
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 
> This email is from Elsevier Limited, a company registered in England and Wales with company number 1982084,
> whose registered office is The Boulevard, Langford Lane, Kidlington, Oxford, OX5 1GB, United Kingdom.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHqi63mPuec2Dcv/8RAqbhAJ0XS6VBZWDHiW7YcRwhF3jZ8c+uygCfcuj+
KyKGgIxxrLJR2zeEVOdRFTw=
=Glsg
-----END PGP SIGNATURE-----

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


Re: conditional dependencies

Posted by Stephen Connolly <st...@gmail.com>.
The problem I see with conditional dependencies is that they define the
dependencies that Maven needs in order to build/test the artifact.

So if I do a build on java6, my conditional dependencies will exclude
javax.activation...

I assume the Release/deploy plugins will upload the effective pom for my
build environment, which does not include javax.activation...

Now you come along and depend on my artifact, but are building with java5...
so you do not receive the conditional dependency.

On the other hand if the release/deploy plugins upload the pom and it's
profile definitions, Maven is going to have to re-detect the profile
activation to determine the transitive dependencies (Which I don't thinkk it
does)

-Stephen

On Feb 5, 2008 8:20 AM, SlinnHawkins, Jon (ELS-CAM) <
J.SlinnHawkins@elsevier.com> wrote:

> Hi Jorg
>
> Yeah just set up profiles for Java5 and java6 each specifying the unique
> dependencies for the jdk.
>
> Jon
>
> -----Original Message-----
> From: Joerg Hohwiller [mailto:joerg@j-hohwiller.de]
> Sent: 04 February 2008 21:13
> To: Maven Users List
> Subject: conditional dependencies
>
> Hi there,
>
> I am using conditional dependencies in the form that I use variables in
> the dependencies and profiles to set these variables.
>
> Now I currently wonder what to do if a dependency is only required under
> specific situations. E.g. stax or jsr250 is included in java6 while you
> need dependencies on external artifacts for java5.
> Has someone experience with that?
> Is it best to use a variable for the scope and set it to "provided" for
> java6?
> Or is it possible to add a dependency into the profile section?
>
> Thanks
>   Jörg
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
>
> This email is from Elsevier Limited, a company registered in England and
> Wales with company number 1982084,
> whose registered office is The Boulevard, Langford Lane, Kidlington,
> Oxford, OX5 1GB, United Kingdom.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

RE: conditional dependencies

Posted by "SlinnHawkins, Jon (ELS-CAM)" <J....@elsevier.com>.
Hi Jorg

Yeah just set up profiles for Java5 and java6 each specifying the unique dependencies for the jdk.

Jon 

-----Original Message-----
From: Joerg Hohwiller [mailto:joerg@j-hohwiller.de] 
Sent: 04 February 2008 21:13
To: Maven Users List
Subject: conditional dependencies

Hi there,

I am using conditional dependencies in the form that I use variables in the dependencies and profiles to set these variables.

Now I currently wonder what to do if a dependency is only required under specific situations. E.g. stax or jsr250 is included in java6 while you need dependencies on external artifacts for java5.
Has someone experience with that?
Is it best to use a variable for the scope and set it to "provided" for java6?
Or is it possible to add a dependency into the profile section?

Thanks
   Jörg

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



This email is from Elsevier Limited, a company registered in England and Wales with company number 1982084,
whose registered office is The Boulevard, Langford Lane, Kidlington, Oxford, OX5 1GB, United Kingdom.


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