在Clojure中,如果我想要使用hbase测试实用程序启动一个测试集群,我必须用以下命令注释我的依赖项:
[org.apache.hbase/hbase "0.92.2" :classifier "tests" :scope "test"]首先,我不知道这是什么意思。根据leiningens样本project.clj
;; Dependencies are listed as [group-id/name version]; in addition
;; to keywords supported by Pomegranate, you can use :native-prefix
;; to specify a prefix. This prefix is used to extract natives in
;; jars that don't adhere to the default "<os>/<arch>/" layout that
;; Leiningen expects.问题1:这是什么意思?
问题2:如果我升级了版本:
[org.apache.hbase/hbase "0.94.6.1" :classifier "tests" :scope "test"]然后我会收到一个ClassNotFoundException
Exception in thread "main" java.lang.ClassNotFoundException: org.apache.hadoop.hbase.HBaseConfiguration这是怎么回事,我该怎么解决它?
发布于 2013-07-02 23:12:35
添加到依赖声明中的任何键/值对都用作clojure石榴库的参数
可以识别的键在这里的源代码中列出:in the source to pomagranate (为了将来的参考,它是到函数resolve-artifacts*的链接)
the maven pom docs may also be helpful
:scope描述使用依赖项的条件,因此:scope "test“似乎表示只有在测试时才会引入依赖项
:分类器似乎指示了区分版本的额外元素
我推测新的hbase版本的依赖解析可能有一个配置不佳的pom,它没有正确地声明它的依赖关系。尝试查找org.apache.hadoop.hbase.HBaseConfiguration的信息并手动要求提供包。
发布于 2013-07-03 03:15:41
Leinigen使用Maven dependency mechanism。阅读该链接可以了解不同的作用域。
“分类器”是一个标记,它是依赖坐标的一部分,因此一组Jars / zip文件/等可以是同一逻辑版本的一部分,但在pom.xml中声明为不同的依赖关系。因此,在本例中,“测试”是包含测试的不同于0.94.6.1的HBase工件。
您可以通过将浏览器指向该版本HBase的Maven "Central“存储库位置来查看实际操作:
http://repo1.maven.org/maven2/org/apache/hbase/hbase/0.94.6.1/
你可以在这里搜索maven的“中央”存储库:
https://repository.apache.org/
或
http://mvnrepository.com/
在ClassNotFOundException上-同意noisesmith。最好的办法是找到包含该类的依赖项(jar),并显式地将其添加到项目依赖项配置中。
通常我会在谷歌上搜索类名和"jar“,即https://www.google.com/search?q=jar+org.apache.hadoop.hbase.HBaseConfiguration
https://stackoverflow.com/questions/17410849
复制相似问题