This week's book giveaway is in the JDBC and Relational Databases forum.
We're giving away four copies of Murach's MySQL and have Joel Murach on-line!
See this thread for details.
Win a copy of Murach's MySQL this week in the JDBC and Relational Databases forum!
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

A strange compile error with Maven2

 
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When trying to "clean install" with maven2 I receive an error like this.

RoutingDataSource is not abstract and does not override method isWrapperFor(java.Lang.Class<?> in java.sql.Wrapper

But when I do a clean under Eclipse - Project the classes are compiled without any error, including this RoutingDataSource I have. Then I do a simple "install" with maven and it compiles fine. Because I never change the RoutingDataSource this is never altered and never need recompiling I could compile this once in eclipse and then just do a mvn install to get the war file. But I would like to be able to go mvn clean install.

RoutingDataSource is an implementation of Spring AbstractRoutingDataSource
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
java.sql.Wrapper is a new interface in Java 6. Many JDBC interfaces extend it, so these interfaces have a few new abstract methods. That means that any Java 5 code which implements (for example) javax.sql.DataSource will not compile with JDK 1.6, because those methods will go unimplemented! Isn't that special! I've had this sort of problem in the past, and it's always annoying when Sun makes a change like this.

Just to be perfectly clear: it looks like you're compiling with JDK 1.6 under Maven, and JDK 1.5 within Eclipse. If there's a Spring version for JDK 1.6 yet, then you need to get it. If not, then your choices are (1) Don't use JDK 1.6, or (2) implement the methods of java.sql.Wrapper in your concrete subclass as a workaround.
 
Sverre Moe
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have spesifically defined both in eclipse that Java 1.5 should be used.

In Eclipse I have set Java 1.5.0_12 to be the default Java versjon and my maven configuration file has explicit 1.5 compiling

<plugin>
<groupId></groupId>
<artifactId></artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>

My JAVA_HOME is set to the path to Java 1.5.0_12, but yet is seems when starting Java -version in command line gives the 1.6 version. Perhaps thats where the problem is
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you compile with javac from JDK 1.6, then it's going to use the 1.6 libraries, which will have this problem, even if you specify -source 1.5. The -source and -target switches don't actually check that your library usage conforms to the targeted JVM version.
 
Sverre Moe
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How can I get Maven to use Java 1.5 instead of 1.6 without having to uninstall the 1.6 version?
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Now that this is a "how do I configure Maven" question, I'll move it to a more appropriate forum.
 
this llama doesn't want your drama, he just wants this tiny ad for his mama
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic