rules_scala icon indicating copy to clipboard operation
rules_scala copied to clipboard

Make java library earlier on classpath

Open fzakaria opened this issue 7 months ago • 3 comments

Description

I have a scala_library with some java files where I would like to override the class for a particular dependency (i.e. something from @maven//).

This is a common idiom for monkey patching some functionality.

In order for this to work, the Java file needs to be first on the classpath. @rules_scala seems to be placing the generated java_library at the end of the CLASSPATH.

This change makes it so that it's first.

fzakaria avatar Jul 08 '25 22:07 fzakaria

This patch properly lets me override the Java files of my Maven dependencies from my scala_library

fzakaria avatar Jul 08 '25 22:07 fzakaria

Please add a test for this specific case, and I'd be happy to merge it.

mbland avatar Nov 05 '25 17:11 mbland

I have opened a new PR for this change with a test added https://github.com/bazel-contrib/rules_scala/pull/1797

vinnybod avatar Dec 02 '25 17:12 vinnybod