我已将此声明添加到plugins.sbt中
addSbtPlugin("com.typesafe.sbt" % "sbt-aspectj" % "0.9.0")现在我想配置这个插件,使用方面库org.springframework:spring-aspects:3.1.4编译我的java控制器类,就像使用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我真的是sbt的新手。
插件github页面:https://github.com/sbt/sbt-aspectj
发布于 2013-05-17 17:50:36
好的,我让它工作,感谢sbt邮件列表,cf。https://groups.google.com/forum/?fromgroups=#!topic/simple-build-tool/MUXyfKigC7w
以及播放框架邮件列表,参见。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")https://stackoverflow.com/questions/16568349
复制相似问题