You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by David Smith <Da...@transplace.com> on 2007/05/04 16:46:27 UTC
Maven 2.0.6 using JDK 1.3
I'm having a problem compiling my project with maven 2.0.6. Maven is
using JDK 1.3 to compile the java files that contain generics. The
build fails with an error stating that 1.3 does not support generics.
How do I switch JDKs so that maven will use 1.5 instead of 1.3? My
classpath and path variables both point to 1.5.
---
[INFO] Building Unnamed - com.javaworld.hotels:HotelDatabase:jar:0.0.1
[INFO] task-segment: [package]
[INFO]
------------------------------------------------------------------------
-
---
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
Compiling 2 source files to
C:\workspace.3.2.2\HotelDatabase\target\classes
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] Compilation failure
C:\workspace.3.2.2\HotelDatabase\src\main\java\com\javaworld\hotels\mode
l\HotelM
odel.java:[22,19] generics are not supported in -source 1.3
(try -source 1.5 to enable generics)
public List<Hotel> findHotelsByCity(String city){
C:\workspace.3.2.2\HotelDatabase\src\main\java\com\javaworld\hotels\mode
l\HotelM
odel.java:[24,32] for-each loops are not supported in -source 1.3
(try -source 1.5 to enable for-each loops)
for(Hotel hotel : hotels){
Re: Maven 2.0.6 using JDK 1.3
Posted by copernic Jeremy <co...@gmail.com>.
Add this to your POM.xml:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>
Best regards!
Copernic
On 5/4/07, David Smith <Da...@transplace.com> wrote:
>
> I'm having a problem compiling my project with maven 2.0.6. Maven is
> using JDK 1.3 to compile the java files that contain generics. The
> build fails with an error stating that 1.3 does not support generics.
>
>
>
> How do I switch JDKs so that maven will use 1.5 instead of 1.3? My
> classpath and path variables both point to 1.5.
>
>
>
> ---
>
> [INFO] Building Unnamed - com.javaworld.hotels:HotelDatabase:jar:0.0.1
>
> [INFO] task-segment: [package]
>
> [INFO]
> ------------------------------------------------------------------------
> -
>
> ---
>
> [INFO] [resources:resources]
>
> [INFO] Using default encoding to copy filtered resources.
>
> [INFO] [compiler:compile]
>
> Compiling 2 source files to
> C:\workspace.3.2.2\HotelDatabase\target\classes
>
> [INFO]
> ------------------------------------------------------------------------
>
> [ERROR] BUILD FAILURE
>
> [INFO]
> ------------------------------------------------------------------------
>
> [INFO] Compilation failure
>
>
>
> C:\workspace.3.2.2\HotelDatabase\src\main\java\com\javaworld\hotels\mode
> l\HotelM
>
> odel.java:[22,19] generics are not supported in -source 1.3
>
> (try -source 1.5 to enable generics)
>
> public List<Hotel> findHotelsByCity(String city){
>
>
>
> C:\workspace.3.2.2\HotelDatabase\src\main\java\com\javaworld\hotels\mode
> l\HotelM
>
> odel.java:[24,32] for-each loops are not supported in -source 1.3
>
> (try -source 1.5 to enable for-each loops)
>
> for(Hotel hotel : hotels){
>
>
>
>
Re: Maven 2.0.6 using JDK 1.3
Posted by "Alan D. Salewski" <as...@healthmarketscience.com>.
I think the fact maven-2.x is written in Java should be treated just as
an implementation detail, not as something to be relied upon.
Hypothetically, someone could re-implement maven in something else, and
no Java version would be available from which to infer the version. So I
don't think the java compiler source level should be inferred at build
time.
Also, not specifying the version needed hides information that may be
necessary to have a reproducible build.
OTOH, I would be in favor of such a default being inferred by an
archetype. At archetype:create time, the compiler source level
configuration would be inserted into the created pom.xml. This could
work regardless of the maven implementation language by using the first
found version of Java found by some search alorithm (i.e., $JAVA_HOME,
then $PATH, then /usr/bin, then default to 1.3)
-Al
On Fri, May 04, 2007 at 08:52:07AM -0700, Dan Tran spake thus:
> I totally agree with Paul here, any one else?
>
> On 5/4/07, Paul Gier <pg...@redhat.com> wrote:
> >
> >It seems like a better default behavior for the compiler plugin would be
> >to use the current jvm version.
> >If I'm running maven with jdk1.5 I would expect the compiler plugin to
> >default to source level 1.5.
> >Is there a reason that it can't work like that?
*snip*
--
:: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: ::
::
Alan D. Salewski
Software Developer
Health Market Science, Inc.
:: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: ::
::
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Maven 2.0.6 using JDK 1.3
Posted by Ian Springer <ia...@redhat.com>.
+1
Dan Tran wrote:
> I totally agree with Paul here, any one else?
>
> On 5/4/07, Paul Gier <pg...@redhat.com> wrote:
>>
>> It seems like a better default behavior for the compiler plugin would be
>> to use the current jvm version.
>> If I'm running maven with jdk1.5 I would expect the compiler plugin to
>> default to source level 1.5.
>> Is there a reason that it can't work like that?
>>
>> Wayne Fay wrote:
>> > This is one of the most common questions on this list...
>> >
>> > It has been answered repeatedly -- check the archives at Nabble.
>> >
>> > Also it is very well documented on the Maven website -- both in the
>> > FAQ and in the Maven Compiler plugin docs.
>> >
>> > Google also has numerous links when you search for "maven generics".
>> >
>> > Wayne
>> >
>> > On 5/4/07, David Smith <Da...@transplace.com> wrote:
>> >> I'm having a problem compiling my project with maven 2.0.6. Maven is
>> >> using JDK 1.3 to compile the java files that contain generics. The
>> >> build fails with an error stating that 1.3 does not support generics.
>> >>
>> >>
>> >>
>> >> How do I switch JDKs so that maven will use 1.5 instead of 1.3? My
>> >> classpath and path variables both point to 1.5.
>> >>
>> >>
>> >>
>> >> ---
>> >>
>> >> [INFO] Building Unnamed - com.javaworld.hotels:HotelDatabase:jar:0.0.1
>> >>
>> >> [INFO] task-segment: [package]
>> >>
>> >> [INFO]
>> >>
>> ------------------------------------------------------------------------
>> >> -
>> >>
>> >> ---
>> >>
>> >> [INFO] [resources:resources]
>> >>
>> >> [INFO] Using default encoding to copy filtered resources.
>> >>
>> >> [INFO] [compiler:compile]
>> >>
>> >> Compiling 2 source files to
>> >> C:\workspace.3.2.2\HotelDatabase\target\classes
>> >>
>> >> [INFO]
>> >>
>> ------------------------------------------------------------------------
>> >>
>> >> [ERROR] BUILD FAILURE
>> >>
>> >> [INFO]
>> >>
>> ------------------------------------------------------------------------
>> >>
>> >> [INFO] Compilation failure
>> >>
>> >>
>> >>
>> >>
>> C:\workspace.3.2.2\HotelDatabase\src\main\java\com\javaworld\hotels\mode
>> >> l\HotelM
>> >>
>> >> odel.java:[22,19] generics are not supported in -source 1.3
>> >>
>> >> (try -source 1.5 to enable generics)
>> >>
>> >> public List<Hotel> findHotelsByCity(String city){
>> >>
>> >>
>> >>
>> >>
>> C:\workspace.3.2.2\HotelDatabase\src\main\java\com\javaworld\hotels\mode
>> >> l\HotelM
>> >>
>> >> odel.java:[24,32] for-each loops are not supported in -source 1.3
>> >>
>> >> (try -source 1.5 to enable for-each loops)
>> >>
>> >> for(Hotel hotel : hotels){
>> >>
>> >>
>> >>
>> >>
>> >
>> > ---------------------------------------------------------------------
>> > 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
>>
>>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Maven 2.0.6 using JDK 1.3
Posted by Dan Tran <da...@gmail.com>.
I totally agree with Paul here, any one else?
On 5/4/07, Paul Gier <pg...@redhat.com> wrote:
>
> It seems like a better default behavior for the compiler plugin would be
> to use the current jvm version.
> If I'm running maven with jdk1.5 I would expect the compiler plugin to
> default to source level 1.5.
> Is there a reason that it can't work like that?
>
> Wayne Fay wrote:
> > This is one of the most common questions on this list...
> >
> > It has been answered repeatedly -- check the archives at Nabble.
> >
> > Also it is very well documented on the Maven website -- both in the
> > FAQ and in the Maven Compiler plugin docs.
> >
> > Google also has numerous links when you search for "maven generics".
> >
> > Wayne
> >
> > On 5/4/07, David Smith <Da...@transplace.com> wrote:
> >> I'm having a problem compiling my project with maven 2.0.6. Maven is
> >> using JDK 1.3 to compile the java files that contain generics. The
> >> build fails with an error stating that 1.3 does not support generics.
> >>
> >>
> >>
> >> How do I switch JDKs so that maven will use 1.5 instead of 1.3? My
> >> classpath and path variables both point to 1.5.
> >>
> >>
> >>
> >> ---
> >>
> >> [INFO] Building Unnamed - com.javaworld.hotels:HotelDatabase:jar:0.0.1
> >>
> >> [INFO] task-segment: [package]
> >>
> >> [INFO]
> >>
> ------------------------------------------------------------------------
> >> -
> >>
> >> ---
> >>
> >> [INFO] [resources:resources]
> >>
> >> [INFO] Using default encoding to copy filtered resources.
> >>
> >> [INFO] [compiler:compile]
> >>
> >> Compiling 2 source files to
> >> C:\workspace.3.2.2\HotelDatabase\target\classes
> >>
> >> [INFO]
> >>
> ------------------------------------------------------------------------
> >>
> >> [ERROR] BUILD FAILURE
> >>
> >> [INFO]
> >>
> ------------------------------------------------------------------------
> >>
> >> [INFO] Compilation failure
> >>
> >>
> >>
> >>
> C:\workspace.3.2.2\HotelDatabase\src\main\java\com\javaworld\hotels\mode
> >> l\HotelM
> >>
> >> odel.java:[22,19] generics are not supported in -source 1.3
> >>
> >> (try -source 1.5 to enable generics)
> >>
> >> public List<Hotel> findHotelsByCity(String city){
> >>
> >>
> >>
> >>
> C:\workspace.3.2.2\HotelDatabase\src\main\java\com\javaworld\hotels\mode
> >> l\HotelM
> >>
> >> odel.java:[24,32] for-each loops are not supported in -source 1.3
> >>
> >> (try -source 1.5 to enable for-each loops)
> >>
> >> for(Hotel hotel : hotels){
> >>
> >>
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > 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: Maven 2.0.6 using JDK 1.3
Posted by Thierry Lach <th...@gmail.com>.
That makes perfect sense.
On 5/4/07, Wayne Fay <wa...@gmail.com> wrote:
>
> I believe the reason for this is as follows:
> jdk3 is the lowest common denominator
> pom.xml is supposedly the "one true source" for all data you need to
> know about a project, and builds are supposed to be
> repeatable/reproducible using "only" this information
> automatically picking up and using the current jvm version would mean
> that some important information about the project is not contained in
> the pom
> thus, the default is jdk3, and if you need anything else, you must
> specify it explicitly
>
> Another thing to remember is that Maven produces artifacts which are
> not necessarily used under the same JVM that constructed them.
> Everyone is OK with jdk3 jars (even older app servers) but not
> everyone is OK with jdk5 jars, so the default is jdk3, and if you know
> you can/should be targeting a newer jvm, then you need to explicitly
> configure it as such.
>
> I'm not 100% positive that is the reason, but this is my take on it,
> and it doesn't sound completely crazy... to me at least. ;-)
>
> Wayne
>
> On 5/4/07, Paul Gier <pg...@redhat.com> wrote:
> > It seems like a better default behavior for the compiler plugin would be
> > to use the current jvm version.
> > If I'm running maven with jdk1.5 I would expect the compiler plugin to
> > default to source level 1.5.
> > Is there a reason that it can't work like that?
> >
> > Wayne Fay wrote:
> > > This is one of the most common questions on this list...
> > >
> > > It has been answered repeatedly -- check the archives at Nabble.
> > >
> > > Also it is very well documented on the Maven website -- both in the
> > > FAQ and in the Maven Compiler plugin docs.
> > >
> > > Google also has numerous links when you search for "maven generics".
> > >
> > > Wayne
> > >
> > > On 5/4/07, David Smith <Da...@transplace.com> wrote:
> > >> I'm having a problem compiling my project with maven 2.0.6. Maven is
> > >> using JDK 1.3 to compile the java files that contain generics. The
> > >> build fails with an error stating that 1.3 does not support generics.
> > >>
> > >>
> > >>
> > >> How do I switch JDKs so that maven will use 1.5 instead of 1.3? My
> > >> classpath and path variables both point to 1.5.
> > >>
> > >>
> > >>
> > >> ---
> > >>
> > >> [INFO] Building Unnamed -
> com.javaworld.hotels:HotelDatabase:jar:0.0.1
> > >>
> > >> [INFO] task-segment: [package]
> > >>
> > >> [INFO]
> > >>
> ------------------------------------------------------------------------
> > >> -
> > >>
> > >> ---
> > >>
> > >> [INFO] [resources:resources]
> > >>
> > >> [INFO] Using default encoding to copy filtered resources.
> > >>
> > >> [INFO] [compiler:compile]
> > >>
> > >> Compiling 2 source files to
> > >> C:\workspace.3.2.2\HotelDatabase\target\classes
> > >>
> > >> [INFO]
> > >>
> ------------------------------------------------------------------------
> > >>
> > >> [ERROR] BUILD FAILURE
> > >>
> > >> [INFO]
> > >>
> ------------------------------------------------------------------------
> > >>
> > >> [INFO] Compilation failure
> > >>
> > >>
> > >>
> > >>
> C:\workspace.3.2.2\HotelDatabase\src\main\java\com\javaworld\hotels\mode
> > >> l\HotelM
> > >>
> > >> odel.java:[22,19] generics are not supported in -source 1.3
> > >>
> > >> (try -source 1.5 to enable generics)
> > >>
> > >> public List<Hotel> findHotelsByCity(String city){
> > >>
> > >>
> > >>
> > >>
> C:\workspace.3.2.2\HotelDatabase\src\main\java\com\javaworld\hotels\mode
> > >> l\HotelM
> > >>
> > >> odel.java:[24,32] for-each loops are not supported in -source 1.3
> > >>
> > >> (try -source 1.5 to enable for-each loops)
> > >>
> > >> for(Hotel hotel : hotels){
> > >>
> > >>
> > >>
> > >>
> > >
> > > ---------------------------------------------------------------------
> > > 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
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
Re: Maven 2.0.6 using JDK 1.3
Posted by James Abley <ja...@gmail.com>.
1.3 has been end-of-lifed. Any reason not to make 1.4 the minimum base version?
James
On 04/05/07, Ian Springer <ia...@redhat.com> wrote:
> Nope, that doesn't sound crazy at all. Both of your points make perfect sense. I retract my earlier +1 :-)
>
> One minor quip - the docs should be updated to state the default is 1.3...
> http://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html#source
> http://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html#target
>
> Wayne Fay wrote:
> > I believe the reason for this is as follows:
> > jdk3 is the lowest common denominator
> > pom.xml is supposedly the "one true source" for all data you need to
> > know about a project, and builds are supposed to be
> > repeatable/reproducible using "only" this information
> > automatically picking up and using the current jvm version would mean
> > that some important information about the project is not contained in
> > the pom
> > thus, the default is jdk3, and if you need anything else, you must
> > specify it explicitly
> >
> > Another thing to remember is that Maven produces artifacts which are
> > not necessarily used under the same JVM that constructed them.
> > Everyone is OK with jdk3 jars (even older app servers) but not
> > everyone is OK with jdk5 jars, so the default is jdk3, and if you know
> > you can/should be targeting a newer jvm, then you need to explicitly
> > configure it as such.
> >
> > I'm not 100% positive that is the reason, but this is my take on it,
> > and it doesn't sound completely crazy... to me at least. ;-)
> >
> > Wayne
> >
> > On 5/4/07, Paul Gier <pg...@redhat.com> wrote:
> >> It seems like a better default behavior for the compiler plugin would be
> >> to use the current jvm version.
> >> If I'm running maven with jdk1.5 I would expect the compiler plugin to
> >> default to source level 1.5.
> >> Is there a reason that it can't work like that?
> >>
> >> Wayne Fay wrote:
> >> > This is one of the most common questions on this list...
> >> >
> >> > It has been answered repeatedly -- check the archives at Nabble.
> >> >
> >> > Also it is very well documented on the Maven website -- both in the
> >> > FAQ and in the Maven Compiler plugin docs.
> >> >
> >> > Google also has numerous links when you search for "maven generics".
> >> >
> >> > Wayne
> >> >
> >> > On 5/4/07, David Smith <Da...@transplace.com> wrote:
> >> >> I'm having a problem compiling my project with maven 2.0.6. Maven is
> >> >> using JDK 1.3 to compile the java files that contain generics. The
> >> >> build fails with an error stating that 1.3 does not support generics.
> >> >>
> >> >>
> >> >>
> >> >> How do I switch JDKs so that maven will use 1.5 instead of 1.3? My
> >> >> classpath and path variables both point to 1.5.
> >> >>
> >> >>
> >> >>
> >> >> ---
> >> >>
> >> >> [INFO] Building Unnamed - com.javaworld.hotels:HotelDatabase:jar:0.0.1
> >> >>
> >> >> [INFO] task-segment: [package]
> >> >>
> >> >> [INFO]
> >> >>
> >> ------------------------------------------------------------------------
> >> >> -
> >> >>
> >> >> ---
> >> >>
> >> >> [INFO] [resources:resources]
> >> >>
> >> >> [INFO] Using default encoding to copy filtered resources.
> >> >>
> >> >> [INFO] [compiler:compile]
> >> >>
> >> >> Compiling 2 source files to
> >> >> C:\workspace.3.2.2\HotelDatabase\target\classes
> >> >>
> >> >> [INFO]
> >> >>
> >> ------------------------------------------------------------------------
> >> >>
> >> >> [ERROR] BUILD FAILURE
> >> >>
> >> >> [INFO]
> >> >>
> >> ------------------------------------------------------------------------
> >> >>
> >> >> [INFO] Compilation failure
> >> >>
> >> >>
> >> >>
> >> >>
> >> C:\workspace.3.2.2\HotelDatabase\src\main\java\com\javaworld\hotels\mode
> >> >> l\HotelM
> >> >>
> >> >> odel.java:[22,19] generics are not supported in -source 1.3
> >> >>
> >> >> (try -source 1.5 to enable generics)
> >> >>
> >> >> public List<Hotel> findHotelsByCity(String city){
> >> >>
> >> >>
> >> >>
> >> >>
> >> C:\workspace.3.2.2\HotelDatabase\src\main\java\com\javaworld\hotels\mode
> >> >> l\HotelM
> >> >>
> >> >> odel.java:[24,32] for-each loops are not supported in -source 1.3
> >> >>
> >> >> (try -source 1.5 to enable for-each loops)
> >> >>
> >> >> for(Hotel hotel : hotels){
> >> >>
> >> >>
> >> >>
> >> >>
> >> >
> >> > ---------------------------------------------------------------------
> >> > 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
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > 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
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Maven 2.0.6 using JDK 1.3
Posted by Ian Springer <ia...@redhat.com>.
Nope, that doesn't sound crazy at all. Both of your points make perfect sense. I retract my earlier +1 :-)
One minor quip - the docs should be updated to state the default is 1.3...
http://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html#source
http://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html#target
Wayne Fay wrote:
> I believe the reason for this is as follows:
> jdk3 is the lowest common denominator
> pom.xml is supposedly the "one true source" for all data you need to
> know about a project, and builds are supposed to be
> repeatable/reproducible using "only" this information
> automatically picking up and using the current jvm version would mean
> that some important information about the project is not contained in
> the pom
> thus, the default is jdk3, and if you need anything else, you must
> specify it explicitly
>
> Another thing to remember is that Maven produces artifacts which are
> not necessarily used under the same JVM that constructed them.
> Everyone is OK with jdk3 jars (even older app servers) but not
> everyone is OK with jdk5 jars, so the default is jdk3, and if you know
> you can/should be targeting a newer jvm, then you need to explicitly
> configure it as such.
>
> I'm not 100% positive that is the reason, but this is my take on it,
> and it doesn't sound completely crazy... to me at least. ;-)
>
> Wayne
>
> On 5/4/07, Paul Gier <pg...@redhat.com> wrote:
>> It seems like a better default behavior for the compiler plugin would be
>> to use the current jvm version.
>> If I'm running maven with jdk1.5 I would expect the compiler plugin to
>> default to source level 1.5.
>> Is there a reason that it can't work like that?
>>
>> Wayne Fay wrote:
>> > This is one of the most common questions on this list...
>> >
>> > It has been answered repeatedly -- check the archives at Nabble.
>> >
>> > Also it is very well documented on the Maven website -- both in the
>> > FAQ and in the Maven Compiler plugin docs.
>> >
>> > Google also has numerous links when you search for "maven generics".
>> >
>> > Wayne
>> >
>> > On 5/4/07, David Smith <Da...@transplace.com> wrote:
>> >> I'm having a problem compiling my project with maven 2.0.6. Maven is
>> >> using JDK 1.3 to compile the java files that contain generics. The
>> >> build fails with an error stating that 1.3 does not support generics.
>> >>
>> >>
>> >>
>> >> How do I switch JDKs so that maven will use 1.5 instead of 1.3? My
>> >> classpath and path variables both point to 1.5.
>> >>
>> >>
>> >>
>> >> ---
>> >>
>> >> [INFO] Building Unnamed - com.javaworld.hotels:HotelDatabase:jar:0.0.1
>> >>
>> >> [INFO] task-segment: [package]
>> >>
>> >> [INFO]
>> >>
>> ------------------------------------------------------------------------
>> >> -
>> >>
>> >> ---
>> >>
>> >> [INFO] [resources:resources]
>> >>
>> >> [INFO] Using default encoding to copy filtered resources.
>> >>
>> >> [INFO] [compiler:compile]
>> >>
>> >> Compiling 2 source files to
>> >> C:\workspace.3.2.2\HotelDatabase\target\classes
>> >>
>> >> [INFO]
>> >>
>> ------------------------------------------------------------------------
>> >>
>> >> [ERROR] BUILD FAILURE
>> >>
>> >> [INFO]
>> >>
>> ------------------------------------------------------------------------
>> >>
>> >> [INFO] Compilation failure
>> >>
>> >>
>> >>
>> >>
>> C:\workspace.3.2.2\HotelDatabase\src\main\java\com\javaworld\hotels\mode
>> >> l\HotelM
>> >>
>> >> odel.java:[22,19] generics are not supported in -source 1.3
>> >>
>> >> (try -source 1.5 to enable generics)
>> >>
>> >> public List<Hotel> findHotelsByCity(String city){
>> >>
>> >>
>> >>
>> >>
>> C:\workspace.3.2.2\HotelDatabase\src\main\java\com\javaworld\hotels\mode
>> >> l\HotelM
>> >>
>> >> odel.java:[24,32] for-each loops are not supported in -source 1.3
>> >>
>> >> (try -source 1.5 to enable for-each loops)
>> >>
>> >> for(Hotel hotel : hotels){
>> >>
>> >>
>> >>
>> >>
>> >
>> > ---------------------------------------------------------------------
>> > 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
>>
>>
>
> ---------------------------------------------------------------------
> 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: Maven 2.0.6 using JDK 1.3
Posted by Wayne Fay <wa...@gmail.com>.
I believe the reason for this is as follows:
jdk3 is the lowest common denominator
pom.xml is supposedly the "one true source" for all data you need to
know about a project, and builds are supposed to be
repeatable/reproducible using "only" this information
automatically picking up and using the current jvm version would mean
that some important information about the project is not contained in
the pom
thus, the default is jdk3, and if you need anything else, you must
specify it explicitly
Another thing to remember is that Maven produces artifacts which are
not necessarily used under the same JVM that constructed them.
Everyone is OK with jdk3 jars (even older app servers) but not
everyone is OK with jdk5 jars, so the default is jdk3, and if you know
you can/should be targeting a newer jvm, then you need to explicitly
configure it as such.
I'm not 100% positive that is the reason, but this is my take on it,
and it doesn't sound completely crazy... to me at least. ;-)
Wayne
On 5/4/07, Paul Gier <pg...@redhat.com> wrote:
> It seems like a better default behavior for the compiler plugin would be
> to use the current jvm version.
> If I'm running maven with jdk1.5 I would expect the compiler plugin to
> default to source level 1.5.
> Is there a reason that it can't work like that?
>
> Wayne Fay wrote:
> > This is one of the most common questions on this list...
> >
> > It has been answered repeatedly -- check the archives at Nabble.
> >
> > Also it is very well documented on the Maven website -- both in the
> > FAQ and in the Maven Compiler plugin docs.
> >
> > Google also has numerous links when you search for "maven generics".
> >
> > Wayne
> >
> > On 5/4/07, David Smith <Da...@transplace.com> wrote:
> >> I'm having a problem compiling my project with maven 2.0.6. Maven is
> >> using JDK 1.3 to compile the java files that contain generics. The
> >> build fails with an error stating that 1.3 does not support generics.
> >>
> >>
> >>
> >> How do I switch JDKs so that maven will use 1.5 instead of 1.3? My
> >> classpath and path variables both point to 1.5.
> >>
> >>
> >>
> >> ---
> >>
> >> [INFO] Building Unnamed - com.javaworld.hotels:HotelDatabase:jar:0.0.1
> >>
> >> [INFO] task-segment: [package]
> >>
> >> [INFO]
> >> ------------------------------------------------------------------------
> >> -
> >>
> >> ---
> >>
> >> [INFO] [resources:resources]
> >>
> >> [INFO] Using default encoding to copy filtered resources.
> >>
> >> [INFO] [compiler:compile]
> >>
> >> Compiling 2 source files to
> >> C:\workspace.3.2.2\HotelDatabase\target\classes
> >>
> >> [INFO]
> >> ------------------------------------------------------------------------
> >>
> >> [ERROR] BUILD FAILURE
> >>
> >> [INFO]
> >> ------------------------------------------------------------------------
> >>
> >> [INFO] Compilation failure
> >>
> >>
> >>
> >> C:\workspace.3.2.2\HotelDatabase\src\main\java\com\javaworld\hotels\mode
> >> l\HotelM
> >>
> >> odel.java:[22,19] generics are not supported in -source 1.3
> >>
> >> (try -source 1.5 to enable generics)
> >>
> >> public List<Hotel> findHotelsByCity(String city){
> >>
> >>
> >>
> >> C:\workspace.3.2.2\HotelDatabase\src\main\java\com\javaworld\hotels\mode
> >> l\HotelM
> >>
> >> odel.java:[24,32] for-each loops are not supported in -source 1.3
> >>
> >> (try -source 1.5 to enable for-each loops)
> >>
> >> for(Hotel hotel : hotels){
> >>
> >>
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > 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
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Maven 2.0.6 using JDK 1.3
Posted by Paul Gier <pg...@redhat.com>.
It seems like a better default behavior for the compiler plugin would be
to use the current jvm version.
If I'm running maven with jdk1.5 I would expect the compiler plugin to
default to source level 1.5.
Is there a reason that it can't work like that?
Wayne Fay wrote:
> This is one of the most common questions on this list...
>
> It has been answered repeatedly -- check the archives at Nabble.
>
> Also it is very well documented on the Maven website -- both in the
> FAQ and in the Maven Compiler plugin docs.
>
> Google also has numerous links when you search for "maven generics".
>
> Wayne
>
> On 5/4/07, David Smith <Da...@transplace.com> wrote:
>> I'm having a problem compiling my project with maven 2.0.6. Maven is
>> using JDK 1.3 to compile the java files that contain generics. The
>> build fails with an error stating that 1.3 does not support generics.
>>
>>
>>
>> How do I switch JDKs so that maven will use 1.5 instead of 1.3? My
>> classpath and path variables both point to 1.5.
>>
>>
>>
>> ---
>>
>> [INFO] Building Unnamed - com.javaworld.hotels:HotelDatabase:jar:0.0.1
>>
>> [INFO] task-segment: [package]
>>
>> [INFO]
>> ------------------------------------------------------------------------
>> -
>>
>> ---
>>
>> [INFO] [resources:resources]
>>
>> [INFO] Using default encoding to copy filtered resources.
>>
>> [INFO] [compiler:compile]
>>
>> Compiling 2 source files to
>> C:\workspace.3.2.2\HotelDatabase\target\classes
>>
>> [INFO]
>> ------------------------------------------------------------------------
>>
>> [ERROR] BUILD FAILURE
>>
>> [INFO]
>> ------------------------------------------------------------------------
>>
>> [INFO] Compilation failure
>>
>>
>>
>> C:\workspace.3.2.2\HotelDatabase\src\main\java\com\javaworld\hotels\mode
>> l\HotelM
>>
>> odel.java:[22,19] generics are not supported in -source 1.3
>>
>> (try -source 1.5 to enable generics)
>>
>> public List<Hotel> findHotelsByCity(String city){
>>
>>
>>
>> C:\workspace.3.2.2\HotelDatabase\src\main\java\com\javaworld\hotels\mode
>> l\HotelM
>>
>> odel.java:[24,32] for-each loops are not supported in -source 1.3
>>
>> (try -source 1.5 to enable for-each loops)
>>
>> for(Hotel hotel : hotels){
>>
>>
>>
>>
>
> ---------------------------------------------------------------------
> 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: Maven 2.0.6 using JDK 1.3
Posted by Wayne Fay <wa...@gmail.com>.
This is one of the most common questions on this list...
It has been answered repeatedly -- check the archives at Nabble.
Also it is very well documented on the Maven website -- both in the
FAQ and in the Maven Compiler plugin docs.
Google also has numerous links when you search for "maven generics".
Wayne
On 5/4/07, David Smith <Da...@transplace.com> wrote:
> I'm having a problem compiling my project with maven 2.0.6. Maven is
> using JDK 1.3 to compile the java files that contain generics. The
> build fails with an error stating that 1.3 does not support generics.
>
>
>
> How do I switch JDKs so that maven will use 1.5 instead of 1.3? My
> classpath and path variables both point to 1.5.
>
>
>
> ---
>
> [INFO] Building Unnamed - com.javaworld.hotels:HotelDatabase:jar:0.0.1
>
> [INFO] task-segment: [package]
>
> [INFO]
> ------------------------------------------------------------------------
> -
>
> ---
>
> [INFO] [resources:resources]
>
> [INFO] Using default encoding to copy filtered resources.
>
> [INFO] [compiler:compile]
>
> Compiling 2 source files to
> C:\workspace.3.2.2\HotelDatabase\target\classes
>
> [INFO]
> ------------------------------------------------------------------------
>
> [ERROR] BUILD FAILURE
>
> [INFO]
> ------------------------------------------------------------------------
>
> [INFO] Compilation failure
>
>
>
> C:\workspace.3.2.2\HotelDatabase\src\main\java\com\javaworld\hotels\mode
> l\HotelM
>
> odel.java:[22,19] generics are not supported in -source 1.3
>
> (try -source 1.5 to enable generics)
>
> public List<Hotel> findHotelsByCity(String city){
>
>
>
> C:\workspace.3.2.2\HotelDatabase\src\main\java\com\javaworld\hotels\mode
> l\HotelM
>
> odel.java:[24,32] for-each loops are not supported in -source 1.3
>
> (try -source 1.5 to enable for-each loops)
>
> for(Hotel hotel : hotels){
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org