You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Peter Horlock <pe...@googlemail.com> on 2008/08/26 17:10:09 UTC

Profile for different JVMs

Hi,

we have several projects, all of which or developed and compiled in java 5.
However, we have one project, which is run by a client on Java 6, and to
make it run,
we have to exclude a dependency (JAXB) that is part of Java 6. However,
without this dependency it's not running on Java 5.
In other words, I need a profile, that does not only declare other
dependencies ( I managed that part), but that would also
re-set the system properties for Java 5 / Java 6 - if that's possible
someone.
Currently, I have to adjust these settings, then I have to restart my entire
machine, all this takes ages and is error prone...

Any ideas?

Thanks in advance,

Peter

Re: Profile for different JVMs

Posted by Wayne Fay <wa...@gmail.com>.
http://docs.codehaus.org/display/MAVENUSER/Compile+and+Test+with+Different+JDK+Versions

http://hudson.gotdns.com/wiki/display/HUDSON/Maven2+project+and+JDK5

Wayne

On 8/26/08, Peter Horlock <pe...@googlemail.com> wrote:
> Hm, maybe I still have not been explixit enough -
>
> I know how to tell maven that I am using a certain JVM on the current
> system, even with profiles.
> But I want maven itself to switch the java version (to use another
> executable) it uses - so something like:
>
> mvn package -PJVM5
> mvn package -PJVM6
>
> This should:
> include / exclude dependencies dependending on the java version (easy part)
> change the JVM and compile with this version instead of the systems default
> version.
>
> Cheers,
>
> Peter
>

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


Re: Profile for different JVMs

Posted by Peter Horlock <pe...@googlemail.com>.
Hm, maybe I still have not been explixit enough -

I know how to tell maven that I am using a certain JVM on the current
system, even with profiles.
But I want maven itself to switch the java version (to use another
executable) it uses - so something like:

mvn package -PJVM5
mvn package -PJVM6

This should:
include / exclude dependencies dependending on the java version (easy part)
change the JVM and compile with this version instead of the systems default
version.

Cheers,

Peter

Re: Profile for different JVMs

Posted by Haikal Saadh <sp...@gmail.com>.
Yes, it's simple enough.

Have a look at this pom: http://code.google.com/p/swjang00/source/browse/trunk/kims_2.5/pom.xml?r=17

See how the  maven.compiler.target is a variable? All you'd have to do  
is define two profiles, one for 1.5, one for 1.6. and away you go. You  
can have the 1.5 profile active by default, and switch on the 1.6  
release when you want to cut a release for a certain client.

On 27/08/2008, at 3:51 PM, Peter Horlock wrote:

> No, you don't understand, I want Maven to change the JDK itself!
> To release a new version for this client, I have to change my JDK  
> from 1.5
> to 1.6, and all this manually. Wouldn't it be possible to automate  
> this with
> Maven?!
>
> Thanks,
>
> Peter


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


Re: Profile for different JVMs

Posted by Wayne Fay <wa...@gmail.com>.
This topic is discussed pretty frequently on this list, I'd encourage
you to search the archives.

Here's one thread from a week ago:
date  Aug 17, 2008 8:28 PM
subject  Building same source with 1.4 and 1.5 jdks

Wayne

On 8/26/08, Peter Horlock <pe...@googlemail.com> wrote:
> No, you don't understand, I want Maven to change the JDK itself!
> To release a new version for this client, I have to change my JDK from 1.5
> to 1.6, and all this manually. Wouldn't it be possible to automate this with
> Maven?!
>
> Thanks,
>
> Peter
>

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


Re: Profile for different JVMs

Posted by Peter Horlock <pe...@googlemail.com>.
No, you don't understand, I want Maven to change the JDK itself!
To release a new version for this client, I have to change my JDK from 1.5
to 1.6, and all this manually. Wouldn't it be possible to automate this with
Maven?!

Thanks,

Peter

Re: Profile for different JVMs

Posted by Wayne Fay <wa...@gmail.com>.
Use profile activation based on the JDK. Read more here:
http://maven.apache.org/guides/introduction/introduction-to-profiles.html

I would simply set my pom dependencies to the minimum set, and then a
profile which adds dependencies as needed based on the JDK being used.

Wayne

On 8/26/08, Peter Horlock <pe...@googlemail.com> wrote:
> Hi,
>
> we have several projects, all of which or developed and compiled in java 5.
> However, we have one project, which is run by a client on Java 6, and to
> make it run,
> we have to exclude a dependency (JAXB) that is part of Java 6. However,
> without this dependency it's not running on Java 5.
> In other words, I need a profile, that does not only declare other
> dependencies ( I managed that part), but that would also
> re-set the system properties for Java 5 / Java 6 - if that's possible
> someone.
> Currently, I have to adjust these settings, then I have to restart my entire
> machine, all this takes ages and is error prone...
>
> Any ideas?
>
> Thanks in advance,
>
> Peter
>

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