kamon-io / sbt-aspectj-runner

sbt plugin for running aspectj weaver
Other
34 stars 16 forks source link

Incorrect aspectjweaver jar used for 'javaagent:' if aspectjweaver-1.8.6-sources.jar is present. #8

Closed scottweaver closed 7 years ago

scottweaver commented 7 years ago

OS: OS X, El Capitan Scala version: 2.11.8 Java Version: 1.8.0_77 SBT Version: 0.13.13

If the aspectjweaver-1.8.6-sources.jar is present under .ivy2/cache/org.aspectj/aspectjweaver/srcs, the sbt-aspectj-runner will erroneously use that jar for the javaagent instead of correctly using .ivy2/cache/org.aspectj/aspectjweaver/jars/aspectjweaver-1.8.6.jar.

The following error is raised when executing aspectj-runner:run:

[info] Error occurred during initialization of VM
[error] Failed to find Premain-Class manifest attribute in /Users/sweaver/.ivy2/cache/org.aspectj/aspectjweaver/srcs/aspectjweaver-1.8.6-sources.jar
[info] agent library failed to init: instrument
java.lang.RuntimeException: Nonzero exit code returned from runner: 1
    at scala.sys.package$.error(package.scala:27)

Steps to reproduce:

  1. Explicitly add the aspectj weaver as a dependency and have it set to download sources: "org.aspectj" % "aspectjweaver" % aspectJVersion withSources() withJavadoc()
  2. Make sure that fork in run := true
  3. Reload/start SBT.
  4. Execute aspectj-runner:run
  5. Should fail

Work-around

  1. Remove 'withSources()' from the dependency: "org.aspectj" % "aspectjweaver" % aspectJVersion withJavadoc()
  2. Delete ivy2/cache/org.aspectj/aspectjweaver/srcs/aspectjweaver-1.8.6-sources.jar
  3. Reload/start SBT.
  4. Execute aspectj-runner:run
  5. Should run as expected
dpsoft commented 7 years ago

related to https://github.com/kamon-io/sbt-aspectj-runner/pull/9