bazeltools / bazel-deps

Generate bazel dependencies for maven artifacts
MIT License
250 stars 122 forks source link

Missing scalactic transitive dependency when using scalatest 3.0.8 #269

Closed Smeb closed 4 years ago

Smeb commented 4 years ago

When experimenting with using bazel + bazel_deps, I ran into the following error for testing:

Exception in thread "main" java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file org/scalactic/source/PositionMacro$
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
        ...

Which I resolved by adding the following to dependencies.yaml:

  org.scalactic:
    scalactic:
      version: "3.0.8"
      lang: scala

My understanding was this kind of transitive dependency should be resolved by bazel_deps - I'm not sure if the reason it fails is because scalactic is being used as a macro (Additionally, I was under the impression that scalactic is an optional dependency for scalatest). Hopefully this is the right place to raise this issue - I'm still growing my understanding of the bazel ecosystem, and as adding scalactic to dependencies solved the problem, this seemed to be the most logical place.

For reference, here's the test class:

package dev.experiments

import org.scalatest.FunSpec

class MainTest extends FunSpec {
  describe("when running tests") {
    it("can show successes") {
      assert(true)
    }
  }
}

Here's my BUILD:

scala_test(
    name="experiments",
    srcs=["MainTest.scala"],
    deps=[
        "//3rdparty/jvm/org/scalatest:scalatest"
    ]
)
Smeb commented 4 years ago

Scratch this - using strict_deps also alerts to the issue!