• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

Why is Maven using the wrong JDK?

 
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:

 
Saloon Keeper
Posts: 23033
156
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks guys. This worked. You guys are the best!
 
You save more money with a clothesline than dozens of light bulb purchases. Tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic