Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile

panwar001 picture panwar001 · Mar 3, 2015 · Viewed 22.2k times · Source
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project mrlda: Compilation failure: Compilation failure:

[ERROR] /home/panwar/Downloads/Mr.LDA-master/src/main/java/cc/mrlda/polylda/TermReducer.java:[24,11] error: generics are not supported in -source 1.3

[ERROR] 
[ERROR] (use -source 5 or higher to enable generics)
[ERROR] /home/panwar/Downloads/Mr.LDA-master/src/main/java/cc/mrlda/TermReducer.java:[33,11] error: generics are not supported in -source 1.3 

I'm using latest version of java.

Solved: The problem was with maven. I was using an older version(maven3.0.2) other things were correct.

Answer

Jens picture Jens · Mar 3, 2015

You compile your code for java 1.3 and use generics, which was introduced in java 1.5. You have to change to java 1.5 or higher.

   <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
            <source>1.7</source>
            <target>1.7</target>
        </configuration>
    </plugin>