You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by mlotfi <ma...@yahoo.com> on 2011/07/24 05:15:48 UTC

generics are not supported in -source 1.3 ??

hi,

I am new to Maven, I have java 1.6 installed in my windows XP, when I run
this :

C:\maj\practices\maven\HotelDatabase>mvn test -Dtest=HotelModelTest
[INFO] Scanning for projects...
[INFO]
------------------------------------------------------------------------
[INFO] Building HotelDatabase
[INFO]    task-segment: [test]
[INFO]
------------------------------------------------------------------------
Downloading:
http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-resour
ces-plugin/2.3/maven-resources-plugin-2.3.pom

Downloading:
http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-resour
ces-plugin/2.3/maven-resources-plugin-2.3.jar

Downloading:
http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-compil
er-plugin/2.0.2/maven-compiler-plugin-2.0.2.pom

Downloading:
http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-plugin
s/8/maven-plugins-8.pom

Downloading:
http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-compil
er-plugin/2.0.2/maven-compiler-plugin-2.0.2.jar

Downloading:
http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-surefi
re-plugin/2.4.3/maven-surefire-plugin-2.4.3.pom

Downloading:
http://repo1.maven.org/maven2/org/apache/maven/surefire/surefire/2.
4.3/surefire-2.4.3.pom

Downloading:
http://repo1.maven.org/maven2/org/apache/maven/maven-parent/7/maven
-parent-7.pom

Downloading:
http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-surefi
re-plugin/2.4.3/maven-surefire-plugin-2.4.3.jar

Downloading:
http://repo1.maven.org/maven2/org/apache/maven/wagon/wagon-provider
-api/1.0-beta-2/wagon-provider-api-1.0-beta-2.pom

Downloading:
http://repo1.maven.org/maven2/org/apache/maven/wagon/wagon/1.0-beta
-2/wagon-1.0-beta-2.pom

Downloading:
http://repo1.maven.org/maven2/org/apache/maven/maven-parent/4/maven
-parent-4.pom

Downloading:
http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-utils/1.5.
6/plexus-utils-1.5.6.pom

Downloading:
http://repo1.maven.org/maven2/org/codehaus/plexus/plexus/1.0.12/ple
xus-1.0.12.pom

Downloading:
http://repo1.maven.org/maven2/org/apache/maven/shared/maven-filteri
ng/1.0-beta-2/maven-filtering-1.0-beta-2.pom

Downloading:
http://repo1.maven.org/maven2/org/apache/maven/shared/maven-shared-
components/10/maven-shared-components-10.pom

Downloading:
http://repo1.maven.org/maven2/org/apache/maven/wagon/wagon-file/1.0
-beta-2/wagon-file-1.0-beta-2.pom

Downloading:
http://repo1.maven.org/maven2/org/apache/maven/wagon/wagon-provider
s/1.0-beta-2/wagon-providers-1.0-beta-2.pom

Downloading:
http://repo1.maven.org/maven2/org/apache/maven/wagon/wagon-http-lig
htweight/1.0-beta-2/wagon-http-lightweight-1.0-beta-2.pom

Downloading:
http://repo1.maven.org/maven2/org/apache/maven/wagon/wagon-http-sha
red/1.0-beta-2/wagon-http-shared-1.0-beta-2.pom

Downloading:
http://repo1.maven.org/maven2/jtidy/jtidy/4aug2000r7-dev/jtidy-4aug
2000r7-dev.pom

Downloading:
http://repo1.maven.org/maven2/org/apache/maven/wagon/wagon-ssh-exte
rnal/1.0-beta-2/wagon-ssh-external-1.0-beta-2.pom

Downloading:
http://repo1.maven.org/maven2/org/apache/maven/wagon/wagon-ssh-comm
on/1.0-beta-2/wagon-ssh-common-1.0-beta-2.pom

Downloading:
http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-container-
default/1.0-alpha-7/plexus-container-default-1.0-alpha-7.pom

Downloading:
http://repo1.maven.org/maven2/plexus/plexus-containers/1.0.2/plexus
-containers-1.0.2.pom

