本文以Elasticsearch 6.6 为例,介绍使用IDEA调试Elasticsearch源码的方法。
使用到的工具和版本如下:
组件 | 版本 |
---|---|
jdk | corretto-11.0.16 |
gradle | 5.6.4 |
groovy | 4.0.4 |
IntelliJ IDEA | 2022.1 |
对比:分别试过IntelliJ IDEA 2018.2.4和Visual Studio Code遇到一些障碍最后还是在IntelliJ IDEA 2022.1顺利通过。IntelliJ IDEA 2018.2.4直接崩溃闪退。vscode有两个问题,代码debug和groovy暂时放弃。
辅助:能自动下载jdk,帮助选择openjdk版本和提供下载地址。
Java version | First Gradle version to support it |
---|---|
8 | 2.0 |
9 | 4.3 |
10 | 4.7 |
11 | 5.0 |
12 | 5.4 |
13 | 6.0 |
14 | 6.3 |
15 | 6.7 |
16 | 7.0 |
17 | 7.3 |
18 | 7.5 |
distributionBase=GRADLE_USER_HOME
全局变量:GRADLE_USER_HOME设置成非系统盘
代码地址:https://github.com/elastic/elasticsearch.git
选择分支:6.6
Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the User Manual chapter on the daemon at
Cause: startup failed:
settings file 'E:\workspace\es\elasticsearch\settings.gradle': 1: unable to resolve class org.elasticsearch.gradle.Version
@ line 1, column 1.
import org.elasticsearch.gradle.Version
^
1 error
I am getting this exception?java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7 and java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.reflection.ReflectionCache) when i run the spring
// 这个资源443:
compile "com.amazonaws:aws-java-sdk-s3:${versions.aws}"
compile "com.amazonaws:aws-java-sdk-kms:${versions.aws}"
compile "com.amazonaws:aws-java-sdk-core:${versions.aws}"
Could not resolve all task dependencies for configuration ':plugins:repository-s3:runtime'.
Could not resolve com.amazonaws:aws-java-sdk-s3:1.11.406.
Required by:
project :plugins:repository-s3
Could not resolve com.amazonaws:aws-java-sdk-s3:1.11.406.
Could not get resource 'https://artifacts.elastic.co/maven/com/amazonaws/aws-java-sdk-s3/1.11.406/aws-java-sdk-s3-1.11.406.pom'.
Could not GET 'https://artifacts.elastic.co/maven/com/amazonaws/aws-java-sdk-s3/1.11.406/aws-java-sdk-s3-1.11.406.pom'.
Connect to artifacts.elastic.co:443 [artifacts.elastic.co/34.120.127.130] failed: Connection timed out: connect
Could not resolve com.amazonaws:aws-java-sdk-s3:1.11.406.
Could not get resource 'https://jcenter.bintray.com/com/amazonaws/aws-java-sdk-s3/1.11.406/aws-java-sdk-s3-1.11.406.pom'.
Could not GET 'https://jcenter.bintray.com/com/amazonaws/aws-java-sdk-s3/1.11.406/aws-java-sdk-s3-1.11.406.pom'.
配置国内云仓库
// settings.gradle
buildscript {
repositories {
//对应google()
maven {url 'https://maven.***.com/repository/google'}
//对应jcenter()
maven {url 'https://maven.***.com/repository/jcenter'}
//公共库
maven {url 'https://maven.***.com/repository/public'}
}
}
按照上述步骤就跑起来,可以规避我踩过坑。如果文中有没阐述清楚,欢迎在评论区留言。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。