looking for scenarios which will work for all jvm versions (and not forcing
the implementor to individually handle jvm specific scenarios)
ANT certainly has greater capability (at least with this scenario)

but still looking forward to a maven based solution

Thanks
Martin
----- Original Message -----
From: "Stephen Connolly" <[EMAIL PROTECTED]>
To: "Maven Users List" <[email protected]>
Sent: Tuesday, February 05, 2008 5:18 PM
Subject: Re: javax.mail and javax.activation in Java 6


> Look, maven only works on JDK 1.3 or higher...
>
> you have three profiles
>
> <dependencies>
>     <dependency>
>       <groupId>javax.mail</groupId>
>       <artifactId>mail</artifactId>
>       <version>1.4.1</version>
>       <excludes>
>         ... (see documentation) ...
>       </excludes>
>    <dependency>
> <dependencies>
> <profiles>
>   <profile>
>     <id>jdk13</id>
>     <activation>
>         <jdk>1.3</jdk>
>     </activation>
>     <dependencies>
>      <dependency>
>        <groupId>javax.activation</groupId>
>        <artifactId>activation</artifactId>
>         <version>1.1</version>
>       </dependency>
>     </dependencies>
>   </profile>
>   <profile>
>     <id>jdk14</id>
>     <activation>
>         <jdk>1.4</jdk>
>     </activation>
>     <dependencies>
>      <dependency>
>        <groupId>javax.activation</groupId>
>        <artifactId>activation</artifactId>
>        <version>1.1</version>
>       </dependency>
>     </dependencies>
>   </profile>
>   <profile>
>     <id>jdk15</id>
>     <activation>
>         <jdk>1.5</jdk>
>     </activation>
>     <dependencies>
>      <dependency>
>        <groupId>javax.activation</groupId>
>        <artifactId>activation</artifactId>
>         <version>1.1</version>
>       </dependency>
>     </dependencies>
>   </profile>
> </profiles>
>
> Which is actually quite elegant, as each jdk includes more than the
> previous, so if there are dependencies that are in JDK 1.5 but not JDK1.4,
> you can add them only to jdk14 profile, etc.
>
> Quit with the environment variable stuff as your build will not be
> reproducible... if you want to do that kind of stuff I'd either switch to
> ANT or write a plugin
>
>
> On Feb 5, 2008 9:41 PM, Martin Gainty <[EMAIL PROTECTED]> wrote:
>
> > the only possible suggestion is to set JAVA_VERSION environment variable
> > to
> > whatever_it_is..(probably implement this in .profile for login..?)
> > and then test it thru a Character Data script i.e.
> > <profiles>
> >  <profile>
> >    <activation>
> >      <jdk>
> >         <![CDATA[
> > ${env.JAVA_VERSION} < 6]]>
> > </jdk>
> >    </activation>
> >  </profile>
> > </profiles>
> >
> > Anyone else?
> > M-
> > ----- Original Message -----
> > From: "Stephen Connolly" <[EMAIL PROTECTED]>
> > To: "Maven Users List" <[email protected]>
> > Sent: Tuesday, February 05, 2008 4:12 PM
> > Subject: Re: javax.mail and javax.activation in Java 6
> >
> >
> > > And you know what, Google _Is_ Your Friend:
> > >
> > >
> >
http://maven.apache.org/guides/introduction/introduction-to-profiles.html
> > >
> > > The follwing configuration will trigger the profile when the JDK's
> > version
> > > starts with "1.4" (eg. "1.4.0_08", "1.4.2_07", "1.4"):
> > >
> > > <profiles>
> > >  <profile>
> > >    <activation>
> > >      <jdk>1.4</jdk>
> > >    </activation>
> > >    ...
> > >  </profile>
> > > </profiles>
> > >
> > > So if you are using generics (i.e. don't have to worry about jdk 1.4)
> > you
> > > just have the profile to add the dependency back in activated by <jdk>
> > 1.5
> > > </jdk>
> > >
> > > if you have to worry about 1.4, you'll need two profiles... and if,
God
> > > forbid you need to worry about 1.3, three profiles all adding it back
in
> > >
> > > On Feb 5, 2008 9:09 PM, Stephen Connolly <
> > [EMAIL PROTECTED]>
> > > wrote:
> > > > profile activation based on jvm... i'll do a quick GIYF
> > > >
> > > >
> > > > On Feb 5, 2008 8:53 PM, Martin Gainty <[EMAIL PROTECTED]> wrote:
> > > > > I'll ask the dumb question..how do you do test the JVM version
with
> > > maven?
> > > > >
> > > > > ?
> > > > > M-
> > > > > ----- Original Message -----
> > > > > From: "Stephen Connolly" <[EMAIL PROTECTED]>
> > > > > To: "Maven Users List" <[email protected]>
> > > > >
> > > > > Sent: Tuesday, February 05, 2008 3:30 PM
> > > > > Subject: Re: javax.mail and javax.activation in Java 6
> > > > >
> > > > >
> > > > > > Nooooooo!
> > > > > >
> > > > > > don't go abusing the system path for that
> > > > > >
> > > > > > Go with the exclude by default and add back in if jvm is < 6
> > > > > >
> > > > > > On Feb 5, 2008 7:49 PM, J Douglas Donohoe <[EMAIL PROTECTED]>
> > wrote:
> > > > > > > Thanks for the suggestion.  That led me down the right path.
It
> > > looks
> > > > > like the 'system' scope is more appropriate because in this case,
> > the
> > > > > classes are part of the rt.jar.  I used the following profile:
> > > > > > >
> > > > > > >   <profiles>
> > > > > > >     <profile>
> > > > > > >       <id>Java 1.6</id>
> > > > > > >       <activation>
> > > > > > >         <jdk>1.6</jdk>
> > > > > > >       </activation>
> > > > > > >       <dependencies>
> > > > > > >       <dependency>
> > > > > > >         <groupId>javax.activation</groupId>
> > > > > > >         <artifactId>activation</artifactId>
> > > > > > >         <version>1.1</version>
> > > > > > >         <scope>system</scope>
> > > > > > >         <systemPath>${java.home}/lib/rt.jar</systemPath>
> > > > > > >       </dependency>
> > > > > > >       </dependencies>
> > > > > > >     </profile>
> > > > > > >   </profiles>
> > > > > > >
> > > > > > > To verify this worked, I used the following command:
> > > > > > >
> > > > > > > $ mvn dependency:build-classpath
> > > > > > >
> > > > > > > The javax.activation jar no longer appears on the classpath,
but
> > > rt.jar
> > > > > now appears (presumably because this plugin defaults to the build
> > > > > classpath).
> > > > > > >
> > > > > > > If I do:
> > > > > > >
> > > > > > > $ mvn dependency:build-classpath -DexcludeScope=system
> > > > > > >
> > > > > > > Then I get the classpath I want.
> > > > > > >
> > > > > > > Thanks for your help.
> > > > > > >
> > > > > > > One question on the use of 'system path' in dependency.  Why
is
> > this
> > > > > necessary at all?  If it is part of the system, doesn't javac
and/or
> > > java
> > > > > know where to find it by default?
> > > > > > >
> > > > > > > -Doug
> > > > > > >
> > > > > > > *Note:  I'm not sure the system path above will work quite
right
> > on
> > > a
> > > > > Mac.  It depends on how Apple decides to package things when they
> > > release
> > > > > 1.6.
> > > > > > >
> > > > > > >
> > > > > > > ----- Original Message ----
> > > > > > > From: Simon Kitching <[EMAIL PROTECTED]>
> > > > > > > To: Maven Users List <[email protected]>
> > > > > > > Cc: Doug Donohoe <[EMAIL PROTECTED]>
> > > > > > > Sent: Tuesday, February 5, 2008 10:57:05 AM
> > > > > > > Subject: Re: javax.mail and javax.activation in Java 6
> > > > > > >
> > > > > > >
> > > > > > > ---- Doug Donohoe <[EMAIL PROTECTED]> schrieb:
> > > > > > > > Hi Maven Community:
> > > > > > > >
> > > > > > > > I have added this dependency in my POM:
> > > > > > > >
> > > > > > > >   <dependency>
> > > > > > > >     <groupId>javax.mail</groupId>
> > > > > > > >     <artifactId>mail</artifactId>
> > > > > > > >     <version>1.4.1</version>
> > > > > > > >   </dependency>
> > > > > > > >
> > > > > > > > Which is retrieved from java.net using this POM definition:
> > > > > > > >
> > > > > > > >   <repositories>
> > > > > > > >     <repository>
> > > > > > > >       <id>java.net</id>
> > > > > > > >       <url>http://download.java.net/maven/1</url>
> > > > > > > >       <layout>legacy</layout>
> > > > > > > >     </repository>
> > > > > > > >   </repositories>
> > > > > > > >
> > > > > > > > The POM for javax.mail declares a dependency on the Java
> > > activation
> > > > > > > > framework.  However, I am using Java 6 (1.6.0_02), which
> > already
> > > > > > > > includes the activation framework.
> > > > > > > >
> > > > > > > > My question:  Is there a way in maven to conditionally
define
> > a
> > > > > > > > dependency based on the JDK you are using?
> > > > > > > >
> > > > > > > > If there is, what is the best way for me to use such a
> > mechanism.
> > > > > > > > Ideally, the POM at java.net would be updated, but assuming
I
> > > can't
> > > > > > > > figure out how to get them to update that, how do I override
> > there
> > > > > > >  POM?
> > > > > > > >
> > > > > > >
> > > > > > > Try defining a profile called "java6" in your pom. Set its
> > > activation
> > > > > > >  section so it only activates for java1.6. Then in the profile
> > > define
> > > > > > >  that problem dependency with scope=provided.
> > > > > > >
> > > > > > > I think that will do the job. Dependencies declared directly
in
> > a
> > > pom
> > > > > > >  always override those pulled in transiently. That definitely
> > occurs
> > > for
> > > > > > >  version-numbers, and I *think* it works for scope too.
> > > > > > >
> > > > > > > Regards,
> > > > > > > Simon
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > > >
> > > ---------------------------------------------------------------------
> > > > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > > >
> > > > >
> > > >
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to