Skip to content

Can't use scala_library target in java_test #443

@orrsella

Description

@orrsella

One of the core strengths of Scala is its inteop with Java, in both directions. Therefore it should probably be possible to use Scala code from Java tests. At Wix we have a large mixed Scala/Java code base. It's very common for classes to be in Java and have their tests written in Scala.

$ ./bazel test //...:
ERROR: /Users/orr/Dev/Projects/bazel-test/my-java-lib/src/test/java/com/example/BUILD:5:12: in deps attribute of java_test rule //my-java-lib/src/test/java/com/example:test: scala_library rule '//my-java-lib/src/main/scala/com/example:scala' is misplaced here (expected cc_binary, cc_library, genrule, genproto, java_import, java_library, sh_binary or sh_library).
ERROR: Analysis of target '//my-java-lib/src/test/java/com/example:test' failed; build aborted.
INFO: Elapsed time: 0.080s
ERROR: Couldn't start the build. Unable to run tests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3We're not considering working on this, but happy to review a PR. (No assignee)type: feature request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions