Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task name conflict prevents use with kamon's aspectj weaver #37

Open
gregsilin opened this issue Sep 20, 2017 · 1 comment
Open

Task name conflict prevents use with kamon's aspectj weaver #37

gregsilin opened this issue Sep 20, 2017 · 1 comment

Comments

@gregsilin
Copy link

Upgrading our tooling to Scala 2.12, SBT 0.13.16 and newest (0.11.0) version of this plugin as well as the newest (1.0.1) version of the kamon-io aspectj runner plugin.

Get this on SBT start:

java.lang.RuntimeException: Some keys were defined with the same name but different types: 'aspectjWeaver' (sbt.Task[scala.Option[java.io.File]], sbt.Task[java.io.File])
	at scala.sys.package$.error(package.scala:27)
	at sbt.Index$.stringToKeyMap0(EvaluateConfigurations.scala:296)
	at sbt.Index$.stringToKeyMap(EvaluateConfigurations.scala:287)
	at sbt.Load$.structureIndex(Load.scala:209)
	at sbt.Load$$anonfun$9.apply(Load.scala:165)
	at sbt.Load$$anonfun$9.apply(Load.scala:165)
	at sbt.Load$.timed(Load.scala:1025)
	at sbt.Load$.apply(Load.scala:164)
	at sbt.Load$.defaultLoad(Load.scala:39)

I tracked it down to the fact that this plugins both define aspectjWeaver keys with different types:

trait AspectjKeys {
    val aspectjWeaver = taskKey[Option[File]]("Location of AspectJ load-time weaver.")
}

kamon plugin's definition

 object Keys {
    val aspectjWeaver = TaskKey[File]("aspectj-weaver")
  }

I'm going to continue looking for a workaround but i suspect that this could be resolved easily by prefixing the keys to make them unique. It will be a breaking change for some, but at least it will play nicely with other plugins.

@alonsodomin
Copy link

alonsodomin commented Sep 21, 2017

Do you really need to use the two plugins together? I have some projects running Kamon metrics and weaved with this plugin instead of theirs... yeah, I know, it's not automatic but...

It sounds to me that the plugins in their current state are not compatible. sbt-aspectj also seems to be much general than Kamon's sbt-aspectj-runner which is targeted to just run the weaver automatically when doing a sbt run...

Probably there is here an opportunity for collaboration between the two plugins, I don't think that adding additional prefixes to the keys in either side is a good approach for this specific problem, we may end up with really awkwardly named settings.

EDIT: PS: For a solution right now, if you do not need SBT 1.0 support you could try using earlier versions of this plugin. The task name conflict should only be present in 0.11.+ since before our keys were not prefixed with aspectj (aspectjWeaver was weaver)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants