I am developing Java software using NetBeans 6.5 IDE (Build 090226) with Maven (4.0.5) using Java (1.6.0_06) on a Fedora system.
I am making an update to some legacy code and I wanted to build a test for it (using JUnit). The code is used with Java 1.5. To provide the test data in the quickest, simplest way possible, I wanted to implement a simple mock data set by extending the ResultSet interface. The problem is, despite having my project set up to build and test with JDK 1.5:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
<fork>true</fork>
<executable>/usr/java/jdk1.5.0_14/bin/javac</executable>
<compilerVersion>1.5</compilerVersion>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!-- snip some non-jvm configuration -->
<jvm>/usr/java/jdk1.5.0_14/bin/java</jvm>
<forkMode>once</forkMode>
</configuration>
</plugin>
the editor still wants to make my class abstract because it thinks I am missing methods which exist in Java 1.6 ResultSet, but which use classes which don't exist in Java 1.5 (NClob and RowId and SQLXML).
My compiler plug-ins seem to be set up correctly -- I can successfully build and run this JUnit test, but my whole source tree is showing error icons (effectively masking any real errors). If I use the 'Go To Source' function (or 'Go To Declaration') on the ResultSet import statement, it brings me to the Java 1.6 source zip, but on a method responds 'Cannot perform Go To Source here'.
What did I miss? How can I get the NetBeans editor window to recognize that this code uses the 1.5 JDK, not the JDK NetBeans was started with?
TIA, Ilane