ソースのバージョン
初期設定では @Override など注釈(アノテーション)を使用するとコンパイルで次のようなエラーになる。
FooBar.java:[25,2] 注釈は -source 1.3 でサポートされていません (注釈を使用可能にするには、-source 5 以降を使用してください) @Override
Maven の初期設定は 1.3 になっているためなので、1.5以上を指定する。pom.xml に次の記述を追加するとうまくいく。
<project> [...] <build> [...] <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.5</source> <target>1.5</target> </configuration> </plugin> </plugins> [...] </build> [...] </project>
Setting the -source and -target of the Java Compiler
http://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html