• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why is Maven using the wrong JDK?

 
Jehan Jaleel
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
When I am trying to build my project it gives the following error.....

C:\buildarea\eSongBulk\src\main\java\com\hfa\esongbulk\service\HibernateSessionFactory.java:[24,36] generics are not supported in -source 1.3
(try -source 1.5 to enable generics)
private static final ThreadLocal<Session> threadLocal = new ThreadLocal<Session>();

But in my Environment Variables my JAVA_HOME is set to jdk1.5.0_10. Is there any reason why maven is not seeing this? How do I make it to?

Or else can I specify the correct JDK in my pom.xml somehow?

Thanks for any help.
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Like it or not, by default Maven assume that all source is 1.3 compatible. Well, at least that is what I recall reading somewhere but I am not able to locate the source. Of course the useless Maven documentation is completely silent on what the default value is. In other words, when it fires off the compiler, it uses the option "-source 1.3". If you want it to compile code that requires 1.5, you must set the source version like this:

 
Tim Holloway
Saloon Keeper
Pie
Posts: 18281
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Peter Johnson wrote:Like it or not, by default Maven assume that all source is 1.3 compatible. Well, at least that is what I recall reading somewhere but I am not able to locate the source. Of course the useless Maven documentation is completely silent on what the default value is. In other words, when it fires off the compiler, it uses the option "-source 1.3". If you want it to compile code that requires 1.5, you must set the source version like this:



Peter is correct and I ran into the same thing. And if you dig a little deeper you will actually find that fact stated, but Maven's documentation does leave somewhat to be desired. Use his compiler plugin settings (above) and all will be well.
 
Jehan Jaleel
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys. This worked. You guys are the best!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic