You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Wim Deblauwe <wi...@gmail.com> on 2007/10/23 20:54:37 UTC

declare dependencies depending on jdk version

Hi,

I'm looking into putting swingx in the central repo. As they do not use
maven to build, I need to come up with a good pom. They have 3 dependencies.
Two of them are only needed when running under jdk 1.5. How can I declare
this in the pom.xml?

Suppose this is a part of the pom:

<dependencies>
   <dependency>
       <groupId>swingworker</groupId>
       <artifactId>swingworker</artifactId>
       <version>1.0</version>
   </dependency>
....
</dependencies>

What can I add to have only swingworker as a transitive dependency when
building with JDK 1.5? I thought about making it <optional/> but I'm not
sure that is the best way.

regards,

Wim

-- 
Vigilog - an open source log file viewer: http://vigilog.sourceforge.net
Blog: http://www.jroller.com/page/Fester

RE: declare dependencies depending on jdk version

Posted by "Brian E. Fox" <br...@reply.infinity.nu>.
You would need the jars to have the associated classifier too...

-----Original Message-----
From: Wayne Fay [mailto:waynefay@gmail.com] 
Sent: Tuesday, October 23, 2007 3:11 PM
To: Maven Users List
Subject: Re: declare dependencies depending on jdk version

Most people solve these kinds of problems by simply creating 2 (or
more) poms that have different classifiers to specify the difference,
eg:
swingx-1.0.pom
swingx-1.0-jdk4.pom
swingx-1.0-jdk5.pom
swingx-1.0-jdk6.pom

Wayne

On 10/23/07, Wim Deblauwe <wi...@gmail.com> wrote:
> Hi,
>
> I'm looking into putting swingx in the central repo. As they do not
use
> maven to build, I need to come up with a good pom. They have 3
dependencies.
> Two of them are only needed when running under jdk 1.5. How can I
declare
> this in the pom.xml?
>
> Suppose this is a part of the pom:
>
> <dependencies>
>    <dependency>
>        <groupId>swingworker</groupId>
>        <artifactId>swingworker</artifactId>
>        <version>1.0</version>
>    </dependency>
> ....
> </dependencies>
>
> What can I add to have only swingworker as a transitive dependency
when
> building with JDK 1.5? I thought about making it <optional/> but I'm
not
> sure that is the best way.
>
> regards,
>
> Wim
>
> --
> Vigilog - an open source log file viewer:
http://vigilog.sourceforge.net
> Blog: http://www.jroller.com/page/Fester
>

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


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


Re: declare dependencies depending on jdk version

Posted by nicolas de loof <ni...@gmail.com>.
That's not the same case : testng  has many jars with various classifier,
depending on the jdk used to build it from sources. They all share the same
POM

A maven artifact with a classifier always has the same POM as the
no-classifier artifact.

You will need to create multiple VERSIONS on the jar :

swingx/swingx/1.0-java5/swingx-1.0-java5.jar
swingx/swingx/1.0-java5/swingx-1.0-java5.pom
swingx/swingx/1.0-java6/swingx-1.0-java6.jar
swingx/swingx/1.0-java6/swingx-1.0-java6.pom

This is not a ver clean solution.

As an alternative, you can use a profile that gets active based on the JDK
used by your project.



2007/10/23, Wayne Fay <wa...@gmail.com>:
>
> Yes, that's what I'm saying. This is how testng (and others) do it:
> http://repo1.maven.org/maven2/org/testng/testng/5.5/
>
> Wayne
>
> On 10/23/07, Wim Deblauwe <wi...@gmail.com> wrote:
> > Do I understand it correctly that you saying that I need to create 2
> upload
> > bundles for swingx, one for jdk 1.5 and one for jdk 1.6?
> >
> > They both will have the exact same code, only different dependencies?
> >
> > regards,
> >
> > Wim
> >
> >
> > 2007/10/23, Wayne Fay <wa...@gmail.com>:
> > >
> > > Most people solve these kinds of problems by simply creating 2 (or
> > > more) poms that have different classifiers to specify the difference,
> > > eg:
> > > swingx-1.0.pom
> > > swingx-1.0-jdk4.pom
> > > swingx-1.0-jdk5.pom
> > > swingx-1.0-jdk6.pom
> > >
> > > Wayne
> > >
> > > On 10/23/07, Wim Deblauwe <wi...@gmail.com> wrote:
> > > > Hi,
> > > >
> > > > I'm looking into putting swingx in the central repo. As they do not
> use
> > > > maven to build, I need to come up with a good pom. They have 3
> > > dependencies.
> > > > Two of them are only needed when running under jdk 1.5. How can I
> > > declare
> > > > this in the pom.xml?
> > > >
> > > > Suppose this is a part of the pom:
> > > >
> > > > <dependencies>
> > > >    <dependency>
> > > >        <groupId>swingworker</groupId>
> > > >        <artifactId>swingworker</artifactId>
> > > >        <version>1.0</version>
> > > >    </dependency>
> > > > ....
> > > > </dependencies>
> > > >
> > > > What can I add to have only swingworker as a transitive dependency
> when
> > > > building with JDK 1.5? I thought about making it <optional/> but I'm
> not
> > > > sure that is the best way.
> > > >
> > > > regards,
> > > >
> > > > Wim
> > > >
> > > > --
> > > > Vigilog - an open source log file viewer:
> http://vigilog.sourceforge.net
> > > > Blog: http://www.jroller.com/page/Fester
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> >
> >
> > --
> > Vigilog - an open source log file viewer: http://vigilog.sourceforge.net
> > Blog: http://www.jroller.com/page/Fester
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: declare dependencies depending on jdk version

