maven指定jdk路径

您所在的位置:网站首页 maven编译指定jdk版本 maven指定jdk路径

maven指定jdk路径

2023-08-12 02:34| 来源: 网络整理| 查看: 265

mvn clean package

 

Warning: JAVA_HOME environment variable is not set. [INFO] Scanning for projects... [WARNING]  [WARNING] Some problems were encountered while building the effective model for io.nuls.client-module:client:jar:1.1.6 [WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: io.nuls.network-module:network-netty:jar -> duplicate declaration of version 1.1.6 @ line 246, 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] Reactor Build Order: [INFO]  [INFO] nuls [INFO] tools-module [INFO] tools [INFO] core-module [INFO] kernel [INFO] account-module [INFO] account [INFO] db-module [INFO] db [INFO] account-storage [INFO] cache [INFO] network-module [INFO] network [INFO] db-leveldb [INFO] ledger-module [INFO] ledger [INFO] contract-module [INFO] contract [INFO] account-ledger-module [INFO] account-ledger [INFO] protocol-module [INFO] protocol [INFO] message-bus-module [INFO] message-bus [INFO] account-base [INFO] account-rpc [INFO] account-ledger-storage [INFO] consensus-module [INFO] consensus [INFO] account-ledger-base [INFO] account-ledger-rpc [INFO] kernel-rpc [INFO] consensus-poc-storage [INFO] consensus-poc-protocol [INFO] protocol-storage [INFO] ledger-utxo-storage [INFO] ledger-utxo-base [INFO] network-storage [INFO] network-protocol [INFO] network-netty [INFO] protocol-base [INFO] consensus-poc-base [INFO] protocol-rpc [INFO] consensus-poc-rpc [INFO] ledger-utxo-rpc [INFO] network-rpc [INFO] contract-storage [INFO] contract-ledger [INFO] contract-vm [INFO] contract-tx [INFO] contract-base [INFO] contract-rpc [INFO] message-bus-base [INFO] utxo-accounts-module [INFO] utxo-accounts-storage [INFO] utxo-accounts [INFO] utxo-accounts-base [INFO] utxo-accounts-rpc [INFO] client-module [INFO] client [INFO]  [INFO] ------------------------------------------------------------------------ [INFO] Building nuls 1.1.6 [INFO] ------------------------------------------------------------------------ [INFO]  [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ nuls --- [INFO]  [INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-maven) @ nuls --- [INFO]  [INFO] ------------------------------------------------------------------------ [INFO] Building tools-module 1.1.6 [INFO] ------------------------------------------------------------------------ [INFO]  [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ tools-module --- [INFO]  [INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-maven) @ tools-module --- [INFO]  [INFO] ------------------------------------------------------------------------ [INFO] Building tools 1.1.6 [INFO] ------------------------------------------------------------------------ [INFO]  [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ tools --- [INFO] Deleting /opt/soft/nuls/nuls/tools-module/tools/target [INFO]  [INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-maven) @ tools --- [INFO]  [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ tools --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory /opt/soft/nuls/nuls/tools-module/tools/src/main/resources [INFO]  [INFO] --- maven-compiler-plugin:3.2:compile (default-compile) @ tools --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 51 source files to /opt/soft/nuls/nuls/tools-module/tools/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] Reactor Summary: [INFO]  [INFO] nuls ............................................... SUCCESS [ 0.661 s] [INFO] tools-module ....................................... SUCCESS [ 0.015 s] [INFO] tools .............................................. FAILURE [ 0.253 s] [INFO] core-module ........................................ SKIPPED [INFO] kernel ............................................. SKIPPED [INFO] account-module ..................................... SKIPPED [INFO] account ............................................ SKIPPED [INFO] db-module .......................................... SKIPPED [INFO] db ................................................. SKIPPED [INFO] account-storage .................................... SKIPPED [INFO] cache .............................................. SKIPPED [INFO] network-module ..................................... SKIPPED [INFO] network ............................................ SKIPPED [INFO] db-leveldb ......................................... SKIPPED [INFO] ledger-module ...................................... SKIPPED [INFO] ledger ............................................. SKIPPED [INFO] contract-module .................................... SKIPPED [INFO] contract ........................................... SKIPPED [INFO] account-ledger-module .............................. SKIPPED [INFO] account-ledger ..................................... SKIPPED [INFO] protocol-module .................................... SKIPPED [INFO] protocol ........................................... SKIPPED [INFO] message-bus-module ................................. SKIPPED [INFO] message-bus ........................................ SKIPPED [INFO] account-base ....................................... SKIPPED [INFO] account-rpc ........................................ SKIPPED [INFO] account-ledger-storage ............................. SKIPPED [INFO] consensus-module ................................... SKIPPED [INFO] consensus .......................................... SKIPPED [INFO] account-ledger-base ................................ SKIPPED [INFO] account-ledger-rpc ................................. SKIPPED [INFO] kernel-rpc ......................................... SKIPPED [INFO] consensus-poc-storage .............................. SKIPPED [INFO] consensus-poc-protocol ............................. SKIPPED [INFO] protocol-storage ................................... SKIPPED [INFO] ledger-utxo-storage ................................ SKIPPED [INFO] ledger-utxo-base ................................... SKIPPED [INFO] network-storage .................................... SKIPPED [INFO] network-protocol ................................... SKIPPED [INFO] network-netty ...................................... SKIPPED [INFO] protocol-base ...................................... SKIPPED [INFO] consensus-poc-base ................................. SKIPPED [INFO] protocol-rpc ....................................... SKIPPED [INFO] consensus-poc-rpc .................................. SKIPPED [INFO] ledger-utxo-rpc .................................... SKIPPED [INFO] network-rpc ........................................ SKIPPED [INFO] contract-storage ................................... SKIPPED [INFO] contract-ledger .................................... SKIPPED [INFO] contract-vm ........................................ SKIPPED [INFO] contract-tx ........................................ SKIPPED [INFO] contract-base ...................................... SKIPPED [INFO] contract-rpc ....................................... SKIPPED [INFO] message-bus-base ................................... SKIPPED [INFO] utxo-accounts-module ............................... SKIPPED [INFO] utxo-accounts-storage .............................. SKIPPED [INFO] utxo-accounts ...................................... SKIPPED [INFO] utxo-accounts-base ................................. SKIPPED [INFO] utxo-accounts-rpc .................................. SKIPPED [INFO] client-module ...................................... SKIPPED [INFO] client ............................................. SKIPPED [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.648 s [INFO] Finished at: 2018-12-29T14:30:27+08:00 [INFO] Final Memory: 16M/217M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.2:compile (default-compile) on project tools: Compilation failure [ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? [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 [ERROR]  [ERROR] After correcting the problems, you can resume the build with the command [ERROR] mvn -rf :tools

 

 

配置jdk环境变量

vim /etc/profile

JAVA_HOME=/usr/local/jdk1.7.0_79/ JRE_HOME=$JAVA_HOME/jre #注意 jdk10解压后是没有jre目录的所以这里直接配成$JAVA_HOME/即可 去掉jre PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib export JAVA_HOME JRE_HOME PATH CLASSPATH

source /etc/profile  

发现了问题 maven从jre路径中读取的 而非jdk

添加插件 并指定jdk路径

maven-compiler-plugin 3.7.0 true /opt/soft/java/jdk1.8.0_144/bin/javac

 

 

推荐 参考资料 https://www.baeldung.com/maven-java-home-jdk-jre



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3