D:\004 newCoinInfo>mvn clean package [INFO] Scanning for projects... [INFO] [INFO] ------------------------< com.example:test_reg >------------------------ [INFO] Building test_reg 0.0.1-SNAPSHOT [INFO] from pom.xml [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- clean:3.2.0:clean (default-clean) @ test_reg --- [INFO] Deleting D:\004 newCoinInfo\target [INFO] [INFO] --- resources:3.2.0:resources (default-resources) @ test_reg --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Using 'UTF-8' encoding to copy filtered properties files. [INFO] Copying 1 resource [INFO] Copying 1 resource [INFO] [INFO] --- compiler:3.10.1:compile (default-compile) @ test_reg --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 7 source files to D:\004 newCoinInfo\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: 0.826 s [INFO] Finished at: 2023-07-19T19:21:47+08:00 [INFO] ------------------------------------------------------------------------ [WARNING] [WARNING] Plugin validation issues were detected in 2 plugin(s) [WARNING] [WARNING] * org.apache.maven.plugins:maven-resources-plugin:3.2.0 [WARNING] * org.apache.maven.plugins:maven-compiler-plugin:3.10.1 [WARNING] [WARNING] For more or less details, use 'maven.plugin.validation' property with one of the values (case insensitive): [BRIEF, DEFAULT, VERBOSE] [WARNING] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile (default-compile) on project test_reg: Compilation failure [ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? [ERROR] [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
时间: 2023-07-24 13:14:15 浏览: 188
根据错误信息,你的Maven构建失败,提示没有提供编译器,可能是因为你正在使用JRE而不是JDK。
请按照以下步骤检查和解决问题:
1. 确保已经正确安装了JDK(Java Development Kit)。你可以从Oracle官网(https://www.oracle.com/java/technologies/javase-jdk11-downloads.html)下载适合你操作系统的JDK安装包,并按照官方指南进行安装。注意,在安装过程中,请选择添加JDK到系统的环境变量中。
2. 检查你的系统环境变量设置。在Windows系统中,右键点击"计算机"或"此电脑",选择 "属性",然后点击 "高级系统设置"。在弹出窗口中,点击 "环境变量" 按钮。在 "系统变量" 部分,查找名为 "JAVA_HOME" 的变量,确保其指向你安装的JDK的路径,例如:"C:\Program Files\Java\jdk1.8.0_301"。同时,确保你已经将JDK的bin目录添加到系统的Path变量中。
3. 重新启动终端或命令提示符窗口,以确保新的环境变量生效。
完成以上步骤后,再次运行 `mvn clean package` 命令进行构建,应该可以正常执行了。如果问题仍然存在,请确保你的Java环境设置正确,并确保Maven也是正确配置的。
阅读全文