首页 > 编程语言 >【Elasticsearch】系统已经配置了JAVA_HOME,ElasticSearch源码还是操作gradle失败(JAVA_HOME must be set to build Elasticse

【Elasticsearch】系统已经配置了JAVA_HOME,ElasticSearch源码还是操作gradle失败(JAVA_HOME must be set to build Elasticse

时间:2024-05-15 12:51:58浏览次数:19  
标签:java sun idea gradle version Elasticsearch HOME JAVA true

先看下报错内容吧,如下:

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* Where:
Build file '/Users/liubolun/IdeaProjects/elasticsearch/benchmarks/build.gradle' line: 20

* What went wrong:
A problem occurred evaluating project ':benchmarks'.
> Failed to apply plugin [id 'elasticsearch.build']
   >  {awt.toolkit=sun.lwawt.macosx.LWCToolkit, java.specification.version=11, kotlinx.coroutines.debug=off, sun.cpu.isalist=, sun.jnu.encoding=UTF-8, sun.arch.data.model=64, idea.fatal.error.notification=disabled, pty4j.preferred.native.folder=/Applications/IntelliJ IDEA.app/Contents/lib/pty4j, java.vendor.url=https://adoptium.net/, sun.boot.library.path=/Users/liubolun/Library/Java/JavaVirtualMachines/temurin-11.0.14.1/Contents/Home/lib, sun.java.command=org.gradle.launcher.daemon.bootstrap.GradleDaemon 5.4.1, jdk.debug=release, aether.connector.resumeDownloads=false, com.apple.mrj.application.live-resize=false, java.specification.vendor=Oracle Corporation, java.version.date=2024-01-16, java.home=/Users/liubolun/Library/Java/JavaVirtualMachines/temurin-11.0.14.1/Contents/Home, file.separator=/, java.vm.compressedOopsMode=Zero based, line.separator=
     , java.specification.name=Java Platform API Specification, java.vm.specification.vendor=Oracle Corporation, jdk.attach.allowAttachSelf=true, jbr.virtualization.information=No virtualization detected, user.script=Hans, sun.management.compiler=HotSpot 64-Bit Tiered Compilers, java.runtime.version=11.0.14.1+1, user.name=liubolun, javax.swing.rebaseCssSizeMap=true, idea.paths.selector=IntelliJIdea2023.3, file.encoding=UTF-8, jnidispatch.path=/Applications/IntelliJ IDEA.app/Contents/lib/jna/amd64/libjnidispatch.jnilib, https.nonProxyHosts=*.github.com|plugins.jetbrains.com, idea.popup.weight=heavy, idea.sync.active=true, java.vendor.version=JBR-17.0.10+1-1087.23-jcef, idea.gradle.download.sources=false, jna.loaded=true, java.io.tmpdir=/var/folders/r_/jcb0k0wn2zjcmqjrh0p81fmr0000gn/T/, idea.version=2023.3.6, java.version=11.0.14.1, idea.xdebug.key=-Xdebug, java.vm.specification.name=Java Virtual Machine Specification, java.awt.printerjob=sun.lwawt.macosx.CPrinterJob, sun.os.patch.level=unknown, native.encoding=UTF-8, java.library.path=/Users/liubolun/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:., java.vendor=Eclipse Adoptium, io.netty.processId=53003, sun.io.unicode.encoding=UnicodeBig, java.rmi.server.disableHttp=true, library.jansi.path=/Users/liubolun/.gradle/native/jansi/1.17.1/osx, io.netty.machineId=28:f0:76:ff:fe:16:65:0e, gopherProxySet=false, idea.active=true, java.class.path=/Users/liubolun/.gradle/wrapper/dists/gradle-5.4.1-all/3221gyojl5jsh0helicew7rwx/gradle-5.4.1/lib/gradle-launcher-5.4.1.jar, java.vm.vendor=Eclipse Adoptium, idea.vendor.name=JetBrains, user.variant=, idea.resolveSourceSetDependencies=true, user.timezone=Asia/Shanghai, jb.vmOptionsFile=/Users/liubolun/ja-netfilter/vmoptions/idea.vmoptions, idea.no.launcher=false, swing.bufferPerWindow=true, os.name=Mac OS X, java.vm.specification.version=11, apple.laf.useScreenMenuBar=false, user.country=CN, sun.java.launcher=SUN_STANDARD, http.nonProxyHosts=*.github.com|plugins.jetbrains.com, sun.cpu.endian=little, user.home=/Users/liubolun, user.language=zh, jdk.http.auth.tunneling.disabledSchemes="", idea.cycle.buffer.size=1024, io.netty.allocator.numHeapArenas=1, java.awt.graphicsenv=sun.awt.CGraphicsEnvironment, io.netty.allocator.numDirectArenas=1, idea.max.intellisense.filesize=2500, io.netty.allocator.useCacheForAllThreads=false, path.separator=:, os.version=14.4.1, java.runtime.name=OpenJDK Runtime Environment, io.netty.allocator.cacheTrimIntervalMillis=600000, jdk.module.illegalAccess.silent=true, jdk.tls.client.protocols=TLSv1.2, java.vm.name=OpenJDK 64-Bit Server VM, jna.platform.library.path=/usr/lib:/usr/lib, java.vendor.url.bug=https://bugreport.java.com/bugreport/, intellij.platform.runtime.repository.path=/Applications/IntelliJ IDEA.app/Contents/modules/module-descriptors.jar, java.util.concurrent.ForkJoinPool.common.threadFactory=com.intellij.concurrency.IdeaForkJoinWorkerThreadFactory, user.dir=/Users/liubolun/IdeaProjects/elasticsearch, os.arch=x86_64, io.netty.serviceThreadPrefix=Netty , idea.dynamic.classpath=false, java.vm.info=mixed mode, java.vm.version=11.0.14.1+1, java.rmi.server.hostname=127.0.0.1, idea.max.content.load.filesize=20000, javax.swing.JTree.excludeAccessibleChildrenFromClosedNodes=true, java.class.version=55.0, splash=true} JAVA_HOME must be set to build Elasticsearch. Note that if the variable was just set you might have to run `./gradlew --stop` for it to be picked up. See https://github.com/elastic/elasticsearch/issues/31399 details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':benchmarks'.
> Must specify license and notice file for project :benchmarks

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================

* Get more help at https://help.gradle.org

 

执行gradle的时候,grable报错,报错内容有个关键的信息  JAVA_HOME must be set to build Elasticsearch

但是我的本机电脑已经配置了JAVA_HOME,很迷惑!!!

 

不过我们可以通过报错内容定位到对应的代码位置:

代码位置:org/elasticsearch/gradle/BuildPlugin.groovy

 

 再执行一下,果然返回了null值,我晕了,我的机器明明是配置了的

 

 

 

 先不纠结本地JAVA_HOME了,直接上骚操作,把 compilerJavaHome 获取逻辑改下,不从JAVA_HOME中获取,直接配置成路径:

 



String compilerJavaHome = "/Users/你的用户名/Library/Java/JavaVirtualMachines/temurin-11.0.14.1/Contents/Home"

 

 先改成这个逻辑,就可以运行了~

 

标签:java,sun,idea,gradle,version,Elasticsearch,HOME,JAVA,true
From: https://www.cnblogs.com/boluopabo/p/18193558

相关文章

  • 【java】【集合类】HashMap之扩容原理
    一、什么是HashMap?HashMap数据结构为数组+链表(JDk1.7),JDK1.8中增加了红黑树,其中:链表的节点存储的是一个Entry对象,每个Entry对象存储四个属性(hash,key,value,next)二、为什么要使用HashMap?对于要求查询次数特别多,查询效率比较高同时插入和删除的次数比较少的情况下,通常会选择Arra......
  • MAC下的homebrew安装及镜像调整
    一、安装未记录 二、镜像调整cd"$(brew--repo)"gitremoteset-urloriginhttps://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git#onlydothisbelowcd"$(brew--repo)/Library/Taps/homebrew/homebrew-core"gitremoteset-urloriginhttps://mi......
  • Unrecognized option: --add-opens java.base/java.lang=ALL-UNNAMED
    由于Java中有关反射相关的功能自从JDK9就开始进行了限制,因此如果还想继续在JDK9以及更高的版本中使用反射相关的功能,需要添加JVM启动参数,--add-opensjava.base/java.lang=ALL-UNNAMED。由于现在的项目都是用Docker部署的,所以紧接着在DockerFile中添加了这个JVM启动参数,如下......
  • Java的基础语法
    Java的基础语法1、注释、标识符、关键字Java中的注释有三种,注释并不会被执行,是给人看的。单行注释//注释文字只能够注释一行。多行注释/*多行注释文字*/能够注释一段文字。文档注释/***abcd*aaaa*/和JavaDoc结合使用标识符Java所有的组成部分都需要名字......
  • CPLEX 初识 -- JAVA实现
    CPLEX初识--JAVA实现本文参考《运筹优化常用模型、算法及案例实战》,同时也是笔者用来记录自己所学知识,如有问题欢迎交流讨论~1环境配置&模型建立需要装配jar包及配置VMoptions,如下图所示:-Djava.library.path="/Applications/CPLEX_Studio2211/java"一般使用IloCple......
  • JAVA爬虫使用Selenium自动翻页
    关于Maven<dependency><groupId>org.jsoup</groupId><artifactId>jsoup</artifactId><version>1.15.3</version></dependency><dependency><groupId>org.seleniumhq.selenium</groupId>......
  • docker搭建Elasticsearch、Kibana、Logstash 同步mysql数据到ES
    一、前言在数据量大的企业级实践中,Elasticsearch显得非常常见,特别是数据表超过千万级后,无论怎么优化,还是有点力不从心!使用中,最首先的问题就是怎么把千万级数据同步到Elasticsearch中,在一些开源框架中知道了,有专门进行同步的!那就是Logstash。在思考,同步完怎么查看呢,这时Kibana映入......
  • 面试题-JAVA基础
    JAVA有几种基本数据类型,各种类型占用字节大小?64位JVM中,int的长度是多数?Java的Integer缓存池大小是多少?Java中应该使用什么数据类型来描述价格?什么是装箱和拆箱?Java中的值传递和引用传递有什么区别?java8和java9的String类型的区别String,StringBuilder,StringBuffer区别......
  • 【JavaWeb】前后端分离SpringBoot项目快速排错指南
    1发起业务请求打开浏览器开发者工具,同时显示网络(Internet)和控制台(console)接着,清空控制台和网络的内容,如下图然后,点击你的业务按钮,发起请求。首先看控制台有没有报错信息,这是最直观的,看不懂英文就去翻译一下,百度一下如果控制台的信息并没有什么价值,或者指明是后端的问题,那么......
  • java poi之XWPFDocument读取word内容并创建新的word(获取表格所有图片)
    Poi的Word文档结构介绍1、poi之word文档结构介绍之正文段落一个文档包含多个段落,一个段落包含多个Runs,一个Runs包含多个Run,Run是文档的最小单元获取所有段落:Listparagraphs=word.getParagraphs();获取一个段落中的所有Runs:ListxwpfRuns=xwpfParagraph.getRuns();获取......