简体   繁体   English

无法执行目标org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile

[英]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. 我正在使用最新版本的java。

Solved: The problem was with maven. 解决了:问题出在maven身上。 I was using an older version(maven3.0.2) other things were correct. 我使用的是旧版本(maven3.0.2)其他东西都是正确的。

You compile your code for java 1.3 and use generics, which was introduced in java 1.5. 您编译java 1.3的代码并使用java 1.5中引入的泛型。 You have to change to java 1.5 or higher. 您必须更改为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>

You may want to use a higher JDK-("Java"-) Version for the compiler plugin like: 您可能希望为编译器插件使用更高的JDK - (“Java” - )版本,如:

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

Your Maven is reading Java version as 1.6.0_65, Where as the pom.xml says the version is 1.7. 您的Maven正在阅读Java版本1.6.0_65,其中pom.xml表示版本为1.7。

Try installing the required verison. 尝试安装所需的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. 如果已安装,请检查$JAVA_HOME环境变量,它应包含Java JDK 7的路径。如果找不到,请修复环境变量。

also remove the lines: 也删除行:

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

from the pom.xml 来自pom.xml

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Intelij IDEA-无法执行目标org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile - Intelij IDEA - Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile Maven:未能执行目标 org.apache.maven.plugins:maven-compiler-plugin:3.10.1compile: - Maven: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile 无法执行目标org.apache.maven.plugins:maven-compiler-plugin:3.1:compile - Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile 未能执行目标 org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile - Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile Maven-无法使用Java 10执行目标org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile - Maven - Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile Using java 10 Maven构建错误:无法执行目标org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile - Maven build error: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile 无法使用 MAVEN 构建并出现错误 - 无法执行目标 org.apache.maven.plugins:maven-compiler-plugin:3.1:compile - Unable to Build using MAVEN with ERROR - Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile 无法使用MAVEN进行编译并出现错误-无法执行目标org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile - Unable to Build using MAVEN with ERROR - Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile Maven编译错误-无法执行目标org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile - maven compilation error - Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile 无法执行目标org.apache.maven.plugins:maven-compiler-plugin:3.5.1:在项目上编译(default-compile) - Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile (default-compile) on project
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM