玩轉Elasticsearch源碼-Elasticsearch構建任務簡析

做爲 玩轉Elasticsearch源碼 系列第二篇,先介紹下分析思路,本系列不會直接進入代碼執行流程,而是先從Elasticsearch源代碼的工程結構,構建任務等入手,按照先總體脈絡,後細節的方式進行。java

Gradle

Gradle是一個基於 Apache AntApache Maven概念的項目 自動化建構工具。它使用一種基於 Groovy特定領域語言來聲明項目設置,而不是傳統的 XML[[2]](https://zh.wikipedia.org/wiki...
當前其支持的語言限於 JavaGroovyScala [[3]](https://zh.wikipedia.org/wiki...,計劃將來將支持更多的語言。

構建命令

進入ES源碼根目錄,執行node

gradle tasks

能夠看到ES全部tasks:web

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 <task>
要查看任務的更多細節,請運行 gradle help --task <task>
相關文章
相關標籤/搜索