You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Allan Valeriano <va...@longadata.com> on 2006/11/10 21:57:28 UTC

Setting up a new jre to maven

Hi all,


I'm having problems setting up a new jre to run mvn install.
My default java version is 1.4.2_11, but I need maven to use jre 5 for it.
I've read the FAQ, but I must say the example for it is not really helpful.
Could somebody give me a hand on this sending a complete example?


thanks in advance
Allan Valeriano

Re: Setting up a new jre to maven

Posted by franz see <fr...@gmail.com>.
Good day to you, Sha Jiang,

You may be running your maven2 in jdk1.5, but the plugins that uses java may
not necessarily use 1.5. 

For example, you can set the maven-compiler-plugin (which by default,
handles the compile phase of your build) to a different JVM ( see [1] ) or
by specifying the source and targets ( see [2] ). Furthermore, you can also
specify the JVM that you will use for the maven-surefire-plugin (which by
defaults, handles the test phase of your build) ( see [3] ).

Cheers,
Franz

[1]
http://maven.apache.org/plugins/maven-compiler-plugin/examples/compile-using-different-jdk.html
[2]
http://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html
[3] http://maven.apache.org/plugins/maven-surefire-plugin/test-mojo.html#jvm


jiangshachina wrote:
> 
> Hi,
>> otherwise it defaults to 1.4 classes with the 1.5 JRE.
> I'm using JDK1.5.0_08, but Maven uses 1.3, but 1.4, as default.
> 
> a cup of Java, cheers!
> Sha Jiang
> 
> 
> Wayne Fay wrote:
>> 
>> Yes, to compile 1.5 classes, you must use a 1.5 (or greater) JRE. But
>> you also must set the 1.5 configuration, otherwise it defaults to 1.4
>> classes with the 1.5 JRE.
>> 
>> Wayne
>> 
>> On 11/11/06, jiangshachina <ji...@gmail.com> wrote:
>>>
>>> Hello,
>>> > <configuration>
>>> >     <source>1.5</source>
>>> >     <target>1.5</target>
>>> > </configuration>
>>> If that's true, I'm confused by the settings.
>>> Why Maven(or javac) can compile sources to 1.5-compatible classes at
>>> 1.4.2JRE(or 1.4.2 javac)?
>>> In order to fulfil the requirement, I think must install JDK1.5 firstly.
>>> Then use the real jre1.5.0 and configuration quoted above.
>>>
>>> a cup of Java, cheers!
>>> Sha Jiang
>>>
>>>
>>> Julio S. G. wrote:
>>> >
>>> >    Hi Allan,
>>> >
>>> >    Add these lines to you pom.xml:
>>> >
>>> > <project>
>>> >   <build>
>>> >     <plugins>
>>> >       <plugin>
>>> >         <artifactId>maven-compiler-plugin</artifactId>
>>> >         <configuration>
>>> >           <source>1.5</source>
>>> >           <target>1.5</target>
>>> >         </configuration>
>>> >       </plugin>
>>> >     </plugins>
>>> >   </build>
>>> > </project>
>>> >
>>> > Julio
>>> >
>>> >
>>> > On 11/10/06, Allan Valeriano <va...@longadata.com> wrote:
>>> >> Hi all,
>>> >>
>>> >>
>>> >> I'm having problems setting up a new jre to run mvn install.
>>> >> My default java version is 1.4.2_11, but I need maven to use jre 5
>>> for
>>> >> it.
>>> >> I've read the FAQ, but I must say the example for it is not really
>>> >> helpful.
>>> >> Could somebody give me a hand on this sending a complete example?
>>> >>
>>> >>
>>> >> thanks in advance
>>> >> Allan Valeriano
>>> >>
>>> >>
>>> >
>>> > ---------------------------------------------------------------------
>>> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> > For additional commands, e-mail: users-help@maven.apache.org
>>> >
>>> >
>>> >
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Setting-up-a-new-jre-to-maven-tf2610500s177.html#a7299977
>>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Setting-up-a-new-jre-to-maven-tf2610500s177.html#a7330855
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: Setting up a new jre to maven