Downloading:
http://repo1.maven.org/maven2/plexus/plexus-root/1.0.3/plexus-root-
1.0.3.pom

Downloading:
http://repo1.maven.org/maven2/plexus/plexus-utils/1.0.2/plexus-util
s-1.0.2.pom

Downloading:
http://repo1.maven.org/maven2/org/apache/maven/wagon/wagon-ssh/1.0-
beta-2/wagon-ssh-1.0-beta-2.pom

Downloading:
http://repo1.maven.org/maven2/com/jcraft/jsch/0.1.27/jsch-0.1.27.po
m

Downloading:
http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-interpolat
ion/1.6/plexus-interpolation-1.6.pom

Downloading:
http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-utils/1.5.
6/plexus-utils-1.5.6.jar
Downloading:
http://repo1.maven.org/maven2/org/apache/maven/shared/maven-filteri
ng/1.0-beta-2/maven-filtering-1.0-beta-2.jar


Downloading:
http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-interpolat
ion/1.6/plexus-interpolation-1.6.jar

[INFO] [resources:resources {execution: default-resources}]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory
C:\maj\practices\maven\HotelDatabase\
src\main\resources
Downloading:
http://repo1.maven.org/maven2/org/apache/maven/maven-plugin-api/2.0
/maven-plugin-api-2.0.pom

Downloading:
http://repo1.maven.org/maven2/org/apache/maven/maven/2.0/maven-2.0.
pom

Downloading:
http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler-a
pi/1.5.3/plexus-compiler-api-1.5.3.pom

Downloading:
http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler/1
.5.3/plexus-compiler-1.5.3.pom

Downloading:
http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-components
/1.1.6/plexus-components-1.1.6.pom

Downloading:
http://repo1.maven.org/maven2/org/codehaus/plexus/plexus/1.0.8/plex
us-1.0.8.pom

Downloading:
http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-container-
default/1.0-alpha-8/plexus-container-default-1.0-alpha-8.pom

Downloading:
http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler-m
anager/1.5.3/plexus-compiler-manager-1.5.3.pom

Downloading:
http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler-j
avac/1.5.3/plexus-compiler-javac-1.5.3.pom

Downloading:
http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compilers/
1.5.3/plexus-compilers-1.5.3.pom

Downloading:
http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-utils/1.0.
5/plexus-utils-1.0.5.pom

Downloading:
http://repo1.maven.org/maven2/org/apache/maven/maven-artifact/2.0/m
aven-artifact-2.0.pom

Downloading:
http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-utils/1.0.
4/plexus-utils-1.0.4.jar

Downloading:
http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler-a
pi/1.5.3/plexus-compiler-api-1.5.3.jar

Downloading:
http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler-m
anager/1.5.3/plexus-compiler-manager-1.5.3.jar

Downloading:
http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler-j
avac/1.5.3/plexus-compiler-javac-1.5.3.jar

[INFO] [compiler:compile {execution: default-compile}]
[INFO] Compiling 2 source files to
C:\maj\practices\maven\HotelDatabase\target\c
lasses
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] Compilation failure

