简体   繁体   English

在Scala SBT项目中导入Accumulo库

[英]Import Accumulo Libraries in Scala SBT project

I want to know about, using Accumulo or any other java libraries in SBT projects. 我想知道,在SBT项目中使用Accumulo或任何其他Java库。

I used Intellij to automatically import libraries, and it imported but getting errors in Intellij and at runtime/project build like:- Cannot resolve _ . 我使用Intellij自动导入库,它导入了,但是在Intellij中以及在运行时/项目构建时出现错误,例如:- Cannot resolve _ In import org.apache.accumulo.core.client.__ import org.apache.accumulo.core.client.__

I used these steps to include:- File > Project Structure > Libraries(In left Pan) > Clicked + icon located at top left in middle pan > Selected from Maven > Searched Accumulo and Selected org.apache.accumulo.core. 我使用了以下步骤:- File > Project Structure > Libraries(In left Pan) > Clicked icon located at top left in middle pan > Selected from Maven > File > Project Structure > Libraries(In left Pan) > Clicked icon located at top left in middle pan > Selected from Maven > + icon located at top left in middle pan > Selected from Maven >搜索Accumulo and Selected org.apache.accumulo.core.

When you look for Maven dependencies in Maven central it also gives you the syntax for adding the dependencies in several build tools - Including SBT for instance if you look up Apache Accumulo core you'd see the SBT usage as : libraryDependencies += "org.apache.accumulo" % "accumulo-core" % "1.8.1" 当您在Maven Central中查找Maven依赖项时,它还为您提供了在多个构建工具中添加依赖项的语法-例如,如果您查找Apache Accumulo核心,则包括SBT,您会看到SBT的用法为: libraryDependencies += "org.apache.accumulo" % "accumulo-core" % "1.8.1"

在此处输入图片说明

Thanks to Arnon Rotem-Gal-Oz for directing me in right direction. 感谢Arnon Rotem-Gal-Oz指导我正确的方向。 A few more I points I want to add are following:- 我想补充的几点是:

  1. You can add your JAR files in lib directory of your project root directory. 您可以将JAR文件添加到项目目录的lib目录中。

  2. The step with which I was having problem is also working now with minor changes with major effects. 我遇到问题的步骤现在也可以进行较小的更改而产生重大影响。

    The correct steps for IntelliJ are:- IntelliJ的正确步骤是:

    • File -> Project Structure -> Libraries -> Click + icon in top left of second column 文件->项目结构->库->单击第二列左上角的+图标

    • Chose Maven( or other if you are having jar files) 选择Maven(或其他,如果您有jar文件)

    • Search Your Library 搜索您的图书馆

    • Click on Download to {Project Root Directory}/lib 单击下载到{Project Root Directory} / lib

    • Press Enter or Click OK 按Enter或单击OK

    • It will take some time proportional to size of lib and number of it's dependencies. 与lib的大小及其依赖项的数量成比例,这将花费一些时间。 After downloading a popup will come 下载后会弹出

    • Press shift and click the modules in which you want to import the library. 按shift键,然后单击要在其中导入库的模块。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM