This project contains two sbt plugins that automatically configure your build to perform Load-time weaving (LTW) with Aspectj when running your application from within SBT, both for regular applications and Play Framework projects in development mode and ensure that your aspects will always be woven as expected.
SBT versions 0.13 and 1.0 are supported.
First and foremost, simplicity. Although adding the AspectJ Weaver agent is just about adding the -javaagent
option
to the JVM, doing so can be challenging when running from SBT. These plugins take care of the corner cases and ensure
that hitting run
will just work, regardless your project type or whether you are forking the JVM or not.
Add the sbt-aspectj-runner
plugin to your project/plugins.sbt
file using the code bellow:
resolvers += Resolver.bintrayRepo("kamon-io", "sbt-plugins")
addSbtPlugin("io.kamon" % "sbt-aspectj-runner" % "1.1.1")
Just run
, like you do all the time!
Here is what the plugin will do depending on your fork
settings:
-javaagent:<jarpath>
and that's all.For Play Framework 2.7 projects add the sbt-aspectj-runner-play-2.7
to your project/plugins.sbt
file:
resolvers += Resolver.bintrayIvyRepo("kamon-io", "sbt-plugins")
addSbtPlugin("io.kamon" % "sbt-aspectj-runner-play-2.7" % "1.1.2")
For Play Framework 2.6 projects add the sbt-aspectj-runner-play-2.6
to your project/plugins.sbt
file:
resolvers += Resolver.bintrayIvyRepo("kamon-io", "sbt-plugins")
addSbtPlugin("io.kamon" % "sbt-aspectj-runner-play-2.6" % "1.1.2")
For Play 2.4 and 2.5 you can use the older sbt-aspectj-play-runner
plugin:
resolvers += Resolver.bintrayIvyRepo("kamon-io", "sbt-plugins")
addSbtPlugin("io.kamon" % "sbt-aspectj-play-runner" % "1.0.4")
This plugin has been tested with Play 2.4.8, Play 2.5.10, Play 2.6.11 and Play 2.7.0.
Just run
, like you do all the time! A notice will be shown saying that you are running your application with the
AspectJ Weaver.
The Play Framework SBT plugin will not allow the JVM to be forked so this plugin will override the way class loaders are created to use WeavingURLClassLoader instead, making sure that aspects will be woven when running on Development mode.
There are full runnable examples.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
1. 开源生态
2. 协作、人、软件
3. 评估模型