Posted by jiangshachina <ji...@gmail.com>.
Hi,
> otherwise it defaults to 1.4 classes with the 1.5 JRE.
I'm using JDK1.5.0_08, but Maven uses 1.3, but 1.4, as default.

a cup of Java, cheers!
Sha Jiang


Wayne Fay wrote:
> 
> Yes, to compile 1.5 classes, you must use a 1.5 (or greater) JRE. But
> you also must set the 1.5 configuration, otherwise it defaults to 1.4
> classes with the 1.5 JRE.
> 
> Wayne
> 
> On 11/11/06, jiangshachina <ji...@gmail.com> wrote:
>>
>> Hello,
>> > <configuration>
>> >     <source>1.5</source>
>> >     <target>1.5</target>
>> > </configuration>
>> If that's true, I'm confused by the settings.
>> Why Maven(or javac) can compile sources to 1.5-compatible classes at
>> 1.4.2JRE(or 1.4.2 javac)?
>> In order to fulfil the requirement, I think must install JDK1.5 firstly.
>> Then use the real jre1.5.0 and configuration quoted above.
>>
>> a cup of Java, cheers!
>> Sha Jiang
>>
>>
>> Julio S. G. wrote:
>> >
>> >    Hi Allan,
>> >
>> >    Add these lines to you pom.xml:
>> >
>> > <project>
>> >   <build>
>> >     <plugins>
>> >       <plugin>
>> >         <artifactId>maven-compiler-plugin</artifactId>
>> >         <configuration>
>> >           <source>1.5</source>
>> >           <target>1.5</target>
>> >         </configuration>
>> >       </plugin>
>> >     </plugins>
>> >   </build>
>> > </project>
>> >
>> > Julio
>> >
>> >
>> > On 11/10/06, Allan Valeriano <va...@longadata.com> wrote:
>> >> Hi all,
>> >>
>> >>
>> >> I'm having problems setting up a new jre to run mvn install.
>> >> My default java version is 1.4.2_11, but I need maven to use jre 5 for
>> >> it.
>> >> I've read the FAQ, but I must say the example for it is not really
>> >> helpful.
>> >> Could somebody give me a hand on this sending a complete example?
>> >>
>> >>
>> >> thanks in advance
>> >> Allan Valeriano
>> >>
>> >>
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> > For additional commands, e-mail: users-help@maven.apache.org
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Setting-up-a-new-jre-to-maven-tf2610500s177.html#a7299977
>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> 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
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Setting-up-a-new-jre-to-maven-tf2610500s177.html#a7300964
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: Setting up a new jre to maven

Posted by Wayne Fay <wa...@gmail.com>.
Yes, to compile 1.5 classes, you must use a 1.5 (or greater) JRE. But
you also must set the 1.5 configuration, otherwise it defaults to 1.4
classes with the 1.5 JRE.

Wayne

On 11/11/06, jiangshachina <ji...@gmail.com> wrote:
>
> Hello,
> > <configuration>
> >     <source>1.5</source>
> >     <target>1.5</target>
> > </configuration>
> If that's true, I'm confused by the settings.
> Why Maven(or javac) can compile sources to 1.5-compatible classes at
> 1.4.2JRE(or 1.4.2 javac)?
> In order to fulfil the requirement, I think must install JDK1.5 firstly.
> Then use the real jre1.5.0 and configuration quoted above.
>
> a cup of Java, cheers!
> Sha Jiang
>
>
> Julio S. G. wrote:
> >
> >    Hi Allan,
> >
> >    Add these lines to you pom.xml:
> >
> > <project>
> >   <build>
> >     <plugins>
> >       <plugin>
> >         <artifactId>maven-compiler-plugin</artifactId>
> >         <configuration>
> >           <source>1.5</source>
> >           <target>1.5</target>
> >         </configuration>
> >       </plugin>
> >     </plugins>
> >   </build>
> > </project>
> >
> > Julio
> >
> >
> > On 11/10/06, Allan Valeriano <va...@longadata.com> wrote:
> >> Hi all,
> >>
> >>
> >> I'm having problems setting up a new jre to run mvn install.
> >> My default java version is 1.4.2_11, but I need maven to use jre 5 for
> >> it.
> >> I've read the FAQ, but I must say the example for it is not really
> >> helpful.
> >> Could somebody give me a hand on this sending a complete example?
> >>
> >>
> >> thanks in advance
> >> Allan Valeriano
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Setting-up-a-new-jre-to-maven-tf2610500s177.html#a7299977
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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: Setting up a new jre to maven