C:\maj\practices\maven\HotelDatabase\src\main\java\com\javaworld\hotels\model\Ho
telModel.java:[39,14] generics are not supported in -source 1.3
(use -source 5 or higher to enable generics)
   public List<Hotel> findHotelsByCity(String city){

C:\maj\practices\maven\HotelDatabase\src\main\java\com\javaworld\hotels\model\Ho
telModel.java:[42,22] for-each loops are not supported in -source 1.3
(use -source 5 or higher to enable for-each loops)
      for(Hotel hotel : hotels) {


[INFO]
------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 29 seconds
[INFO] Finished at: Sat Jul 23 22:56:15 EDT 2011
[INFO] Final Memory: 6M/16M
[INFO]
------------------------------------------------------------------------
C:\maj\practices\maven\HotelDatabase>java -v
Unrecognized option: -v
Could not create the Java virtual machine.

C:\maj\practices\maven\HotelDatabase>java -version
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) Client VM (build 20.1-b02, mixed mode, sharing)

C:\maj\practices\maven\HotelDatabase>

I did not understand why :
BUILD FAILURE

Thanks, your help is appreciated.
Thanks


--
View this message in context: http://maven.40175.n5.nabble.com/generics-are-not-supported-in-source-1-3-tp4627284p4627284.html
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: generics are not supported in -source 1.3 ??

Posted by Wayne Fay <wa...@gmail.com>.
> C:\maj\practices\maven\HotelDatabase\src\main\java\com\javaworld\hotels\model\Ho
> telModel.java:[39,14] generics are not supported in -source 1.3
> (use -source 5 or higher to enable generics)
>
> C:\maj\practices\maven\HotelDatabase\src\main\java\com\javaworld\hotels\model\Ho
> telModel.java:[42,22] for-each loops are not supported in -source 1.3
> (use -source 5 or higher to enable for-each loops)

Next time, please check Google or another search engine before posting
something like this to the list. Or at least search the Nabble forum.
This is such a common question on the list and yet it is documented in
numerous places which tells me that very few people new to Maven know
how to use a search engine.

Wayne

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


Re: generics are not supported in -source 1.3 ??

Posted by Ben Caradoc-Davies <Be...@csiro.au>.
Generics were introduced in Java 5 (JDK 1.5). Using source 1.3 in your 
pom ensures that source files are compatible with JDK 1.3; this 
explicitly disables support for generics.

On 24/07/11 11:15, mlotfi wrote:
> telModel.java:[39,14] generics are not supported in -source 1.3
> (use -source 5 or higher to enable generics)

-- 
Ben Caradoc-Davies <Be...@csiro.au>
Software Engineering Team Leader
CSIRO Earth Science and Resource Engineering
Australian Resources Research Centre

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


Re: generics are not supported in -source 1.3 ??

Posted by mlotfi <ma...@yahoo.com>.
Hi,

I want to learn maven, and I found this tutorial :
http://www.javaworld.com/javaworld/jw-12-2005/jw-1205-maven.html

Here is the pom.xml :

project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.javaworld.hotels</groupId>
  <artifactId>HotelDatabase</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>HotelDatabase</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
</project>


--
View this message in context: http://maven.40175.n5.nabble.com/generics-are-not-supported-in-source-1-3-tp4627284p4629428.html
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: generics are not supported in -source 1.3 ??

Posted by Ben Caradoc-Davies <Be...@csiro.au>.
The defaults for source/target changed only quite recently.
http://jira.codehaus.org/browse/MCOMPILER-124

mlotfi, what version of Maven are you using? Older ones will use older 
plugins and not default to source 1.5.

For older maven versions, you must specify a source version of at least 
1.5 to use generics. You can do this in your pom build section (I 
included a few other options you can tinker with):

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
<debug>true</debug>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</build>

Kind regards,
Ben.



On 25/07/11 09:39, Barrie Treloar wrote:
> On Sun, Jul 24, 2011 at 12:45 PM, mlotfi<ma...@yahoo.com>  wrote:
>> hi,
>>
>> I am new to Maven, I have java 1.6 installed in my windows XP, when I run
>> this :
>
> Did you look at the compiler configuration options?
> http://maven.apache.org/plugins/maven-compiler-plugin/
>
> The default value for source is 1.5
> http://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html#source
>
> How did you write your pom file?
> I suspect you have cut and paste from somewhere that has specified source as 1.3
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

-- 
Ben Caradoc-Davies <Be...@csiro.au>
Software Engineering Team Leader
CSIRO Earth Science and Resource Engineering
Australian Resources Research Centre

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


Re: generics are not supported in -source 1.3 ??

Posted by Barrie Treloar <ba...@gmail.com>.
On Sun, Jul 24, 2011 at 12:45 PM, mlotfi <ma...@yahoo.com> wrote:
> hi,
>
> I am new to Maven, I have java 1.6 installed in my windows XP, when I run
> this :

Did you look at the compiler configuration options?
http://maven.apache.org/plugins/maven-compiler-plugin/

The default value for source is 1.5
http://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html#source

How did you write your pom file?
I suspect you have cut and paste from somewhere that has specified source as 1.3

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