關於在Elipse中執行maven install 報錯的解決方案
阿新 • • 發佈:2019-02-14
今天從別的地方拿到了一個由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,我之前選的另外兩個都沒能成功。