解决maven报错JAVA_HOME should point to a JDK not a JRE问题

在尝试使用Maven编译项目时遇到错误,提示JAVA_HOME应指向JDK而不是JRE。解决方案是在Maven的bin目录下修改mvn.cmd文件,设置正确的JDK路径。此外,项目中还存在多个依赖项重复声明的问题,以及fastjson依赖项未找到的错误,导致构建失败。
摘要由CSDN通过智能技术生成

在idea terminal界面输入 mvn compile 对项目编译时报错:JAVA_HOME should point to a JDK not a JRE

 

 


解决:在mavem目录bin目录下找到mvn.cmd文件使用记事本打开,在文件第一行输入set JAVA_HOME=D:\Java\jdk1.8.0_101(此处为你的Jdk所在)

 

 

 

"C:\Program Files\Java\jdk1.8.0_131\bin\java" -Dmaven.multiModuleProjectDirectory=F:\app\mbu -Dmaven.home=E:\dev\maven\apache-maven-3.5.2 -Dclassworlds.conf=E:\dev\maven\apache-maven-3.5.2\bin\m2.conf "-javaagent:E:\dev\IntelliJ IDEA 2017.3.4\lib\idea_rt.jar=10052:E:\dev\IntelliJ IDEA 2017.3.4\bin" -Dfile.encoding=UTF-8 -classpath E:\dev\maven\apache-maven-3.5.2\boot\plexus-classworlds-2.5.2.jar org.codehaus.classworlds.Launcher -Didea.version=2017.3.4 -s E:\dev\maven\apache-maven-3.5.2\conf\settings.xml -Dmaven.repo.local=E:\dev\maven\repository_boot test
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.murong.ecp.app:mbu:jar:1.0.1-SNAPSHOT
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: thirdparty:commons-codec:jar -> duplicate declaration of version 1.6 @ line 950, column 21
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: thirdparty:commons-codec:jar -> duplicate declaration of version 1.6 @ line 956, column 21
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: thirdparty:commons-logging:jar -> duplicate declaration of version 1.1 @ line 1028, column 21
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: thirdparty:neethi:jar -> duplicate declaration of version 3.0.3 @ line 1323, column 21
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: thirdparty:slf4j-api:jar -> duplicate declaration of version 1.7.7 @ line 1390, column 21
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: thirdparty:wsdl4j:jar -> duplicate declaration of version 1.5.1 @ line 1518, column 21
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: thirdparty:xmlschema-core:jar -> duplicate declaration of version 2.2.1 @ line 1536, column 21
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: thirdparty:junit:jar -> duplicate declaration of version 4.12 @ line 2184, column 21
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-surefire-plugin is missing. @ line 2366, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building mbu 1.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for thirdparty:fastjson:jar:1.2.76 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.699 s
[INFO] Finished at: 2021-06-15T17:47:08+08:00
[INFO] Final Memory: 8M/155M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project mbu: Could not resolve dependencies for project com.murong.ecp.app:mbu:jar:1.0.1-SNAPSHOT: Failure to find thirdparty:fastjson:jar:1.2.76 in http://192.168.139.188:8081/repository/ecp-releases/ was cached in the local repository, resolution will not be reattempted until the update interval of ecp-releases has elapsed or updates are forced -> [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/DependencyResolutionException

Process finished with exit code 1

 

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值