2014-02-26 55 views
0

今天我想寫一些測試使用ImpermamentDatabase,Neo4j的網頁上:http://docs.neo4j.org/chunked/stable/tutorials-java-unit-testing.html它說,neo4j-kernel罐子必須<type>test-jar</type>添加爲它containt測試類。春天數據的Neo4j 2.3.4 - ImpermamentDatabase和依賴罐子版本

現在,這裏是我的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看時,我可以看到我在1.9.3版本有例如neo4j-kernel依賴,不應該將其包含在2.X版本罐子?

另一個問題,是安全的,我只是在最新版本test-jar類型添加neo4j-kernel或者我應該將其添加在1.9.3版本(如現有的JAR)

回答

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

您必須使用與正常版本相同的測試版本。否則,你可能會被欺騙,認爲有些東西可以在測試版本上運行(因爲一些錯誤可能會更新),但在普通版本中它會失敗。

+0

感謝您的答案,我切換到'3.0.0'版本並添加了''org.neo4j「%」neo4j-kernel「%」2.0.1「%」test「classifier」tests「'並且一切正常。 – Andna

+0

很高興聽到:) – amb