Apache Pig Java UDF - 导入org.apache.pig.EvalFunc;无法解决

时间:2016-12-22 06:47:56

标签: apache-pig

Eclipse显示错误消息import org.apache.pig.EvalFunc; cannot be resolved。如何摆脱此错误?以下是POM文件

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>Pig</groupId>
  <artifactId>PigUDF</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <repositories>
  <repository>
  <id>cloudera-repo-releases</id>
  <url>https://repository.cloudera.com/artifactory/repo</url>
  </repository>
  </repositories>
  <dependencies>
  <dependency>
  <groupId>org.apache.hadoop</groupId>
  <artifactId>hadoop-core</artifactId>
  <version>1.2.1</version>
  </dependency>
  </dependencies>
  <build>
  </build>
   </project>

2 个答案:

答案 0 :(得分:0)

将猪依赖项添加到您的POM文件

    <dependency>
        <groupId>org.apache.pig</groupId>
        <artifactId>pig</artifactId>
        <version>0.15.0</version><!-- or any version you want -->
    </dependency>

答案 1 :(得分:0)

EvalFunc类是从Pig Packages导入的。所以你需要在pom.xml中添加pig依赖。

<!-- https://mvnrepository.com/artifact/org.apache.pig/pig -->
<dependency>
    <groupId>org.apache.pig</groupId>
    <artifactId>pig</artifactId>
    <version>0.13.0</version>
</dependency>