我已经添加到plugins.sbt这个声明
addSbtPlugin("com.typesafe.sbt" % "sbt-aspectj" % "0.9.0")
现在我想配置这个插件来使用方面库org.springframework编译我的java控制器类:spring-aspects:3.1.4和aspectj-maven-plugin一样
我已设置此配置:
import sbt._
import Keys._
import play.Project._
import com.typesafe.sbt.SbtAspectj._
import com.typesafe.sbt.SbtAspectj.AspectjKeys._
object ApplicationBuild extends Build {
val appDependencies = Seq(javaCore)
val main = play.Project(appName, appVersion, appDependencies).settings(
AspectjKeys.verbose in Aspectj := true,
AspectjKeys.showWeaveInfo in Aspectj := true,
AspectjKeys.inputs in Aspectj <+= compiledClasses
)
}
但确实失败了。
[error] Reference to undefined setting:
[error]
[error] aspectj:inputs from aspectj:inputs
我真的是一个新手用的东西。
插件github页面:https://github.com/sbt/sbt-aspectj
答案 0 :(得分:3)
好的,我使它成功,感谢sbt邮件列表,参见https://groups.google.com/forum/?fromgroups=#!topic/simple-build-tool/MUXyfKigC7w
和playframework邮件列表也参见https://groups.google.com/forum/?fromgroups=#!topic/play-framework/RfJFEwVbUUk
实际上并不是很难,但你看不到东西。
import sbt._
import Keys._
import play.Project._
import com.typesafe.sbt.SbtAspectj._
import com.typesafe.sbt.SbtAspectj.AspectjKeys._
object ApplicationBuild extends Build {
val appDependencies = Seq(javaCore, filters)
val main = play.Project(appName, appVersion, appDependencies)
.settings(aspectjSettings: _*)
.settings(
libraryDependencies += "org.springframework" % "spring-aspects" % "3.1.4.RELEASE",
libraryDependencies += "org.springframework.security" % "spring-security-aspects" % "3.1.4.RELEASE",
sourceLevel := "-1.7",
verbose in Aspectj := false,
showWeaveInfo in Aspectj := false,
inputs in Aspectj <+= compiledClasses,
binaries in Aspectj <++= update map { report =>
report.matching(
moduleFilter(organization = "org.springframework", name = "spring-aspects")
|| moduleFilter(organization = "org.springframework.security", name = "spring-security-aspects")
)
},
products in Compile <<= products in Aspectj,
products in Runtime <<= products in Compile
)
}
不要忘记在plugins.sbt中添加它,并在声明
之间添加一个新的行分隔符addSbtPlugin("com.typesafe.sbt" % "sbt-aspectj" % "0.9.0")