panwar001
panwar001

Reputation: 173

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

[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.

Upvotes: 2

Views: 24316

Answers (3)

Jens
Jens

Reputation: 69440

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>

Upvotes: 7

Peraiah Karanam
Peraiah Karanam

Reputation: 11

Your Maven is reading Java version as 1.6.0_65, Where as the pom.xml says the version is 1.7.

Try installing the required verison.

If already installed check your $JAVA_HOME environment variable, it should contain the path of Java JDK 7. If you don't find it, fix your environment variable.

also remove the lines:

 <fork>true</fork>
 <executable>${JAVA_1_7_HOME}/bin/javac</executable>

from the pom.xml

Upvotes: 1

JBA
JBA

Reputation: 2844

You may want to use a higher JDK-("Java"-) Version for the compiler plugin like:

<plugin>
      <artifactId>maven-compiler-plugin</artifactId>
      <version>3.2</version>
      <configuration>
        <source>1.7</source>
        <target>1.7</target>
        <showWarnings>true</showWarnings>
        <showDeprecation>true</showDeprecation>
      </configuration>
    </plugin>

Upvotes: 1

Related Questions