2021-07-07

Presto windows环境源码编译 0.257版本

一、编译前准备

1、拉取代码
仓库地址是:https://github.com/prestodb/presto.git

2、安装cygwin
cygwin官网
在官网下载cygwin,安装好后在windows环境变量的Path加上cygwin的bin路径。

ps:没装cygwin可能会报有些命令找不到的错,例如:Cannot run program “chmod”: CreateProcess error=2

3、重新编译presto-maven-plugin
Presto使用presto-maven-plugin编译。在Window下编译失败原因是编译过程中类找不到,而且文件路径错了。这里Presto使用的presto-maven-plugin的版本为0.5-SNAPSHOT

git clone https://github.com/prestodb/presto-maven-plugin.git

克隆好了后修改该仓库的ServiceDescriptorGenerator.java

String className = classPath.substring(0, classPath.length() - 6).replace('/', '.');

修改后:

String className = classPath.substring(0, classPath.length() - 6).replace(File.separatorChar, '.');

然后在项目下执行:

mvn clean install -DskipTests

将产生的presto-maven-plugin-0.5-SNAPSHOT.jar 放入本地maven仓库的***com\facebook\presto\presto-maven-plugin\0.5-SNAPSHOT*** 目录
没有这个目录可以使用

mvn install:install-file -DgroupId=xx.xx -DartifactId=xx -Dversion=xx -Dpackaging=jar -Dfile=xx

命令行导入

4、注释掉presto-root下面的pom.xml内容
4.1、在presto-root模块的pom.xml中properties部分添加以下内容:

<air.check.skip-extended>true</air.check.skip-extended>

并且注释掉

<air.checkstyle.config-file>src/checkstyle/presto-checks.xml</air.checkstyle.config-file>

因为Presto会对代码规范进行严格的检查,maven-checkstyle-plugin检查失败就会报错,不注释上面的编译时会报错:
Error: java: RegexpMultiline: Line contains carriage return

4.2、注释掉presto-docs模块

<!--module>presto-docs</module>-->

原因:Presto Github上说明了它支持Linux / Mac 编译

4.3、注意jdk版本

<air.java.version>1.8.0-151</air.java.version>

presto这里也比较严格,笔者jdk版本是1.8.0-131,第一次没改的时候因为版低于151导致编译失败,可以下载高于151的版本也可以像笔者把这个改成

<air.java.version>1.8.0-131</air.java.version>

二、编译源码

1、在拉下来的仓库目录执行

mvn clean install -DskipTests

等待20多分钟左右
在这里插入图片描述
编译完成后在presto-server模块可以找到:
presto-server-0.257-SNAPSHOT.tar.gz

参考:
[1]: https://blog.csdn.net/hll19950830/article/details/108715511
[2]: https://www.freesion.com/article/50941383225/

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值