No Maven maven-compiler-plugin source/target version specified
faal opened this issue · 1 comments
When compiling hdfs-du/pig I got an error:
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Compilation failure
/var/home/fabian/hdfs-du/pig/src/main/java/com/twitter/hdfsdu/pig/piggybank/ExtractSizes.java:[29,42] generics are not supported in -source 1.3
(use -source 5 or higher to enable generics)
public class ExtractSizes extends EvalFunc {
/var/home/fabian/hdfs-du/pig/src/main/java/com/twitter/hdfsdu/pig/piggybank/ExtractSizes.java:[34,29] ';' expected
/var/home/fabian/hdfs-du/pig/src/main/java/com/twitter/hdfsdu/pig/piggybank/ExtractSizes.java:[35,2] not a statement
/var/home/fabian/hdfs-du/pig/src/main/java/com/twitter/hdfsdu/pig/piggybank/ExtractSizes.java:[35,13] ';' expected
I resolved the problem by adding:
-
<plugin>
-
<artifactId>maven-compiler-plugin</artifactId>
-
<version>2.3.2</version>
-
<configuration>
-
<source>1.6</source>
-
<target>1.6</target>
-
<compilerArgument></compilerArgument>
-
</configuration>
-
</plugin>
in pom.xml
Just add the following lines in the plugins section in the pom.xml
files
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
The alternative is to set Java 1.6+
as the default for maven. This can be done by editing ~/.m2/settings.xml
.