You may want to look at using the enforcer plugin :

http://maven.apache.org/plugins/maven-enforcer-plugin/

This would allow you to guarantee that the jdk running is the build's required 
JDK.  

As to your initial question, I agree that the only way to set the JDK versino 
globally in Maven is to execute Maven with the JDK home set to the VM you 
require.  Otherwise you are going to have to configure individual plugins (like 
surefire) to point to the path of the VM that you require.  This is not 
portable and should be avoided.

Pete 

-----Original Message-----
From: Michael [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, January 16, 2008 11:51 AM
To: Maven Users List
Subject: Re: Use 1.6 JRE globally

Olivier Serve wrote:
> Le mercredi 16 janvier 2008, Michael a écrit :
>> Olivier Serve wrote:
>>> Hi _o/
>>>
>>> I have a little project that requires a JDK 1.6 (it uses some 1.6 specific 
>>> APIs).
>>> I have both Java 1.5 and 1.6 installed on my system to do some tests.
>>>
>>> Using the following, I can build the artifact.
>>> ------------------------------8<------------------------------
>>> <project>
>>>   ...
>>>   <build>
>>>     <plugins>
>>>       <plugin>
>>>         <artifactId>maven-compiler-plugin</artifactId>
>>>         <configuration>
>>>           <compilerVersion>1.6</compilerVersion>
>>>           <fork>true</fork>
>>>           <source>1.6</source>
>>>           <target>1.6</target>
>>>         </configuration>
>>>       </plugin>
>>>     </plugins>
>>>   </build>
>>>   ...
>>> </project>
>>> ------------------------------8<------------------------------
>>>
>>> However, the tests fail to execute with a "Bad version number in .class 
>>> file".
>>> OK, the surefire plugin must be using the 1.5 JRE to execute the tests and 
>>> thus fails.
>>> There must be a way to tell it to use a 1.6 JRE and that would solve my 
>>> problem.
>>>
>>> But I find it quite a bad precatice to have to state in two locations that 
>>> I need a 1.6 jre.
>>> Is there a way to tell maven to use a JRE 1.6 for all Java-related things 
>>> in a single location ?
>> set JAVA_HOME JRE_HOME correctly
> 
> No, because doing this will make the build non-reproducible on other 
> environments as I will lose the 1.6 requirement.

you could set i temporary for the each maven instance

-- 
<NO> OOXML - Say NO To Microsoft Office broken standard
http://www.noooxml.org


---------------------------------------------------------------------
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