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 <[EMAIL PROTECTED]> 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){