You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Adva Rotstein-Hayun <ar...@jacada.com> on 2011/05/23 16:14:37 UTC

working with several java version with maven

Hi,
I have several projects that compile with java 5.
There is 1 project I would like to compile with java 6.
I added to that project pom the source and target attributes, however my JAVA_HOME environment variable is set to java 5.
How can I tell maven where is my java 6 home?
I can not change my JAVA_HOME on each run, I would like it to be automatically.
Can I define it in a pom.xml?

Adva


RE: working with several java version with maven

Posted by "Yanko, Curtis" <cu...@uhc.com>.
We would manage this in our CI server and indeed control what JAVA_HOME
is set to for different workflows. We'd further use Maven profiles to
toggle the setting within Maven for things like compiler settings. Then
one code change could trigger two builds in parallel targeting different
JDK's.

________________________________

Curt Yanko | Continuous Integration Services | UnitedHealth Group IT 
Making IT Happen, one build at a time, 600 times a day
 

> -----Original Message-----
> From: Adva Rotstein-Hayun [mailto:arotstein@jacada.com] 
> Sent: Monday, May 23, 2011 10:15 AM
> To: users@maven.apache.org
> Subject: working with several java version with maven
> 
> Hi,
> I have several projects that compile with java 5.
> There is 1 project I would like to compile with java 6.
> I added to that project pom the source and target attributes, 
> however my JAVA_HOME environment variable is set to java 5.
> How can I tell maven where is my java 6 home?
> I can not change my JAVA_HOME on each run, I would like it to 
> be automatically.
> Can I define it in a pom.xml?
> 
> Adva
> 
> 

This e-mail, including attachments, may include confidential and/or
proprietary information, and may be used only by the person or entity
to which it is addressed. If the reader of this e-mail is not the intended
recipient or his or her authorized agent, the reader is hereby notified
that any dissemination, distribution or copying of this e-mail is
prohibited. If you have received this e-mail in error, please notify the
sender by replying to this message and delete this e-mail immediately.


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


Re: working with several java version with maven

Posted by Stephen Connolly <st...@gmail.com>.
There is also Toolchains!

http://maven.apache.org/guides/mini/guide-using-toolchains.html

Of course not many people know about Toolchains, but for Java it does
actually work!

-Stephen

On 23 May 2011 15:31, Benson Margulies <bi...@gmail.com> wrote:
> You can run Maven under java6 and tell it that the target language
> level is 1.5 by configuring the maven-compiler-plugin. You can also
> use the animal sniffer to detect accidental use of 1.6 APIs in a 1.5
> environment.
>
> On Mon, May 23, 2011 at 10:14 AM, Adva Rotstein-Hayun
> <ar...@jacada.com> wrote:
>> Hi,
>> I have several projects that compile with java 5.
>> There is 1 project I would like to compile with java 6.
>> I added to that project pom the source and target attributes, however my JAVA_HOME environment variable is set to java 5.
>> How can I tell maven where is my java 6 home?
>> I can not change my JAVA_HOME on each run, I would like it to be automatically.
>> Can I define it in a pom.xml?
>>
>> Adva
>>
>>
>
> ---------------------------------------------------------------------
> 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: working with several java version with maven

Posted by Benson Margulies <bi...@gmail.com>.
You can run Maven under java6 and tell it that the target language
level is 1.5 by configuring the maven-compiler-plugin. You can also
use the animal sniffer to detect accidental use of 1.6 APIs in a 1.5
environment.

On Mon, May 23, 2011 at 10:14 AM, Adva Rotstein-Hayun
<ar...@jacada.com> wrote:
> Hi,
> I have several projects that compile with java 5.
> There is 1 project I would like to compile with java 6.
> I added to that project pom the source and target attributes, however my JAVA_HOME environment variable is set to java 5.
> How can I tell maven where is my java 6 home?
> I can not change my JAVA_HOME on each run, I would like it to be automatically.
> Can I define it in a pom.xml?
>
> Adva
>
>

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