On Thu, Oct 7, 2010 at 6:44 PM, Stuart McCulloch <[email protected]> wrote:
>> In other words, we can compile with 1.6 and it will run on 1.5?
>
> that's the idea - the animal-sniffer will check you only use Java5 APIs (ie.
> no String.isEmpty, etc.)
> to set the compiler to target Java5 bytecode use:
>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-compiler-plugin</artifactId>
> <configuration>
> <source>1.5</source>
> <target>1.5</target>
> </configuration>
> </plugin>
>
> and you don't even need that if you use v2.3.2 of the compiler plugin, as
> Java5 is now the default:
>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-compiler-plugin</artifactId>
> <version>2.3.2</version>
> </plugin>
I have added the following;
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<!-- This plugin checks that we are JDK1.5 compatible,
even though we are using JDK1.6 to compile. -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
<version>1.6</version>
<configuration>
<signature>
<groupId>org.codehaus.mojo.signature</groupId>
<artifactId>java15</artifactId>
<version>1.0</version>
</signature>
</configuration>
<executions>
<execution>
<id>check-java-1.5-compat</id>
<phase>process-classes</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
(pluginManagement sets the compiler plugin to 2.3.2 on top of that.)
A simple test; Put @Override on a method implementation of a interface
method, illegal in 1.5 but ok in 1.6, is not caught.
How much else is not caught?
I will not hold up the release for this, but I suggest that StreamFlow
gang are acutely aware of this and test extensively on Java5 before
rolling out...
Cheers
--
Niclas Hedhman, Software Developer
http://www.qi4j.org - New Energy for Java
I live here; http://tinyurl.com/2qq9er
I work here; http://tinyurl.com/2ymelc
I relax here; http://tinyurl.com/2cgsug
_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev