sbt throws提供的AspectJ编织外部jar文件无法确定缺少类型的超类

时间:2019-03-21 14:14:53

标签: sbt aspectj

我正在尝试编织测试库 scalatest https://mvnrepository.com/artifact/org.scalatest/scalatest_2.12/3.2.0-SNAP10)。该库依赖项位于我的build.sbt中:

enablePlugins(SbtAspectj)
libraryDependencies += "org.scalactic" %% "scalactic" % "3.0.5"
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.5" % "test"

aspectjInputs in Aspectj ++= update.value.matching(moduleFilter(organization = "com.typesafe.akka", name = "akka-actor*"))
aspectjInputs in Aspectj ++= update.value.matching(moduleFilter(organization = "org.scalatest", name = "scalatest*")) 

fullClasspath in Runtime := aspectjUseInstrumentedClasses(Runtime).value ++ aspectjUseInstrumentedClasses(Test).value

在maven网站上,它列出了其他一些可选的依赖项,例如org.jmock等。

问题在于SBT仅下载scalatest.jar而不下载jmock.jar(以及其他可选依赖项)。确实打印出aspectjInputs确实显示scalatest.jar,但不是 jmock.jar。

由于这个原因(?),它给了我以下错误:

[error] error at (no source information available)
[error] /Users/jonas/.ivy2/cache/org.scalatest/scalatest_2.12/bundles/scalatest_2.12-3.0.5.jar:0::0 can't determine superclass of missing type org.jmock.Expectations
[error] when weaving type org.scalatest.jmock.JMockExpectations
[error] when weaving classes 
[error] when weaving 
[error] when batch building BuildConfig[null] #Files=1 AopXmls=#0
[error]  [Xlint:cantFindType]

我假设我某种程度上需要ScalaTest的可选依赖项的.jar文件,但是由于sbt未下载它们,因此我不知道如何解决此问题。

那么,编织时如何解决它们或将它们添加到类路径中?

我正在使用Aspectj-sbt插件。

1 个答案:

答案 0 :(得分:0)

您可以在配置映射中包括可选的依赖项,如下所示:

(df.nunique(1)==1).astype(object).mask(df.isnull().any(1))
Out[61]: 
0     True
1      NaN
2      NaN
3    False
dtype: object