ogen
ogen

Reputation: 792

HBase dependencies with SBT in Scala

I am new with Scala, SBT and Intellij.

Using the following sbt file :

name := "mycompany"

version := "0.0.1-SNAPSHOT"

scalaVersion := "2.11.8"

libraryDependencies ++= Seq(
  "org.apache.spark" %% "spark-core" % "2.0.1",
  "org.apache.spark" %% "spark-sql" % "2.0.1",
  "org.apache.spark" %% "spark-mllib" % "2.0.1",
  "org.apache.hbase" % "hbase-client" % "1.2.0",
  "com.typesafe.akka" %% "akka-http-experimental" % "2.4.11"
)

resolvers ++= Seq(
  "Apache Repository" at "https://repository.apache.org/content/repositories/releases/"
)

The three Apache Spark dependencies are red underlined in Intellij with an 'Unreasolved dpendancy' tag. However, I can import Spark libraries and my Spark jobs run in local mode without any issue.

I can not import from the HBase library inside the IDE. The following imports all can not be resolved

import org.apache.hadoop.hbase.HBaseConfiguration
import org.apache.hadoop.hbase.KeyValue
import org.apache.hadoop.hbase.MasterNotRunningException;
import org.apache.hadoop.hbase.TableName
import org.apache.hadoop.hbase.ZooKeeperConnectionException
import org.apache.hadoop.hbase.client.Connection
import org.apache.hadoop.hbase.client.ConnectionFactory
import org.apache.hadoop.hbase.client.Get
import org.apache.hadoop.hbase.client.Result
import org.apache.hadoop.hbase.client.Table
import org.apache.hadoop.hbase.util.Bytes

I have written code in java using the above imports without any issue and only with these lines in maven:

    <dependency>
        <groupId>org.apache.hbase</groupId>
        <artifactId>hbase-client</artifactId>
        <scope>provided</scope>
        <version>1.2.0</version>
    </dependency>

What am I doing wrong ?

Thanks

EDIT

Thanks to pamu's post, I have replaced the resolvers with:

resolvers ++= Seq(
  "Apache Repository" at "https://repository.apache.org/content/repositories/releases/",
  "Cloudera repo" at "//repository.cloudera.com/artifactory/cloudera-repos/"
)

However, I still have some unresolved imports (other above are now OK):

import org.apache.hadoop.hbase.HBaseConfiguration
import org.apache.hadoop.hbase.KeyValue
import org.apache.hadoop.hbase.util.TableName
import org.apache.hadoop.hbase.util.Bytes

Thanks for your help

EDIT

libraryDependencies ++= Seq(
  "org.apache.hbase" % "hbase-server" % 1.2.1,
  "org.apache.hbase" % "hbase-client" % 1.2.1,
  "org.apache.hbase" % "hbase-common" % 1.2.1,
  "org.apache.hadoop" % "hadoop-common" % 2.7.3
)

Upvotes: 1

Views: 3149

Answers (1)

FaigB
FaigB

Reputation: 2281

In mentioned hbase lib with version 1.2.0 there are not such classes. You can check using jar -tvf. Those classes exists in 2.0.0 (sure) hbase API

Upvotes: 1

Related Questions