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

Javaの最新バージョンを使用しています。

解決済み: 問題は maven にありました。私は古いバージョン(maven3.0.2)を使用していましたが、他のことは正しかったです。

4

3 に答える 3

7

コードを Java 1.3 用にコンパイルし、Java 1.5 で導入されたジェネリックを使用します。Java 1.5 以降に変更する必要があります。

   <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
            <source>1.7</source>
            <target>1.7</target>
        </configuration>
    </plugin>
于 2015-03-03T08:07:53.730 に答える
1

Maven は Java のバージョンを 1.6.0_65 として読み取っていますが、pom.xml にはバージョンが 1.7 であると示されています。

必要なバージョンをインストールしてみてください。

既にインストールされている場合は、$JAVA_HOME環境変数を確認してください。Java JDK 7 のパスが含まれている必要があります。見つからない場合は、環境変数を修正してください。

次の行も削除します。

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

からpom.xml

于 2015-05-26T05:36:35.277 に答える
1

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>
于 2015-03-03T08:08:19.360 に答える