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 ]--------------------------------- [WARNING] The POM for com.alibaba:druid:jar:1.1.10 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details [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.801 s [INFO] Finished at: 2023-07-19T18:15:08+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 12:14:58 浏览: 210
test-mvn clean install -Dmaven.test.skip=true dependency:sources
根据你提供的日志信息,出现了以下错误:
```
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
```
这个错误提示表明你的环境中没有提供编译器,可能是因为你使用的是 JRE(Java Runtime Environment)而不是 JDK(Java Development Kit)。
Maven 在执行编译操作时需要 JDK 来提供编译器。确保在你的系统中安装了 JDK,并且配置了正确的 Java 环境变量。
请按照以下步骤检查和设置你的 Java 环境:
1. 在命令提示符或终端中运行以下命令,检查你的 Java 版本:
```
java -version
```
这将显示安装在你系统上的 Java 版本。确保显示的是 JDK 版本,而不是 JRE 版本。
2. 如果你没有安装 JDK,或者 `java -version` 命令显示的是 JRE 版本,那么需要下载并安装 JDK。你可以从 Oracle 官网或 OpenJDK 网站下载适合你操作系统的 JDK 版本,并按照安装步骤进行安装。
3. 安装完成后,请确保配置了正确的环境变量。在命令提示符或终端中运行以下命令,检查你的 Java 环境变量设置:
```
echo %JAVA_HOME%
```
这将显示配置的 Java 安装路径。确保它指向你安装的 JDK 目录,例如 `C:\Program Files\Java\jdk1.8.0_291`。
4. 如果环境变量设置不正确,需要进行相应的调整。在操作系统的环境变量设置中,编辑或添加名为 `JAVA_HOME` 的变量,并将其值设置为你的 JDK 安装路径。
5. 重新打开一个新的命令提示符或终端窗口,并再次运行 `java -version` 命令,确保它显示的是 JDK 的版本。
完成上述步骤后,再次运行 `mvn clean package` 命令,应该可以顺利编译和打包你的 Spring Boot 项目。
阅读全文