sbt / sbt-jacoco

an sbt plugin for JaCoCo Code Coverage
https://scala-sbt.org/sbt-jacoco/
Eclipse Public License 1.0
123 stars 67 forks source link

working with sbt-aspectj #29

Open tutufool opened 10 years ago

tutufool commented 10 years ago

Hi,

I'm using sbt-aspectj plugin to do runtime weaving for my code.

The config for aspectj plugin is something like:

lazy val aspectJSettings = aspectjSettings ++ Seq( aspectjVersion := Dependencies.aspectjVersion, compileOnly in Aspectj := true, fork in Test := true, javaOptions in Test <++= weaverOptions in Aspectj, javaOptions in run <++= weaverOptions in Aspectj, lintProperties in Aspectj += "invalidAbsoluteTypeName = ignore" )

I believe it will finally add "-javaagent:aspectjweaver-1.x.x.jar" to the java command.

It works well when I do sbt test

However, when I try to do jacoco:cover

The test case failed due to the aspectj not working.

I'm wondering whether jacoco's instrument has some conflict with apsectj's?

btw, I use addSbtPlugin("com.typesafe.sbt" % "sbt-aspectj" % "0.9.4") and aspectj weaver 1.7.4

Thanks

Leon

drmarjanovic commented 7 years ago

Hi, @tutufool

Any progress on this? Currently, I'm issuing problem with AspectJ Weaver Missing message in tests. I need to provide path to Java agent .jar in javaOptions but sbt jacoco:cover override that. I'm using sbt-aspectj-play-runner 1.0.1 and sbt-aspectj 0.10.6. Also, when I type sbt test it works fine.

Thanks in advance.