我们正在尝试将https://github.com/linkedin/play-testng-plugin升级到 scala 2.10 / sbt 0.13,同时使用https://bitbucket.org的新版本(3.0.0 与 2.0.3)/jmhofer/sbt-testng-interface/wiki/Home
但是,我在 sbt compile 上遇到一个奇怪的错误,我们无法弄清楚,但似乎是由以下代码截图引起的:
class WrappedTestNGRunner(testClassLoader: ClassLoader, loggers: Array[Logger], state: TestRunState) extends TestNGRunner(testClassLoader: ClassLoader, loggers: Array[Logger], state: TestRunState) {
override def run(testClassname: String, fingerprint: Fingerprint, eventHandler: EventHandler, testOptions: Array[String]) = {
super.run(testClassname, fingerprint, eventHandler, testOptions)
}
}
错误信息:
[error]
[error] while compiling: /home/bliang/Projects/play-testng-plugin/plugin/src/main/scala/NGPlugin.scala
[error] during phase: erasure
[error] library version: version 2.10.1
[error] compiler version: version 2.10.1
[error] reconstructed args: -bootclasspath /export/apps/jdk/JDK-1_6_0_27/jre/lib/resources.jar:/export/apps/jdk/JDK-1_6_0_27/jre/lib/rt.jar:/export/apps/jdk/JDK-1_6_0_27/jre/lib/sunrsasign.jar:/export/apps/jdk/JDK-1_6_0_27/jre/lib/jsse.jar:/export/apps/jdk/JDK-1_6_0_27/jre/lib/jce.jar:/export/apps/jdk/JDK-1_6_0_27/jre/lib/charsets.jar:/export/apps/jdk/JDK-1_6_0_27/jre/lib/modules/jdk.boot.jar:/export/apps/jdk/JDK-1_6_0_27/jre/classes:/home/bliang/Projects/play-2.2.0-M2/repository/cache/org.scala-lang/scala-library/jars/scala-library-2.10.1.jar -classpath /home/bliang/Projects/play-testng-plugin/plugin/target/scala-2.10/sbt-0.13/classes:/home/bliang/Projects/play-2.2.0-M2/repository/cache/scala_2.10/sbt_0.13/de.johoop/sbt-testng-plugin/jars/sbt-testng-plugin-3.0.0.jar:/home/bliang/Projects/play-2.2.0-M2/repository/cache/de.johoop/sbt-testng-interface_2.10/jars/sbt-testng-interface_2.10-3.0.0.jar:/home/bliang/Projects/play-2.2.0-M2/repository/cache/org.scala-sbt/sbt/jars/sbt-0.13.0.jar:/home/bliang/Projects/play-2.2.0-M2/repository/cache/org.scala-sbt/main/jars/main-0.13.0.jar:/home/bliang/Projects/play-2.2.0-M2/repository/cache/org.scala-sbt/actions/jars/actions-0.13.0.jar:/home/bliang/Projects/play-2.2.0-M2/repository/cache/org.scala-sbt/classpath/jars/classpath-0.13.0.jar:/home/bliang/Projects/play-2.2.0-M2/repository/cache/org.scala-sbt/launcher-interface/jars/launcher-interface-0.13.0.jar:/home/bliang/Projects/play-2.2.0-M2/repository/cache/org.scala-sbt/interface/jars/interface-0.13.0.jar:/home/bliang/Projects/play-2.2.0-M2/repository/cache/org.scala-sbt/io/jars/io-0.13.0.jar:/home/bliang/Projects/play-2.2.0-M2/repository/cache/org.scala-sbt/control/jars/control-0.13.0.jar:/home/bliang/.sbt/boot/scala-2.10.2/lib/scala-compiler.jar:/home/bliang/.sbt/boot/scala-2.10.2/lib/scala-reflect.jar:/home/bliang/Projects/play-2.2.0-M2/repository/cache/org.scala-sbt/completion/jars/completion-0.13.0.jar:/home/bliang/Projects/play-2.2.0-M2/repository/cache/org.scala-sbt/collections/jars/collections-0.13.0.jar:/home/bliang/Projects/play-2.2.0-M2/repository/local/jline/jline/2.11/jars/jline.jar:/home/bliang/Projects/play-2.2.0-M2/repository/cache/org.scala-sbt/api/jars/api-0.13.0.jar:/home/bliang/Projects/play-2.2.0-M2/repository/cache/org.scala-sbt/compiler-integration/jars/compiler-integration-0.13.0.jar:/home/bliang/Projects/play-2.2.0-M2/repository/cache/org.scala-sbt/incremental-compiler/jars/incremental-compiler-0.13.0.jar:/home/bliang/Projects/play-2.2.0-M2/repository/cache/org.scala-sbt/logging/jars/logging-0.13.0.jar:/home/bliang/Projects/play-2.2.0-M2/repository/cache/org.scala-sbt/process/jars/process-0.13.0.jar:/home/bliang/Projects/play-2.2.0-M2/repository/cache/org.scala-sbt/relation/jars/relation-0.13.0.jar:/home/bliang/Projects/play-2.2.0-M2/repository/cache/org.scala-sbt/compile/jars/compile-0.13.0.jar:/home/bliang/Projects/play-2.2.0-M2/repository/cache/org.scala-sbt/persist/jars/persist-0.13.0.jar:/home/bliang/Projects/play-2.2.0-M2/repository/cache/org.scala-tools.sbinary/sbinary_2.10/jars/sbinary_2.10-0.4.2.jar:/home/bliang/Projects/play-2.2.0-M2/repository/cache/org.scala-sbt/classfile/jars/classfile-0.13.0.jar:/home/bliang/Projects/play-2.2.0-M2/repository/cache/org.scala-sbt/compiler-ivy-integration/jars/compiler-ivy-integration-0.13.0.jar:/home/bliang/Projects/play-2.2.0-M2/repository/cache/org.scala-sbt/ivy/jars/ivy-0.13.0.jar:/home/bliang/Projects/play-2.2.0-M2/repository/cache/org.scala-sbt/cross/jars/cross-0.13.0.jar:/home/bliang/Projects/play-2.2.0-M2/repository/local/org.apache.ivy/ivy/2.3.0-rc1/jars/ivy.jar:/home/bliang/Projects/play-2.2.0-M2/repository/local/com.jcraft/jsch/0.1.46/jars/jsch.jar:/home/bliang/Projects/play-2.2.0-M2/repository/cache/org.scala-sbt/run/jars/run-0.13.0.jar:/home/bliang/Projects/play-2.2.0-M2/repository/cache/org.scala-sbt/task-system/jars/task-system-0.13.0.jar:/home/bliang/Projects/play-2.2.0-M2/repository/cache/org.scala-sbt/tasks/jars/tasks-0.13.0.jar:/home/bliang/Projects/play-2.2.0-M2/repository/cache/org.scala-sbt/tracking/jars/tracking-0.13.0.jar:/home/bliang/Projects/play-2.2.0-M2/repository/cache/org.scala-sbt/cache/jars/cache-0.13.0.jar:/home/bliang/Projects/play-2.2.0-M2/repository/cache/org.scala-sbt/testing/jars/testing-0.13.0.jar:/home/bliang/Projects/play-2.2.0-M2/repository/cache/org.scala-sbt/test-agent/jars/test-agent-0.13.0.jar:/home/bliang/Projects/play-2.2.0-M2/repository/local/org.scala-sbt/test-interface/1.0/jars/test-interface.jar:/home/bliang/Projects/play-2.2.0-M2/repository/cache/org.scala-sbt/main-settings/jars/main-settings-0.13.0.jar:/home/bliang/Projects/play-2.2.0-M2/repository/cache/org.scala-sbt/apply-macro/jars/apply-macro-0.13.0.jar:/home/bliang/Projects/play-2.2.0-M2/repository/cache/org.scala-sbt/command/jars/command-0.13.0.jar:/home/bliang/Projects/play-2.2.0-M2/repository/cache/org.scala-sbt/compiler-interface/jars/compiler-interface-src-0.13.0.jar:/home/bliang/Projects/play-2.2.0-M2/repository/cache/org.scala-sbt/compiler-interface/jars/compiler-interface-bin-0.13.0.jar:/home/bliang/Projects/play-2.2.0-M2/repository/cache/org.scala-sbt/precompiled-2_8_2/jars/compiler-interface-bin-0.13.0.jar:/home/bliang/Projects/play-2.2.0-M2/repository/cache/org.scala-sbt/precompiled-2_9_2/jars/compiler-interface-bin-0.13.0.jar:/home/bliang/Projects/play-2.2.0-M2/repository/cache/org.scala-sbt/precompiled-2_9_3/jars/compiler-interface-bin-0.13.0.jar
[error]
[error] last tree to typer: This(anonymous class $anonfun)
[error] symbol: anonymous class $anonfun (flags: final <synthetic>)
[error] symbol definition: final class $anonfun extends AbstractFunction1[ClassLoader,Unit] with Serializable
[error] symbol owners: anonymous class $anonfun -> method apply -> anonymous class $anonfun -> method ngSettings -> object NGPlugin -> package plugin
[error] context owners: value sharedState -> class WrappedTestNGFramework -> package plugin
[error]
[error] == Enclosing template or block ==
[error]
[error] Template( // val <local WrappedTestNGFramework>: <notype> in class WrappedTestNGFramework, tree.tpe=com.linkedin.plugin.WrappedTestNGFramework
[error] "java.lang.Object", "org.scalatools.testing.Framework" // parents
[error] ValDef(
[error] private
[error] "_"
[error] <tpt>
[error] <empty>
[error] )
[error] // 8 statements
[error] DefDef( // def <init>(): com.linkedin.plugin.WrappedTestNGFramework in class WrappedTestNGFramework
[error] <method>
[error] "<init>"
[error] []
[error] List(Nil)
[error] <tpt> // tree.tpe=com.linkedin.plugin.WrappedTestNGFramework
[error] Block(
[error] Apply( // def <init>(): Object in class Object
[error] WrappedTestNGFramework.super."<init>" // def <init>(): Object in class Object
[error] Nil
[error] )
[error] ()
[error] )
[error] )
[error] ValDef( // private[this] val name: String in class WrappedTestNGFramework
[error] private <local> <triedcooking>
[error] "name "
[error] <tpt> // tree.tpe=String
[error] "TestNGFakeApp"
[error] )
[error] DefDef( // val name(): String in class WrappedTestNGFramework
[error] <method> <stable> <accessor>
[error] "name"
[error] []
[error] List(Nil)
[error] <tpt> // tree.tpe=String
[error] WrappedTestNGFramework.this."name " // private[this] val name: String in class WrappedTestNGFramework
[error] )
[error] ValDef( // private[this] val tests: Array[org.scalatools.testing.Fingerprint] in class WrappedTestNGFramework
[error] private <local> <triedcooking>
[error] "tests "
[error] <tpt> // tree.tpe=Array[org.scalatools.testing.Fingerprint]
[error] Apply( // def apply[T](xs: Seq[T],implicit evidence$2: scala.reflect.ClassTag[T]): Array[T] in object Array, tree.tpe=Array[org.scalatools.testing.Fingerprint]
[error] TypeApply( // def apply[T](xs: Seq[T],implicit evidence$2: scala.reflect.ClassTag[T]): Array[T] in object Array, tree.tpe=(xs: Seq[org.scalatools.testing.Fingerprint], implicit evidence$2: scala.reflect.ClassTag[org.scalatools.testing.Fingerprint])Array[org.scalatools.testing.Fingerprint]
[error] "scala"."Array"."apply" // def apply[T](xs: Seq[T],implicit evidence$2: scala.reflect.ClassTag[T]): Array[T] in object Array
[error] <tpt> // tree.tpe=org.scalatools.testing.Fingerprint
[error] )
[error] // 2 arguments
[error] Apply( // implicit def wrapRefArray[T <: Object](xs: Array[T]): scala.collection.mutable.WrappedArray[T] in class LowPriorityImplicits, tree.tpe=Seq[org.scalatools.testing.Fingerprint]
[error] TypeApply( // implicit def wrapRefArray[T <: Object](xs: Array[T]): scala.collection.mutable.WrappedArray[T] in class LowPriorityImplicits, tree.tpe=(xs: Array[org.scalatools.testing.Fingerprint])scala.collection.mutable.WrappedArray[org.scalatools.testing.Fingerprint]
[error] scala.this."Predef"."wrapRefArray" // implicit def wrapRefArray[T <: Object](xs: Array[T]): scala.collection.mutable.WrappedArray[T] in class LowPriorityImplicits
[error] <tpt> // tree.tpe=org.scalatools.testing.Fingerprint
[error] )
[error] ArrayValue(
[error] <tpt> // tree.tpe=org.scalatools.testing.Fingerprint
[error] List(
[error] Apply( // def <init>(annotationName: String,isModule: Boolean): de.johoop.testnginterface.Annotated in class Annotated
[error] new de.johoop.testnginterface.Annotated."<init>" // def <init>(annotationName: String,isModule: Boolean): de.johoop.testnginterface.Annotated in class Annotated
[error] // 2 arguments
[error] "com.linkedin.plugin.FakeApplication"
[error] Apply( // def apply$default$2(): Boolean @scala.annotation.unchecked.uncheckedVariance in object Annotated
[error] "de"."johoop"."testnginterface"."Annotated"."apply$default$2" // def apply$default$2(): Boolean @scala.annotation.unchecked.uncheckedVariance in object Annotated
[error] Nil
[error] )
[error] )
[error] )
[error] )
[error] )
[error] Apply( // def apply[T](runtimeClass1: Class[_]): scala.reflect.ClassTag[T] in object ClassTag, tree.tpe=scala.reflect.ClassTag[org.scalatools.testing.Fingerprint]
[error] TypeApply( // def apply[T](runtimeClass1: Class[_]): scala.reflect.ClassTag[T] in object ClassTag, tree.tpe=(runtimeClass1: Class[_])scala.reflect.ClassTag[org.scalatools.testing.Fingerprint]
[error] "ClassTag"."apply" // def apply[T](runtimeClass1: Class[_]): scala.reflect.ClassTag[T] in object ClassTag
[error] <tpt> // tree.tpe=org.scalatools.testing.Fingerprint
[error] )
[error] classOf[org.scalatools.testing.Fingerprint]
[error] )
[error] )
[error] )
[error] DefDef( // val tests(): Array[org.scalatools.testing.Fingerprint] in class WrappedTestNGFramework
[error] <method> <stable> <accessor>
[error] "tests"
[error] []
[error] List(Nil)
[error] <tpt> // tree.tpe=Array[org.scalatools.testing.Fingerprint]
[error] WrappedTestNGFramework.this."tests " // private[this] val tests: Array[org.scalatools.testing.Fingerprint] in class WrappedTestNGFramework
[error] )
[error] DefDef( // def testRunner(testClassLoader: ClassLoader,loggers: Array[org.scalatools.testing.Logger]): com.linkedin.plugin.WrappedTestNGRunner in class WrappedTestNGFramework
[error] <method>
[error] "testRunner"
[error] []
[error] // 1 parameter list
[error] ValDef( // testClassLoader: ClassLoader
[error] <param> <triedcooking>
[error] "testClassLoader"
[error] <tpt> // tree.tpe=ClassLoader
[error] <empty>
[error] )
[error] ValDef( // loggers: Array[org.scalatools.testing.Logger]
[error] <param> <triedcooking>
[error] "loggers"
[error] <tpt> // tree.tpe=Array[org.scalatools.testing.Logger]
[error] <empty>
[error] )
[error] <tpt> // tree.tpe=com.linkedin.plugin.WrappedTestNGRunner
[error] Apply( // def <init>(testClassLoader: ClassLoader,loggers: Array[org.scalatools.testing.Logger],state: de.johoop.testnginterface.TestRunState): com.linkedin.plugin.WrappedTestNGRunner in class WrappedTestNGRunner
[error] new com.linkedin.plugin.WrappedTestNGRunner."<init>" // def <init>(testClassLoader: ClassLoader,loggers: Array[org.scalatools.testing.Logger],state: de.johoop.testnginterface.TestRunState): com.linkedin.plugin.WrappedTestNGRunner in class WrappedTestNGRunner
[error] // 3 arguments
[error] "testClassLoader" // testClassLoader: ClassLoader
[error] "loggers" // loggers: Array[org.scalatools.testing.Logger]
[error] WrappedTestNGFramework.this."sharedState" // private[this] val sharedState: de.johoop.testnginterface.TestRunState in class WrappedTestNGFramework
[error] )
[error] )
[error] ValDef( // private[this] val sharedState: de.johoop.testnginterface.TestRunState in class WrappedTestNGFramework
[error] private <local> <triedcooking>
[error] "sharedState"
[error] <tpt> // tree.tpe=de.johoop.testnginterface.TestRunState
[error] Apply( // def <init>(): de.johoop.testnginterface.TestRunState in class TestRunState, tree.tpe=de.johoop.testnginterface.TestRunState
[error] new de.johoop.testnginterface.TestRunState."<init>" // def <init>(): de.johoop.testnginterface.TestRunState in class TestRunState, tree.tpe=()de.johoop.testnginterface.TestRunState
[error] Nil
[error] )
[error] )
[error] DefDef( // def testRunner(x$1: ClassLoader,x$2: Array[org.scalatools.testing.Logger]): org.scalatools.testing.Runner in class WrappedTestNGFramework
[error] <method> <bridge>
[error] "testRunner"
[error] []
[error] // 1 parameter list
[error] ValDef( // x$1: ClassLoader
[error] <param> <synthetic>
[error] "x$1"
[error] <tpt> // tree.tpe=ClassLoader
[error] <empty>
[error] )
[error] ValDef( // x$2: Array[org.scalatools.testing.Logger]
[error] <param> <synthetic>
[error] "x$2"
[error] <tpt> // tree.tpe=Array[org.scalatools.testing.Logger]
[error] <empty>
[error] )
[error] <tpt> // tree.tpe=org.scalatools.testing.Runner
[error] Apply( // def testRunner(testClassLoader: ClassLoader,loggers: Array[org.scalatools.testing.Logger]): com.linkedin.plugin.WrappedTestNGRunner in class WrappedTestNGFramework
[error] WrappedTestNGFramework.this."testRunner" // def testRunner(testClassLoader: ClassLoader,loggers: Array[org.scalatools.testing.Logger]): com.linkedin.plugin.WrappedTestNGRunner in class WrappedTestNGFramework
[error] // 2 arguments
[error] "x$1" // x$1: ClassLoader
[error] "x$2" // x$2: Array[org.scalatools.testing.Logger]
[error] )
[error] )
[error] )
[error]
[error] uncaught exception during compilation: scala.reflect.internal.Types$TypeError
[error] /home/bliang/Projects/play-testng-plugin/helpers/src/main/java/com/linkedin/plugin/NGTests.java:119: cannot find symbol
[error] symbol : constructor FakeApplication(java.io.File,java.lang.ClassLoader,java.util.Map<java.lang.String,java.lang.String>,java.util.List<java.lang.String>)
[error] location: class play.test.FakeApplication
[error] return new FakeApplication(new File(path), Helpers.class.getClassLoader(), getConf(), getPlugins());
[error] ^
[error] Note: /home/bliang/Projects/play-testng-plugin/helpers/src/main/java/com/linkedin/plugin/NGTests.java uses unchecked or unsafe operations.
[error] Note: Recompile with -Xlint:unchecked for details.
[error] 1 error
[trace] Stack trace suppressed: run last play-plugins-testng/compile:compile for the full output.
[error] (play-plugins-testng/compile:compile) scala.reflect.internal.Types$TypeError: bad symbolic reference. A signature in EventRecorder.class refers to term testng
[error] in package org which is not available.
[error] It may be completely missing from the current classpath, or the version on
[error] the classpath might be incompatible with the version used when compiling EventRecorder.class.
[error] (play-testng-helpers/compile:compile) javac returned nonzero exit code
[error] Total time: 4 s, completed Aug 28, 2013 5:36:20 PM
差异如下:
diff --git a/plugin/src/main/scala/NGPlugin.scala b/plugin/src/main/scala/NGPlugin.scala
index e3f7c67d5386c3737ea5c4c31c30e83a47111471..89ae5687d371e0b353dd39f869d31afb81844085 100644
--- a/plugin/src/main/scala/NGPlugin.scala
+++ b/plugin/src/main/scala/NGPlugin.scala
@@ -44,7 +44,7 @@ object NGPlugin extends Plugin {
libraryDependencies <++= (testNGVersion in Test)(v => Seq(
"org.testng" % "testng" % v % "test->default",
// If changing this, be sure to change in Build.scala also.
- "de.johoop" %% "sbt-testng-interface" % "2.0.3" % "test"))
+ "de.johoop" % "sbt-testng-interface_2.10" % "3.0.0" % "test"))
)
private def playLoggerClass(loader: ClassLoader) = {
@@ -74,4 +74,4 @@ class WrappedTestNGRunner(testClassLoader: ClassLoader, loggers: Array[Logger],
override def run(testClassname: String, fingerprint: Fingerprint, eventHandler: EventHandler, testOptions: Array[String]) = {
super.run(testClassname, fingerprint, eventHandler, testOptions)
}
-}
+}
\ No newline at end of file
diff --git a/project/Build.scala b/project/Build.scala
index aee26f3af24644fa9bdb39f1d317a91b60d2618c..2a62dd04be0a68aab11c0b07edaf8e0c283afcf7 100644
--- a/project/Build.scala
+++ b/project/Build.scala
@@ -21,6 +21,7 @@ object NGPluginBuild extends Build {
url(ArtifactoryBaseUrl + "CORE"))(LinkedInPatterns)
val typeSafeReleases = "TypeSafeRelease" at "http://repo.typesafe.com/typesafe/releases/"
+ val sonaTypeReleases = "Sonatype OSS Releases" at "https://oss.sonatype.org/content/repositories/releases/"
}
lazy val root = Project("root", file("."),
@@ -34,7 +35,7 @@ object NGPluginBuild extends Build {
settings = commonSettings ++ Seq(
libraryDependencies ++= Seq(
"org.testng" % "testng" % "6.4", // % "provided"
- "play" %% "play-test" % "2012.09.20.1886ca6" //% "provided"
+ "play" % "play-test_2.10" % "2.2-SNAPSHOT" //% "provided"
)))
lazy val NGPlugin = Project(
@@ -45,16 +46,16 @@ object NGPluginBuild extends Build {
libraryDependencies <++= (scalaVersion, sbtVersion) {
case (scalaVersion, sbtVersion) => Seq(
// If changing this, be sure to change in NGPlugin.scala also.
- sbtPluginExtra("de.johoop" % "sbt-testng-plugin" % "2.0.3", "0.12", scalaVersion),
- "de.johoop" %% "sbt-testng-interface" % "2.0.3"
+ sbtPluginExtra("de.johoop" % "sbt-testng-plugin" % "3.0.0", "0.13", "2.10"),
+ "de.johoop" % "sbt-testng-interface_2.10" % "3.0.0"
)
}))
lazy val commonSettings: Seq[Setting[_]] = Project.defaultSettings ++ publishSettings ++ Seq(
organization := "com.linkedin",
- scalaVersion := "2.9.2",
+ scalaVersion := "2.10.1",
version := "2012.09.20.1886ca6-v5",
- resolvers ++= Seq(Repos.localRepo, Repos.sandbox, Repos.typeSafeReleases))
+ resolvers ++= Seq(Repos.localRepo, Repos.sandbox, Repos.typeSafeReleases, Repos.sonaTypeReleases))
lazy val publishSettings: Seq[Setting[_]] = Seq(
// publishTo <<= version { (v: String) =>
diff --git a/project/build.properties b/project/build.properties
index a8c2f849be3cf976d18427f666d9e6d433d189b2..0974fce44da5f8a84f7e1efe6aff9ebb25d128f6 100755
--- a/project/build.properties
+++ b/project/build.properties
@@ -1 +1 @@
-sbt.version=0.12.0
+sbt.version=0.13.0
diff --git a/sample/project/build.properties b/sample/project/build.properties
index a8c2f849be3cf976d18427f666d9e6d433d189b2..0974fce44da5f8a84f7e1efe6aff9ebb25d128f6 100644
--- a/sample/project/build.properties
+++ b/sample/project/build.properties
@@ -1 +1 @@
-sbt.version=0.12.0
+sbt.version=0.13.0