为了账号安全,请及时绑定邮箱和手机立即绑定

在项目中执行mvn package的时候出现异常

在项目中执行mvn package的时候出现异常

肥皂起泡泡 2019-03-01 10:36:24
pom.xml <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> In Windows [INFO] --- maven-jar-plugin:2.6:jar (default-jar) @ todoapp --- [INFO] Building jar: C:\Dev\workspace-ansb\spring-boot\spring-boot-backend\target\todoapp-0.0.1-SNAPSHOT.jar [INFO] --- spring-boot-maven-plugin:1.5.6.RELEASE:repackage (default) @ todoapp In CentOS [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ todoapp --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 1 resource [INFO] Copying 0 resource [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ todoapp --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 4 source files to /opt/spring-boot/spring-boot-backend/target/classes [INFO] ------------------------------------------------------------- [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: 2.494 s [INFO] Finished at: 2017-08-28T16:09:08+08:00 [INFO] Final Memory: 15M/36M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project todoapp: 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 [root@admin]# echo $JAVA_HOME /usr/lib/jvm/jre-1.8.0-openjdk [root@admin]# echo $PATH /usr/local/apache-maven/bin:/usr/local/apache-maven/bin:/usr/local/apache-maven/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/lib/jvm/jre-1.8.0-openjdk/bin:/root/bin:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.141-1.b16.el7_3.x86_64/bin:/usr/lib/jvm/jre-1.8.0-openjdk/bin JAVA_HOME 和PATH 都配置了。 发现一个问题,不知道什么原因在centos里面是用的maven-resources-plugin:2.6:resources和maven-compiler-plugin:3.1:compile;在windows里面是用的maven-jar-plugin:2.6:jar 和 spring-boot-maven-plugin:1.5.6.RELEASE:repackage;
查看完整描述

1 回答

?
慕的地8271018

TA贡献1796条经验 获得超4个赞

No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

看人家给出的错误提示,你的JAVA_HOME指向了JRE,而不是JDK

查看完整回答
反对 回复 2019-03-01
  • 1 回答
  • 0 关注
  • 643 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信