We recently started using Atlassian’s continuous Integration server – Bamboo for our continuous builds.
The project compiles fine on Eclipse IDE and also works properly on the command line (using the command mvn compile).
However when the built is done on Bamboo, we get the following errors:
annotations are not supported in -source 1.3
(use -source 5 or higher to enable annotations)
@Override
generics are not supported in -source 1.3
(use -source 5 or higher to enable generics)
private List<String> errorDetails;
We were confused because in Bamboo Build Resources configuration in the Administration section the JDK was set to JDK 1.6.0_23, so we shouldn’t be having problems with annotations or generics.
Turns out that Maven using JDK 1.3 by default for compiling, building and packaging.
The solution
Include the maven plugin compiler in the pom.xml and specify the JDK version.
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin>
Now Maven will use JDK 1.6 for compilations, building and packaging