关于在Elipse中执行maven install 报错的解决方案

未分类 发表评论

今天从别的地方拿到了一个由maven构建的项目的源码,想在自己的机器上部署一下,按照maven项目的打包部署步骤执行到maven install的时候,出现如下错误:

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building menu 0.0.1
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ menu ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 1 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ menu ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 80 source files to F:\workspace\JobWorkSpace\menu\target\classes
[INFO] -------------------------------------------------------------
[WARNING] COMPILATION WARNING : 
[INFO] -------------------------------------------------------------
[WARNING] /F:/workspace/JobWorkSpace/menu/src/main/java/com/main/config/Test.java:[10,16] sun.misc.BASE64Decoder是内部专用 API, 可能会在未来发行版中删除

[INFO] 5 warnings 
[INFO] -------------------------------------------------------------
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /F:/workspace/JobWorkSpace/menu/srcervice.java:[7,43] 程序包org.springframework.test.annotation不存在
  符号:   类 Rollback
  符号:   类 Rollback
  符号:   类 Rollback
  符号:   类 Rollback
[INFO] 7 errors 
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.871 s
[INFO] Finished at: 2018-01-04T14:24:52+08:00
[INFO] Final Memory: 26M/220M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project menu: Compilation failure: Compilation failure:
[ERROR] /F:/workspace/JobWorkSpace/menu/sre/UserService.java:[7,43] 程序包org.springframework.test.annotation不存在
[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

于是从网上百度解决方案,知道可能是JDK配置的问题,因为maven install需要的不是JRE 而是JDK,更改配置后打包部署成功。

但是网上没有详细的解决方案,我在更改配置的时候也是多次碰壁,现在把详细的更改过程贴出来:

进入到一下界面:



选中JRE SYSTEM LIBRARY,点击EDIT进入到以下界面:



点击Install JRE,进入到以下界面:


选中之后一步步保存即可。

注意,在第二步一定要选择Alternate JRE,我之前选的另外两个都没能成功。


发表评论

电子邮件地址不会被公开。 必填项已用*标注

昵称 *