DataX源码打包编译采坑记

一、什么是DataX
DataX是阿里巴巴集团内被广泛使用的离线数据同步工具/平台。
实现包括MySQL,SQL Server,Oracle,PostgreSQL,HDFS,Hive,HBase,OTS,ODPS等各种异构数据源之间高效的数据同步功能。
二、工具部署
方法一、直接下载DataX工具包:DataX下载地址
下载地址:https://github.com/alibaba/DataX/blob/master/userGuid.md
下载后解压至本地某个目录,进入bin目录,即可运行同步作业:
$ cd {YOUR_DATAX_HOME}/bin
$ python datax.py {YOUR_JOB.json}
自检脚本:
python {YOUR_DATAX_HOME}/bin/datax.py {YOUR_DATAX_HOME}/job/job.json

方法二、下载DataX源码,自己编译:DataX源码

(1)、下载DataX源码:

$ git clone [email protected]:alibaba/DataX.git

(2)、通过maven打包:

$ mvn -U clean package assembly:assembly -Dmaven.test.skip=true

打包成功,日志显示如下:

[INFO] BUILD SUCCESS
[INFO] -----------------------------------------------------------------
[INFO] Total time: 08:12 min
[INFO] Finished at: 2015-12-13T16:26:48+08:00
[INFO] Final Memory: 133M/960M
[INFO] -----------------------------------------------------------------

打包成功后的DataX包位于 放在目录/target/datax/datax/ ,结构如下:

$ ls ./target/datax/datax/
bin		
conf		
job		
lib		
log		
log_perf	
plugin	

三、第二种、放心一定打包不了。一定报错、需要配置一下maven与pom.xml,才能打包。
1.maven配置阿里云的maven私服


        nexus-aliyun
        central
        Nexus aliyun
        https://maven.aliyun.com/repository/central
    

2.本地编译报错无法找到工件com.aliyun.openservices:tablestore-streamclient:jar:1.0.0-SNAPSHOT
解决:

vim $ {DataX_source_code_home} /otsstreamreader/pom.xml 

com.aliyun.openservices
tablestore-streamclient
1.0.0-SNAPSHOT

此处把1.0.0-SNAPSHOT改成1.0.0

如图:
DataX源码打包编译采坑记_第1张图片
3.现在编译datax odps插件模块会报错

[ERROR] Failed to execute goal on project odpsreader: Could not resolve dependencies for project com.alibaba.datax:odpsreader:jar:0.0.1-SNAPSHOT: The following artifacts could not be resolved: com.alibaba.datax:datax-common:jar:0.0.1-SNAPSHOT, com.alibaba.external:bouncycastle.provider:jar:1.38-jdk15: Could not find artifact com.alibaba.datax:datax-common:jar:0.0.1-SNAPSHOT in dtwave (http://repo2.dtwave-inc.com/repository/public/) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

比较过之前odps-sdk-core-0.19.3-public.pom的的依赖是

org.bouncycastle
bcprov-jdk15on
1.52
现在是

com.alibaba.external
bouncycastle.provider
1.38-jdk15
原因:    后来的这个依赖应该是阿里内部jar,外部仓库无法加载这个jar

解决:修改pom.xml

com.aliyun.odps
odps-sdk-core
换一下版本 :0.20.7-public 

如图:DataX源码打包编译采坑记_第2张图片

你可能感兴趣的:(DB)