资讯专栏INFORMATION COLUMN

玩转Elasticsearch源码-Elasticsearch构建任务简析

NicolasHe / 1260人阅读

摘要:构建命令进入源码根目录,执行可以看到所有将项目作为应用程序与和特定于的脚本捆绑在一起。删除构建目录。初始化一个新的构建。显示根项目中声明的所有构建脚本依赖项。将发布到本地存储库。可用于测试所有可用的可用的有运行所有非测试检查。

作为 玩转Elasticsearch源码 系列第二篇,先介绍下分析思路,本系列不会直接进入代码执行流程,而是先从Elasticsearch源代码的工程结构,构建任务等入手,按照先整体脉络,后细节的方式进行。

Gradle
Gradle是一个基于Apache Ant和Apache Maven概念的项目自动化建构工具。它使用一种基于Groovy的特定领域语言来声明项目设置,而不是传统的XML。[[2]](https://zh.wikipedia.org/wiki...
当前其支持的语言限于Java、Groovy和Scala[[3]](https://zh.wikipedia.org/wiki...,计划未来将支持更多的语言。
构建命令

进入ES源码根目录,执行

gradle tasks

可以看到ES所有tasks:

Application tasks
-----------------
distShadowTar - Bundles the project as a JVM application with libs and OS specific scripts.
将项目作为JVM应用程序与libs和特定于OS的脚本捆绑在一起。
distShadowZip - Bundles the project as a JVM application with libs and OS specific scripts.
将项目作为JVM应用程序与libs和特定于OS的脚本捆绑在一起。
installShadowApp - Installs the project as a JVM application along with libs and OS specific scripts.
将项目安装为JVM应用程序,以及libs和特定于操作系统的脚本
run - Runs this project as a JVM application
将此项目作为JVM应用程序运行
runShadow - Runs this project as a JVM application using the shadow jar
使用影子jar将此项目作为JVM应用程序运行
startShadowScripts - Creates OS specific scripts to run the project as a JVM application using the shadow jar
创建特定于操作系统的脚本,使用影子jar将项目作为JVM应用程序运行

Benchmark tasks
---------------
jmh - Runs all microbenchmarks
运行所有微基准测试
jmhJar - Generates an uberjar with the microbenchmarks and all dependencies
使用微基准测试和所有依赖项生成uberjar

Build tasks
-----------
assemble - Assembles the outputs of this project.
编译工程到outputs
build - Assembles and tests this project.
编译和测试这个项目。
buildDependents - Assembles and tests this project and all projects that depend on it.
编译和测试这个项目以及所有依赖它的项目。
buildNeeded - Assembles and tests this project and all projects it depends on.
编译和测试这个项目以及它所依赖的所有项目。
classes - Assembles main classes.
编译主类。
clean - Deletes the build directory.
删除构建目录。
jar - Assembles a jar archive containing the main classes.
编译包含主要类的jar归档文件。
javadocJar - Assembles a jar containing javadocs.
装配一个包含javadoc的jar。
sourcesJar - Assembles a jar containing source files.
装配一个包含源文件的jar。
testClasses - Assembles test classes.
编译测试类。
war - Generates a war archive with all the compiled classes, the web-app content and the libraries.
生成包含所有编译类、web - app内容和库的war存档。


Build Setup tasks
-----------------
init - Initializes a new Gradle build. [incubating]
初始化一个新的Gradle构建。(孵化)
wrapper - Generates Gradle wrapper files. [incubating]
生成Gradle包装文件。(孵化)

Distribution tasks
------------------
assembleDist - Assembles the main distributions
编译主要的发行版
distTar - Bundles the project as a distribution.
将项目打包为一个发行版。
distZip - Bundles the project as a distribution.
将项目打包为一个发行版。
installDist - Installs the project as a distribution as-is.
将项目安装为按原样发布的版本。


Docs tasks
----------
listConsoleCandidates
listSnippets - List each snippet
列表中每一个片段

Documentation tasks
-------------------
groovydoc - Generates Groovydoc API documentation for the main source code.
为主要源代码生成Groovydoc API文档。
javadoc - Generates Javadoc API documentation for the main source code.
为主要源代码生成Javadoc API文档。

Help tasks
----------
buildEnvironment - Displays all buildscript dependencies declared in root project "elasticsearch".
显示根项目“elasticsearch”中声明的所有构建脚本依赖项。
components - Displays the components produced by root project "elasticsearch". [incubating]
显示根项目“elasticsearch”生成的组件。(孵化)
dependencies - Displays all dependencies declared in root project "elasticsearch".
显示根项目“elasticsearch”中声明的所有依赖项。
dependencyInsight - Displays the insight into a specific dependency in root project "elasticsearch".
显示根项目“elasticsearch”中的特定依赖关系。
dependentComponents - Displays the dependent components of components in root project "elasticsearch". [incubating]
显示根项目“elasticsearch”中组件的依赖组件。(孵化)
help - Displays a help message.
显示帮助消息。
model - Displays the configuration model of root project "elasticsearch". [incubating]
显示根项目“elasticsearch”的配置模型。(孵化)
projects - Displays the sub-projects of root project "elasticsearch".
显示根项目的子项目。
properties - Displays the properties of root project "elasticsearch".
显示根项目的属性。
tasks - Displays the tasks runnable from root project "elasticsearch" (some of the displayed tasks may belong to subprojects).
显示可从根项目“elasticsearch”运行的任务(显示的一些任务可能属于子项目)。


IDE tasks
---------
cleanEclipse - Cleans all Eclipse files.
清除所有Eclipse文件。
cleanEclipseWtp - Cleans Eclipse wtp configuration files.
清理Eclipse wtp配置文件。
cleanIdea - Cleans IDEA project files (IML, IPR)
清理idea项目文件(IML、IPR)
cleanIdeaBuildDir - Deletes the IDEA build directory.
删除IDEA构建目录。
eclipse - Generates all Eclipse files.
生成所有Eclipse文件。
eclipseWtp - Generates Eclipse wtp configuration files.
生成Eclipse wtp配置文件。
idea - Generates IDEA project files (IML, IPR, IWS)
生成IDEA项目文件(IML、IPR、IWS)

Publishing tasks
----------------
generatePomFileForClientJarPublication - Generates the Maven POM file for publication "clientJar".
为发布“clientJar”生成Maven POM文件。
generatePomFileForNebulaPublication - Generates the Maven POM file for publication "nebula".
为发布“nebula”生成Maven POM文件
generatePomFileForNebulaRealPomPublication - Generates the Maven POM file for publication "nebulaRealPom".
为发布“nebulaRealPom”生成Maven POM文件。
generatePomFileForZipPublication - Generates the Maven POM file for publication "zip".
为发布“zip”生成Maven POM文件。
generatePomFileForZipRealPublication - Generates the Maven POM file for publication "zipReal".
为发布“zip Real”生成Maven POM文件。
publish - Publishes all publications produced by this project.
出版由本项目制作的所有出版物。
publishClientJarPublicationToMavenLocal - Publishes Maven publication "clientJar" to the local Maven repository.
将Maven发布“clientJar”到本地Maven存储库。
publishNebulaPublicationToMavenLocal - Publishes Maven publication "nebula" to the local Maven repository.
将Maven发布“nebula”到本地Maven存储库。
publishNebulaRealPomPublicationToMavenLocal - Publishes Maven publication "nebulaRealPom" to the local Maven repository.
将Maven出版物“nebulaRealPom”发布到本地Maven存储库。
publishToMavenLocal - Publishes all Maven publications produced by this project to the local Maven cache.
将此项目生成的所有Maven发布发布到本地Maven缓存。
publishZipPublicationToMavenLocal - Publishes Maven publication "zip" to the local Maven repository.
将Maven发布“zip”到本地Maven存储库。
publishZipRealPublicationToMavenLocal - Publishes Maven publication "zipReal" to the local Maven repository.
将Maven发布“zip Real”到本地Maven存储库。

Shadow tasks
------------
knows - Do you know who knows?
shadowJar - Create a combined JAR of project and runtime dependencies
创建项目和运行时依赖项的组合JAR

Verification tasks
------------------
branchConsistency - Ensures this branch is internally consistent. For example, that versions constants match released versions.
确保这个分支内部一致。例如,版本常量匹配发布的版本。
bwcTest - Runs backwards compatibility tests.
运行向后兼容性测试。
check - Runs all checks.
运行所有检查。
integTest - Multi-node tests
多节点测试
packagingTest - Tests yum/apt packages using vagrant and bats.
    使用agrant and bats测试yum / apt包。
    Specify the vagrant boxes to test using the gradle property "vagrant.boxes".
    指定要使用gradle属性"vagrant.boxes"测试的vagrant boxes.
    "sample" can be used to test a single yum and apt box. "all" can be used to
    “sample”可以用来测试单个yum和apt box。
    test all available boxes. The available boxes are:
    [centos-6, centos-7, debian-8, debian-9, fedora-26, fedora-27, oel-6, oel-7, opensuse-42, sles-12, ubuntu-1404, ubuntu-1604]
platformTest - Test unit and integ tests on different platforms using vagrant.
    使用vagrant在不同平台上进行测试单元和集成测试。
    Specify the vagrant boxes to test using the gradle property "vagrant.boxes".
    指定要使用gradle属性"vagrant.boxes"测试的vagrant boxes。
    "all" can be used to test all available boxes. The available boxes are:
    “all”可用于测试所有可用的boxes,可用的boxes有:
    [centos-6, centos-7, debian-8, debian-9, fedora-26, fedora-27, oel-6, oel-7, opensuse-42, sles-12, ubuntu-1404, ubuntu-1604]
precommit - Runs all non-test checks.
    运行所有非测试检查。
run - Runs elasticsearch in the foreground
    在前台运行elasticsearch
stop - Stop any tasks from tests that still may be running
    从仍然可能运行的测试中停止任何任务
test - Runs unit tests with the randomized testing framework
    使用随机测试框架运行单元测试
vagrantCheckVersion - Check the Vagrant version
    检查Vagrant version
vagrantSmokeTest - Smoke test the specified vagrant boxes
    冒烟测试指定的vagrant boxes
virtualboxCheckVersion - Check the Virtualbox version
    检查Virtualbox版本


To see all tasks and more detail, run gradle tasks --all
要查看所有任务和更多细节,请运行 run gradle tasks --all

To see more detail about a task, run gradle help --task 
要查看任务的更多细节,请运行 gradle help --task 

文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。

转载请注明本文地址:https://www.ucloud.cn/yun/34385.html

相关文章

  • 玩转Elasticsearch源码-使用Intellij IDEA和remote debug调试源代

    摘要:像工具就是用了这些功能达到魔术般的效果。是一个特定的可选实现,用来定义调试者与运行之间的通讯,它的是通过本地库的或者支持实现的。简单来说,会建立运行应用的和调试者本地或者远程之间的桥梁。 开篇 学习源码第一步就是搭建调试环境,但是看了网上大部分Elasticsearch调试方式都是配置各种环境变量然后直接启动Main方法,而且还各种报错。今天提供新的方式--remote debug来避...

    Youngs 评论0 收藏0
  • 玩转Elasticsearch源码-一图看懂ES启动流程

    摘要:如果这样做,将在错误级别记录一条错误消息。侦听器在启动时立即安装,然后在配置日志记录时,我们检查状态日志记录器没有记录错误级别的日志消息。如果它们启动失败,我们可以在控制台上看到任何此类消息。初始化探针,用于操作系统,进程,的监控。 开篇 直接看图showImg(https://segmentfault.com/img/remote/1460000017846554); 上图中虚线表示...

    arashicage 评论0 收藏0
  • 玩转Elasticsearch源码-ActionModule启动分析

    摘要:的用途主要维护了请求和响应相关组件,它们可能来自本身或者来自。它用于层上的响应过滤,例如过滤出等敏感信息。每个对应的功能实现是在对应的中。一般都会有注解的构造方法用于依赖注入,并且实现执行具体逻辑。 ActionModule的用途 org.elasticsearch.action.ActionModule主要维护了请求和响应相关组件,它们可能来自ES本身或者来自plugin。 tra...

    jsbintask 评论0 收藏0
  • Elasticsearch创建索引流程

    摘要:前言说明本文章使用的版本是在上一篇文章搜索引擎的启动过程中,介绍了的启动过程。由此可知,在启动过程中,创建对象时,初始化了,由其名字可以知道这是用来处理请求的。主分片写入后,即可搜索。 前言 说明:本文章使用的ES版本是:6.7.0 在上一篇文章搜索引擎ElasticSearch的启动过程中,介绍了ES的启动过程。 由此可知,在ES启动过程中,创建Node对象(new Node(env...

    mudiyouyou 评论0 收藏0
  • 渣渣为什么要看 ElasticSearch 源码

    摘要:当时自己在本地测试搭建集群后,给分配了另外一个任务就是去了解中的自带分词英文分词中文分词的相同与差异以及自己建立分词需要注意的点。还有就是官网的文档了,非常非常详细,还有,版本的是有中文的官方文档,可以凑合着看。 前提 人工智能、大数据快速发展的今天,对于 TB 甚至 PB 级大数据的快速检索已然成为刚需,大型企业早已淹没在系统生成的浩瀚数据流当中。大数据技术业已集中在如何存储和处理这...

    Cciradih 评论0 收藏0

发表评论

0条评论

最新活动
阅读需要支付1元查看
<