blob: 0d0e5d1f9cf7760a3664d2a3407afe24e82d4cf2 [file] [log] [blame]
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[6254],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>h});var a=n(7294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,a,i=function(e,t){if(null==e)return{};var n,a,i={},r=Object.keys(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var s=a.createContext({}),u=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},p=function(e){var t=u(e.components);return a.createElement(s.Provider,{value:t},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,r=e.originalType,s=e.parentName,p=o(e,["components","mdxType","originalType","parentName"]),d=u(n),m=i,h=d["".concat(s,".").concat(m)]||d[m]||c[m]||r;return n?a.createElement(h,l(l({ref:t},p),{},{components:n})):a.createElement(h,l({ref:t},p))}));function h(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=n.length,l=new Array(r);l[0]=m;var o={};for(var s in t)hasOwnProperty.call(t,s)&&(o[s]=t[s]);o.originalType=e,o[d]="string"==typeof e?e:i,l[1]=o;for(var u=2;u<r;u++)l[u]=n[u];return a.createElement.apply(null,l)}return a.createElement.apply(null,n)}m.displayName="MDXCreateElement"},930:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>s,default:()=>h,frontMatter:()=>o,metadata:()=>u,toc:()=>d});var a=n(7462),i=n(3366),r=(n(7294),n(3905)),l=["components"],o={id:"build",title:"Build from source"},s=void 0,u={unversionedId:"development/build",id:"development/build",title:"Build from source",description:"\x3c!--",source:"@site/docs/latest/development/build.md",sourceDirName:"development",slug:"/development/build",permalink:"/docs/latest/development/build",draft:!1,tags:[],version:"current",frontMatter:{id:"build",title:"Build from source"},sidebar:"docs",previous:{title:"JavaScript functionality",permalink:"/docs/latest/development/javascript"},next:{title:"Versioning",permalink:"/docs/latest/development/versioning"}},p={},d=[{value:"Prerequisites",id:"prerequisites",level:4},{value:"Installing Java and Maven",id:"installing-java-and-maven",level:5},{value:"Other dependencies",id:"other-dependencies",level:5},{value:"Downloading the source",id:"downloading-the-source",level:5},{value:"Building from source",id:"building-from-source",level:4},{value:"Building hadoop 3 distribution",id:"building-hadoop-3-distribution",level:3},{value:"Potential issues",id:"potential-issues",level:4},{value:"Missing <code>pyyaml</code>",id:"missing-pyyaml",level:5}],c={toc:d},m="wrapper";function h(e){var t=e.components,n=(0,i.Z)(e,l);return(0,r.kt)(m,(0,a.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"You can build Apache Druid directly from source. Use the version of this page\nthat matches the version you want to build.\nFor building the latest code in master, follow the latest version of this page\n",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apache/druid/blob/master/docs/development/build.md"},"here"),":\nmake sure it has ",(0,r.kt)("inlineCode",{parentName:"p"},"/master/")," in the URL."),(0,r.kt)("h4",{id:"prerequisites"},"Prerequisites"),(0,r.kt)("h5",{id:"installing-java-and-maven"},"Installing Java and Maven"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"JDK 8, 8u92+ or JDK 11. See our ",(0,r.kt)("a",{parentName:"li",href:"/docs/latest/operations/java"},"Java documentation")," for information about obtaining a JDK."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"http://maven.apache.org/download.cgi"},"Maven version 3.x"))),(0,r.kt)("h5",{id:"other-dependencies"},"Other dependencies"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Distribution builds require Python 3.x and the ",(0,r.kt)("inlineCode",{parentName:"li"},"pyyaml")," module."),(0,r.kt)("li",{parentName:"ul"},"Integration tests require ",(0,r.kt)("inlineCode",{parentName:"li"},"pyyaml")," version 5.1 or later.")),(0,r.kt)("h5",{id:"downloading-the-source"},"Downloading the source"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"git clone git@github.com:apache/druid.git\ncd druid\n")),(0,r.kt)("h4",{id:"building-from-source"},"Building from source"),(0,r.kt)("p",null,"The basic command to build Druid from source is:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"mvn clean install\n")),(0,r.kt)("p",null,"This will run static analysis, unit tests, compile classes, and package the projects into JARs. It will ",(0,r.kt)("em",{parentName:"p"},"not")," generate the source or binary distribution tarball."),(0,r.kt)("p",null,"In addition to the basic stages, you may also want to add the following profiles and properties:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"-Pdist")," - Distribution profile: Generates the binary distribution tarball by pulling in core extensions and dependencies and packaging the files as ",(0,r.kt)("inlineCode",{parentName:"li"},"distribution/target/apache-druid-x.x.x-bin.tar.gz")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"-Papache-release")," - Apache release profile: Generates GPG signature and checksums, and builds the source distribution tarball as ",(0,r.kt)("inlineCode",{parentName:"li"},"distribution/target/apache-druid-x.x.x-src.tar.gz")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"-Prat")," - Apache Rat profile: Runs the Apache Rat license audit tool"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"-DskipTests")," - Skips unit tests (which reduces build time)"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"-Dweb.console.skip=true")," - Skip front end project")),(0,r.kt)("p",null,"Putting these together, if you wish to build the source and binary distributions with signatures and checksums, audit licenses, and skip the unit tests, you would run:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"mvn clean install -Papache-release,dist,rat -DskipTests\n")),(0,r.kt)("h3",{id:"building-hadoop-3-distribution"},"Building hadoop 3 distribution"),(0,r.kt)("p",null,"By default, druid ships hadoop 2.x.x jars along with the distribution. Exact version can be found in the\nmain ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apache/druid/blob/master/pom.xml"},"pom"),". To build druid with hadoop 3.x.x jars, hadoop3 profile\nneeds to be activated."),(0,r.kt)("p",null,"To generate build with hadoop 3 dependencies, run:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"mvn clean install -Phadoop3\n")),(0,r.kt)("p",null,"To generate distribution with hadoop3 dependencies, run :"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"mvn clean install -Papache-release,dist-hadoop3,rat,hadoop3 -DskipTests\n")),(0,r.kt)("h4",{id:"potential-issues"},"Potential issues"),(0,r.kt)("h5",{id:"missing-pyyaml"},"Missing ",(0,r.kt)("inlineCode",{parentName:"h5"},"pyyaml")),(0,r.kt)("p",null,"You are building Druid from source following the instructions on this page but you get"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0:exec (generate-binary-license) on project distribution: Command execution failed.: Process exited with an error: 1 (Exit value: 1) -> [Help 1]\n")),(0,r.kt)("p",null,"Resolution: Make sure you have Python installed as well as the ",(0,r.kt)("inlineCode",{parentName:"p"},"yaml")," module:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"pip install pyyaml\n")),(0,r.kt)("p",null,"On some systems, ensure you use the Python 3.x version of ",(0,r.kt)("inlineCode",{parentName:"p"},"pip"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"pip3 install pyyaml\n")))}h.isMDXComponent=!0}}]);