Posted by Wayne Fay <wa...@gmail.com>.
Yes, that's what I'm saying. This is how testng (and others) do it:
http://repo1.maven.org/maven2/org/testng/testng/5.5/

Wayne

On 10/23/07, Wim Deblauwe <wi...@gmail.com> wrote:
> Do I understand it correctly that you saying that I need to create 2 upload
> bundles for swingx, one for jdk 1.5 and one for jdk 1.6?
>
> They both will have the exact same code, only different dependencies?
>
> regards,
>
> Wim
>
>
> 2007/10/23, Wayne Fay <wa...@gmail.com>:
> >
> > Most people solve these kinds of problems by simply creating 2 (or
> > more) poms that have different classifiers to specify the difference,
> > eg:
> > swingx-1.0.pom
> > swingx-1.0-jdk4.pom
> > swingx-1.0-jdk5.pom
> > swingx-1.0-jdk6.pom
> >
> > Wayne
> >
> > On 10/23/07, Wim Deblauwe <wi...@gmail.com> wrote:
> > > Hi,
> > >
> > > I'm looking into putting swingx in the central repo. As they do not use
> > > maven to build, I need to come up with a good pom. They have 3
> > dependencies.
> > > Two of them are only needed when running under jdk 1.5. How can I
> > declare
> > > this in the pom.xml?
> > >
> > > Suppose this is a part of the pom:
> > >
> > > <dependencies>
> > >    <dependency>
> > >        <groupId>swingworker</groupId>
> > >        <artifactId>swingworker</artifactId>
> > >        <version>1.0</version>
> > >    </dependency>
> > > ....
> > > </dependencies>
> > >
> > > What can I add to have only swingworker as a transitive dependency when
> > > building with JDK 1.5? I thought about making it <optional/> but I'm not
> > > sure that is the best way.
> > >
> > > regards,
> > >
> > > Wim
> > >
> > > --
> > > Vigilog - an open source log file viewer: http://vigilog.sourceforge.net
> > > Blog: http://www.jroller.com/page/Fester
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>
>
> --
> Vigilog - an open source log file viewer: http://vigilog.sourceforge.net
> Blog: http://www.jroller.com/page/Fester
>

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


Re: declare dependencies depending on jdk version

Posted by Wim Deblauwe <wi...@gmail.com>.
Do I understand it correctly that you saying that I need to create 2 upload
bundles for swingx, one for jdk 1.5 and one for jdk 1.6?

They both will have the exact same code, only different dependencies?

regards,

Wim


2007/10/23, Wayne Fay <wa...@gmail.com>:
>
> Most people solve these kinds of problems by simply creating 2 (or
> more) poms that have different classifiers to specify the difference,
> eg:
> swingx-1.0.pom
> swingx-1.0-jdk4.pom
> swingx-1.0-jdk5.pom
> swingx-1.0-jdk6.pom
>
> Wayne
>
> On 10/23/07, Wim Deblauwe <wi...@gmail.com> wrote:
> > Hi,
> >
> > I'm looking into putting swingx in the central repo. As they do not use
> > maven to build, I need to come up with a good pom. They have 3
> dependencies.
> > Two of them are only needed when running under jdk 1.5. How can I
> declare
> > this in the pom.xml?
> >
> > Suppose this is a part of the pom:
> >
> > <dependencies>
> >    <dependency>
> >        <groupId>swingworker</groupId>
> >        <artifactId>swingworker</artifactId>
> >        <version>1.0</version>
> >    </dependency>
> > ....
> > </dependencies>
> >
> > What can I add to have only swingworker as a transitive dependency when
> > building with JDK 1.5? I thought about making it <optional/> but I'm not
> > sure that is the best way.
> >
> > regards,
> >
> > Wim
> >
> > --
> > Vigilog - an open source log file viewer: http://vigilog.sourceforge.net
> > Blog: http://www.jroller.com/page/Fester
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
Vigilog - an open source log file viewer: http://vigilog.sourceforge.net
Blog: http://www.jroller.com/page/Fester

Re: declare dependencies depending on jdk version

Posted by Wayne Fay <wa...@gmail.com>.
Most people solve these kinds of problems by simply creating 2 (or
more) poms that have different classifiers to specify the difference,
eg:
swingx-1.0.pom
swingx-1.0-jdk4.pom
swingx-1.0-jdk5.pom
swingx-1.0-jdk6.pom

Wayne

On 10/23/07, Wim Deblauwe <wi...@gmail.com> wrote:
> Hi,
>
> I'm looking into putting swingx in the central repo. As they do not use
> maven to build, I need to come up with a good pom. They have 3 dependencies.
> Two of them are only needed when running under jdk 1.5. How can I declare
> this in the pom.xml?
>
> Suppose this is a part of the pom:
>
> <dependencies>
>    <dependency>
>        <groupId>swingworker</groupId>
>        <artifactId>swingworker</artifactId>
>        <version>1.0</version>
>    </dependency>
> ....
> </dependencies>
>
> What can I add to have only swingworker as a transitive dependency when
> building with JDK 1.5? I thought about making it <optional/> but I'm not
> sure that is the best way.
>
> regards,
>
> Wim
>
> --
> Vigilog - an open source log file viewer: http://vigilog.sourceforge.net
> Blog: http://www.jroller.com/page/Fester
>

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