spring data neo4j 2.3.4 - ImpermamentDatabase和依赖jar版本

时间:2014-02-26 10:50:12

标签: spring neo4j spring-data-neo4j

今天我想在Neo4j页面上编写一些使用ImpermamentDatabase的测试:http://docs.neo4j.org/chunked/stable/tutorials-java-unit-testing.html它说neo4j-kernel jar必须添加<type>test-jar</type>才能进行包含测试类。

现在,这是我的build.sbt

name := """scheduling-backend"""

version := "1.0"

scalaVersion := "2.10.2"

resolvers += "spray repo" at "http://repo.spray.io"

resolvers += "spray nightlies" at "http://nightlies.spray.io"

resolvers += "SpringSource Milestone Repository" at "http://repo.springsource.org/milestone"

resolvers += "Neo4j Cypher DSL Repository" at "http://m2.neo4j.org/content/repositories/releases"

libraryDependencies ++= Seq(
  "com.typesafe.akka" %% "akka-actor" % "2.2.0",
  "com.typesafe.akka" %% "akka-slf4j" % "2.2.0",
  "ch.qos.logback" % "logback-classic" % "1.0.13",
  "io.spray" % "spray-can" % "1.2-20130712",
  "io.spray" % "spray-routing" % "1.2-20130712",
  "io.spray" %% "spray-json" % "1.2.3",
  "org.specs2" %% "specs2" % "1.14" % "test",
  "io.spray" % "spray-testkit" % "1.2-20130712" % "test",
  "com.typesafe.akka" %% "akka-testkit" % "2.2.0" % "test",
  "com.novocode" % "junit-interface" % "0.7" % "test->default",
  "org.springframework.scala" % "spring-scala" % "1.0.0.M2",
  "org.springframework.data" % "spring-data-neo4j" % "2.3.4.RELEASE",
  "org.springframework.data" % "spring-data-neo4j-rest" % "2.3.4.RELEASE",
  "javax.validation" % "validation-api" % "1.1.0.Final",
  "com.github.nscala-time" %% "nscala-time" % "0.8.0"
)

scalacOptions ++= Seq(
  "-unchecked",
  "-deprecation",
  "-Xlint",
  "-Ywarn-dead-code",
  "-language:_",
  "-target:jvm-1.7",
  "-encoding", "UTF-8"
)

testOptions += Tests.Argument(TestFrameworks.JUnit, "-v")

在查看Intellij时,我可以看到我在版本neo4j-kernel中有1.9.3个依赖关系,不应该在2.X版本中包含jars吗?

另一个问题是,我可以安全地在最新版本中添加neo4j-kernel类型test-jar,还是应该在1.9.3版本中添加{(如现有jar)

1 个答案:

答案 0 :(得分:2)

你有这个依赖org.springframework.data:spring-data-neo4j:2.3.4.RELEASE,这意味着它将使用Neo4j 1.9.3(包括测试)。

如果您需要最新的Neo4j版本(2.0 / 2.0.1),请使用org.springframework.data:spring-data-neo4j:3.0.0.RELEASE

您必须使用与普通版本相同的测试版本。否则你可能会被欺骗认为某些东西在测试版本上运行(并且因为它更新一些错误可能会被修复),但在正常版本中它将失败。