maven启动报错No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

[INFO] Scanning for projects...

[WARNING]

[WARNING] Some problems were encountered while building the effective model for com.yusys.pro:NewsManagement:war:0.0.1-SNAPSHOT

[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 176, column 23

[WARNING]

[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.

[WARNING]

[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.

[WARNING]

[INFO]                                                                        

[INFO] ------------------------------------------------------------------------

[INFO] Building NewsManagement Maven Webapp 0.0.1-SNAPSHOT

[INFO] ------------------------------------------------------------------------

[INFO]

[INFO] >>> jetty-maven-plugin:8.1.16.v20140903:run (default-cli) > test-compile @ NewsManagement >>>

[INFO]

[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ NewsManagement ---

[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!

[INFO] Copying 5 resources

[INFO]

[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ NewsManagement ---

[INFO] Changes detected - recompiling the module!

[INFO] Compiling 9 source files to D:\worksheet\NewsManagement\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.264 s

[INFO] Finished at: 2018-01-13T08:06:00+08:00

[INFO] Final Memory: 9M/153M

[INFO] ------------------------------------------------------------------------

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project NewsManagement: 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

 这个错误是运行环境的错误,意思是运行时在jre上运行,不是在jdk上运行,故而需要更改运行环境切换在jdk上运行。

解决办法是:window---->preferences选择如下切换

如果没有添加jdk,则add

next

选择jdk的安装包,如下

然后finish,并勾选第一张图的jdk,点击OK ,运行环境切换完成。

 

posted @ 2018-01-13 08:34  醉逍遥_001  阅读(388)  评论(0编辑  收藏  举报