Maven构建错误

时间:2018-06-01 12:23:30

标签: java eclipse maven

我在尝试进行maven构建时遇到以下错误。

无法执行目标org.apache.maven.plugins:maven-compiler-plugin:3.7.0:在项目上编译(default-compile)

Maven版本是3.5.3。 maven编译器插件版本是3.7.0。因为它有什么问题吗?

我安装了jdk1.8。所以,这是在eclipse中使用的默认版本 pom.xml中指定的插件如下(自动生成)。

<plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.7.0</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-war-plugin</artifactId>
        <version>3.0.0</version>
        <configuration>
          <warSourceDirectory>WebContent</warSourceDirectory>
        </configuration>
      </plugin>
    </plugins>

我的是一个春天的mvc项目。我认为,我的代码和代码配置是正确的。 maven有问题。我删除了.me / repository。但没有改变。 IDE使用的是Eclipse Oxygen。

包括完整日志

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building SpringEg1.0 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ SpringMVC ---
[INFO] Deleting C:\Users\Sreevidya Aravind\eclipse-workspace\SpringExample\target
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ SpringMVC ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\Sreevidya Aravind\eclipse-workspace\SpringExample\src\main\resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ SpringMVC ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 1 source file to C:\Users\Sreevidya Aravind\eclipse-workspace\SpringExample\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.225 s
[INFO] Finished at: 2018-06-01T18:07:39+05:30
[INFO] Final Memory: 9M/112M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project SpringMVC: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

1 个答案:

答案 0 :(得分:0)

请尝试从下面的路径编辑jre,使其指向jdk -

窗口&gt;偏好&gt; Java&gt;已安装的JRE