有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java Maven:通过cmd使用Install命令获取编译错误

Compilation error on using Maven Install command

您好,当我使用Maven clean命令时,它成功地运行了,但是当我运行install命令时,我得到了编译错误。下面是我一直犯的错误。谢谢

[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building TigerFinal 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ TigerFinal ---
[INFO] Deleting C:\Users\Shashank_bisht\workspace\TigerFinal\target
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.517 s
[INFO] Finished at: 2016-01-04T22:53:12+05:30
[INFO] Final Memory: 6M/105M
[INFO] ------------------------------------------------------------------------

C:\Users\Shashank_bisht\workspace\TigerFinal>mvn install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building TigerFinal 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ TigerFinal ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\Shashank_bisht\workspace\TigerFinal\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ TigerFinal ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 11 source files to C:\Users\Shashank_bisht\workspace\TigerFinal\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /C:/Users/Shashank_bisht/workspace/TigerFinal/src/main/java/tiger/MyHomepage/Home.java:[11,27] packa
MyHomepageTestCases does not exist
[ERROR] /C:/Users/Shashank_bisht/workspace/TigerFinal/src/main/java/tiger/Utils/AppUtils.java:[14,27] packag
yHomepageTestCases does not exist
[INFO] 2 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.733 s
[INFO] Finished at: 2016-01-04T22:53:26+05:30
[INFO] Final Memory: 17M/153M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile)
project TigerFinal: Compilation failure: Compilation failure:
[ERROR] /C:/Users/Shashank_bisht/workspace/TigerFinal/src/main/java/tiger/MyHomepage/Home.java:[11,27] packa
MyHomepageTestCases does not exist
[ERROR] /C:/Users/Shashank_bisht/workspace/TigerFinal/src/main/java/tiger/Utils/AppUtils.java:[14,27] packag
yHomepageTestCases does not exist
[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) 个答案

  1. # 1 楼答案

    从评论中:

    您需要一个完整的JDK(Java开发工具包),而不是JRE(Java运行时环境)

    从OpenJDK或Oracle下载JDK,然后set the environment variable{}到JDK的根文件夹

    然后重试Maven命令