Try 'maven clean' first then recompile. Somehow if the class files exist in target dir, the compiler may not overwrite them. These class files may have been compiled in 1.5 prior to your changes to pom.xml
Cheers, AK -----Original Message----- From: Mang Jun Lau [mailto:[EMAIL PROTECTED] Sent: Tuesday, 28 March 2006 8:28 AM To: [email protected] Subject: [M2] Compiling with JDK 1.4 Hi, I've searched and tried the methods given before but things haven't been working for me. My JAVA_HOME points to the 1.5 JDK. I would like to compile my code to be able to run under JDK 1.4. So, in my master POM, I have: <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <compilerVersion>1.4</compilerVersion> <source>1.4</source> <target>1.4</target> </configuration> </plugin> </plugins> </build> I've tried different permutations of the <compilerVersion>, <source>, and <target> tags being present and not, all to no avail. The code compiles in all instances but when I execute the code, I get the exception: java.lang.NoSuchMethodError: java.math.BigDecimal: method <init>(I)V not found I googled this and I know it's because the 1.5 API has a new "int" constructor. This means that my code is still being compiled with the 1.5 JDK. How can I get Maven to compile with the 1.4 JDK? I've even tried setting the <executable> tag to point to the 1.4 javac. The only way it works is if I point my JAVA_HOME to the 1.4 JDK, which I can't do because there are other applications that need to be compiled with 1.5 on the same machine. Hope someone has done this successfully before. Thanks. _Mang Lau --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
