apache arrow 源码导入eclipse

前置条件

  • jdk8
  • maven3.6.3

说明

说明:arrow-format模块的代码时通过flatbuffers生成的,该工具只有linux版和mac版,所以arrow工程无法在windows上面直接编译,得在linux上面编译好,下载到本地后在导入eclipse。
可以在arrow-format的pom.xml文件中看到flatbuffer工具下载的配置,该工具没有windows版本
在这里插入图片描述

步骤

先将代码传到linux上面进行编译

  • cd java
  • mvn install –DskipTests=true
    说明:官方文档中没有–DskipTests=true选项,个人测试中发现,部分测试用例无法通过导致编译失败,所以加上了这个编译选项。

将linux上面编译好的工程完整的下载到本地,并导入到eclipse

常规操作具体步骤不讲了

解决报错问题

报错问题分为两类

pom.xml文件中部分execution报错

Plugin execution not covered by lifecycle configuration:
org.apache.maven.plugins:maven-antrun-plugin:1.3:run
(execution: generate-sources-input, phase: generate-sources)

说明:这个报错的原因是,eclipse定义了自己默认的声明周期和执行目标(即eclipse导入项目后会执行那些phase和goals),arrow的pom.xml文件里面定义了很多phase和goals不在eclipse默认执行范围内,所以会有上面的报错。
解决办法,手动配置eclipse的lifecycle mapping。参考链接https://www.eclipse.org/m2e/documentation/m2e-execution-not-covered.html。

配置有两种方法,一种是在pom.xml文件中配置这些execution。 另外一种是在preference中进行全局配置。
在这里插入图片描述

  • 配置样板
<pluginManagement>与build标签中的<plugins>同级。
  <pluginManagement>
  	<plugins>
  		<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
  		<plugin>
  			<groupId>org.eclipse.m2e</groupId>
  			<artifactId>lifecycle-mapping</artifactId>
  			<version>1.0.0</version>
  			<configuration>
  				<lifecycleMappingMetadata>
  					<pluginExecutions>
  						<pluginExecution>
  							<pluginExecutionFilter>
  								<groupId>
  									org.apache.maven.plugins
  								</groupId>
  								<artifactId>
  									maven-dependency-plugin
  								</artifactId>
  								<versionRange>[3.0.1,)</versionRange>
  								<goals>
  									<goal>copy</goal>
  								</goals>
  							</pluginExecutionFilter>
  							<action>
  								<ignore></ignore>
  							</action>
  						</pluginExecution>
  						<pluginExecution>
  							<pluginExecutionFilter>
  								<groupId>org.codehaus.mojo</groupId>
  								<artifactId>
  									exec-maven-plugin
  								</artifactId>
  								<versionRange>[1.4.0,)</versionRange>
  								<goals>
  									<goal>exec</goal>
  								</goals>
  							</pluginExecutionFilter>
  							<action>
  								<ignore></ignore>
  							</action>
  						</pluginExecution>
  						<pluginExecution>
  							<pluginExecutionFilter>
  								<groupId>com.mycila</groupId>
  								<artifactId>
  									license-maven-plugin
  								</artifactId>
  								<versionRange>[2.3,)</versionRange>
  								<goals>
  									<goal>format</goal>
  								</goals>
  							</pluginExecutionFilter>
  							<action>
  								<ignore></ignore>
  							</action>
  						</pluginExecution>
  						<pluginExecution>
  							<pluginExecutionFilter>
  								<groupId>org.codehaus.mojo</groupId>
  								<artifactId>
  									build-helper-maven-plugin
  								</artifactId>
  								<versionRange>[1.9.1,)</versionRange>
  								<goals>
  									<goal>add-source</goal>
  								</goals>
  							</pluginExecutionFilter>
  							<action>
  								<execute><runOnConfiguration>true</runOnConfiguration></execute>
  							</action>
  						</pluginExecution>
  					</pluginExecutions>
  				</lifecycleMappingMetadata>
  			</configuration>
  		</plugin>
  	</plugins>
  </pluginManagement>

表示忽略,即不执行。
< execute ></ execute > 表示执行。

工程中源码报错,类找不到

  • 原因:部分代码是通过工具生成的,存放的目录并非maven工程的标准目录,所以不在搜索路径上。
  • 解决方案:参考问题a,相关execution配置到pluginManagement中,并配置为执行。
  • 配置样例:
<pluginExecution>
    <pluginExecutionFilter>
        <groupId>org.codehaus.mojo</groupId>
  		<artifactId>build-helper-maven-plugin</artifactId>
  		<versionRange>[1.9.1,)</versionRange>
  		<goals>
  			<goal>add-source</goal>
  		</goals>
  	</pluginExecutionFilter>
    <action>				 
        <execute>
            <runOnConfiguration>true</runOnConfiguration>
        </execute>
  	</action>
 </pluginExecution>

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值