如何在build.sbt中添加test-jar

时间:2017-08-22 08:42:47

标签: java maven elasticsearch sbt elasticsearch-1.6.0

我正在关注此链接 https://www.elastic.co/guide/en/elasticsearch/reference/1.6/using-elasticsearch-test-classes.html

maven style

提供了依赖关系
 <dependencies>
      <dependency>
        <groupId>com.carrotsearch.randomizedtesting</groupId>
        <artifactId>randomizedtesting-runner</artifactId>
        <version>${randomizedtesting-runner.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.apache.lucene</groupId>
        <artifactId>lucene-test-framework</artifactId>
        <version>${lucene.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.elasticsearch</groupId>
        <artifactId>elasticsearch</artifactId>
        <version>${elasticsearch.version}</version>
        <scope>test</scope>
        <type>test-jar</type>
      </dependency>
      <dependency>
        <groupId>org.elasticsearch</groupId>
        <artifactId>elasticsearch</artifactId>
        <version>${elasticsearch.version}</version>
        <scope>test</scope>
      </dependency>
    </dependencies>

我正在使用sbt所以我尝试在build.sbt中执行相同操作我正在使用ES version 1.6.0

"org.elasticsearch" % "elasticsearch" % "1.6.0",
                "org.elasticsearch" % "elasticsearch" % "1.6.0" % "test",
                "org.apache.lucene" % "lucene-test-framework" % "4.10.4" % "test",
                "com.carrotsearch.randomizedtesting" % "randomizedtesting-runner" % "1.6.0" % "test",
                "org.apache.lucene" % "lucene-codecs" % "4.10.4" % "test",
                "org.apache.logging.log4j" % "log4j-core" % "2.8.2",
                "org.apache.logging.log4j" % "log4j-slf4j-impl" % "2.8.2" ,
                "org.apache.logging.log4j" % "log4j-api" % "2.8.2",

我有两个问题

<dependency>
    <groupId>org.elasticsearch</groupId>
    <artifactId>elasticsearch</artifactId>
    <version>${elasticsearch.version}</version>
    <scope>test</scope>
    <type>test-jar</type>
  </dependency>
  <dependency>
    <groupId>org.elasticsearch</groupId>
    <artifactId>elasticsearch</artifactId>
    <version>${elasticsearch.version}</version>
    <scope>test</scope>
  </dependency>

我如何在sbt中写这些,我试图像这样做

"org.elasticsearch" % "elasticsearch" % "1.6.0" % "test",

但我不知道如何在sbt中使用下面的行

<scope>test</scope>
    <type>test-jar</type>

当我尝试使用ElasticsearchIntegrationTest扩展我的课程时,它会让我感到错误not found ElasticsearchIntegrationTest 也没有什么可以导入测试

import org.elasticsearch.test //doing this gives cmpilation error 

我的第二个问题是我使用的ES版本的正确librabry版本是1.6.0

**编辑** 通过执行

来解决Mt第一个查询
"org.elasticsearch" % "elasticsearch" % "1.6.0" % "test" classifier "tests",

现在我的第二个问题没有得到答复,请指导

0 个答案:

没有答案