sbt / sbt/sbt-javaagent

SBT 2.x: incompatible with native BOM support

Open
#97 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Scala
Stars
68
Forks
21
Avg merge
2h 35m
Merged PRs (30d)
3

Description

Hello folks,

When upgrading to SBT 2.x, the combination of this plugin's and native BOM support is not correctly handled from what I understand.

What worked in SBT 1.x:

  • plugin "com.here.platform" % "sbt-bom" % "1.0.34"
  • the following build.sbt:
import com.here.bom.Bom

lazy val otelBom = Bom("io.opentelemetry.instrumentation" % "opentelemetry-instrumentation-bom-alpha" % "2.30.0-alpha")

lazy val root = (project in file("."))
  .enablePlugins(JavaAgent)
  .settings(copFrameworkBom)
  .settings(dependencyOverrides ++= otelBom.key.value.bomDependencies)
  .settings(
    javaAgents += "io.opentelemetry.javaagent" % "opentelemetry-javaagent" % otelBom.key.value
  )

What doesn't work in SBT 2.x:

lazy val root = (project in file("."))
  .enablePlugins(JavaAgent)
  .settings(
    libraryDependencies += ("io.opentelemetry.instrumentation" % "opentelemetry-instrumentation-bom-alpha" % "2.30.0-alpha").pomOnly()
  )
  .settings(
    javaAgents += "io.opentelemetry.javaagent" % "opentelemetry-javaagent" % "*"
  )

The error:

[error] java.lang.RuntimeException: Unable to resolve agents, missing agents: List(AgentModule(opentelemetry-javaagent,io.opentelemetry.javaagent:opentelemetry-javaagent:*:javaagent,AgentScope(false,false,false,true),))
[error] 	at scala.sys.package$.error(package.scala:28)
[error] 	at com.lightbend.sbt.javaagent.JavaAgent.resolveAgents$$anonfun$1(JavaAgent.scala:88)
[error] 	at scala.Function1.$anonfun$compose$1(Function1.scala:79)
[error] 	at scala.Function1.$anonfun$compose$1(Function1.scala:79)
[error] 	at sbt.std.Transform$$anon$3.work(Transform.scala:79)
[error] 	at sbt.std.Transform$$anon$3.work(Transform.scala:79)
[error] 	at sbt.Execute.submit$$anonfun$1$$anonfun$1(Execute.scala:283)
[error] 	at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:24)
[error] 	at sbt.Execute.work(Execute.scala:294)
[error] 	at sbt.Execute.submit$$anonfun$1(Execute.scala:283)
[error] 	at sbt.ConcurrentRestrictions$$anon$4.$anonfun$2(ConcurrentRestrictions.scala:269)
[error] 	at sbt.CompletionService$$anon$2.call(CompletionService.scala:75)
[error] 	at sbt.CompletionService$$anon$2.call(CompletionService.scala:73)
[error] 	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
[error] 	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
[error] 	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
[error] 	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
[error] 	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
[error] 	at java.base/java.lang.Thread.run(Thread.java:1583)
[error] (resolvedJavaAgents) Unable to resolve agents, missing agents: List(AgentModule(opentelemetry-javaagent,io.opentelemetry.javaagent:opentelemetry-javaagent:*:javaagent,AgentScope(false,false,false,true),))

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the SBT 2.x configuration from the issue, then inspect JavaAgent.scala around line 88 where agent resolution fails. Compare how the native BOM and wildcard javaAgent version are handled; done means the shown OpenTelemetry BOM configuration resolves the javaagent without the missing-agent error.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, scala
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.