Posted by jiangshachina <ji...@gmail.com>.
Hello,
> <configuration>
>     <source>1.5</source>
>     <target>1.5</target>
> </configuration>
If that's true, I'm confused by the settings.
Why Maven(or javac) can compile sources to 1.5-compatible classes at
1.4.2JRE(or 1.4.2 javac)?
In order to fulfil the requirement, I think must install JDK1.5 firstly.
Then use the real jre1.5.0 and configuration quoted above.

a cup of Java, cheers!
Sha Jiang


Julio S. G. wrote:
> 
>    Hi Allan,
> 
>    Add these lines to you pom.xml:
> 
> <project>
>   <build>
>     <plugins>
>       <plugin>
>         <artifactId>maven-compiler-plugin</artifactId>
>         <configuration>
>           <source>1.5</source>
>           <target>1.5</target>
>         </configuration>
>       </plugin>
>     </plugins>
>   </build>
> </project>
> 
> Julio
> 
> 
> On 11/10/06, Allan Valeriano <va...@longadata.com> wrote:
>> Hi all,
>>
>>
>> I'm having problems setting up a new jre to run mvn install.
>> My default java version is 1.4.2_11, but I need maven to use jre 5 for
>> it.
>> I've read the FAQ, but I must say the example for it is not really
>> helpful.
>> Could somebody give me a hand on this sending a complete example?
>>
>>
>> thanks in advance
>> Allan Valeriano
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Setting-up-a-new-jre-to-maven-tf2610500s177.html#a7299977
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: Setting up a new jre to maven

Posted by "Julio S. G." <ju...@gmail.com>.
   Hi Allan,

   Add these lines to you pom.xml:

<project>
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.5</source>
          <target>1.5</target>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

Julio


On 11/10/06, Allan Valeriano <va...@longadata.com> wrote:
> Hi all,
>
>
> I'm having problems setting up a new jre to run mvn install.
> My default java version is 1.4.2_11, but I need maven to use jre 5 for it.
> I've read the FAQ, but I must say the example for it is not really helpful.
> Could somebody give me a hand on this sending a complete example?
>
>
> thanks in advance
> Allan Valeriano
>
>

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


Re: Setting up a new jre to maven

Posted by Eric Redmond <er...@gmail.com>.
Yes, you naturally need to use a compiler at least as high as the code you
wish to compile in. If your Maven is running on JDK 1.4, and you wish to
compile code as 1.5, you will need a 1.5 compiler. You can point to a
1.5compiler in the following way:

http://maven.apache.org/plugins/maven-compiler-plugin/examples/compile-using-different-jdk.html

Eric

On 11/10/06, Allan Valeriano <va...@longadata.com> wrote:
>
> Hi all,
>
>
> I'm having problems setting up a new jre to run mvn install.
> My default java version is 1.4.2_11, but I need maven to use jre 5 for it.
> I've read the FAQ, but I must say the example for it is not really
> helpful.
> Could somebody give me a hand on this sending a complete example?
>
>
> thanks in advance
> Allan Valeriano
>
>


-- 
Eric Redmond
http://codehaus.org/~eredmond