A repository to reproduce 1256 bazel issue and coresponding StackOverflow question.
As described in StackOverflow question the problem hides in dependecies configuration. There are some additional problems. They are described in Problem description section.
For example we need borer-core
of version 1.6.3
.
We define and install it in the Workspace
file.
This jar
we then use it in our some-borer/BUILD
file.
We use deriveAllCodecs
in our code. And it uses macroses inside.
So we use scala_macro_library
.
But at compilation time we faced the issue, that JMV cannot find io.bullet.borer.deriver.Deriver
class. But it is precompiled and already exists.
To reproduce run:
bazel build //some-borer:lib
You should see the error caused by: Worker process did not return a WorkResponse
.
For example in this case we need to use spark
of version 3.0.2
.
Let's define and install it in the Workspace
file as usual. Then use it in the BUILD
file.
To build this lib we use scala_library
rule.
But we will recieve an error, that bazel cannot find the objects and classes, that are in org.apache.spark.sql.*
To reproduce run:
bazel build //some-spark:lib
The solution of the Borrer and Spark problems is to define all direct dependecies or change scala_toolchain
mode to plus-one (docs). The patched version of repository you can see in corresponding branches:
More detailed anwser is published on the Stack Overflow.
To build specific target run:
bazel build //<name>:<mode>
where name
can be some-borer
, some-logger
or some-spark
and mode
can be lib
.
To build all targets at once in this repo use
bazel build //...
Technologie | Version |
---|---|
scala |
2.12 |
rules_jvm_external |
31701ad93dbfe544d597dbe62c9a1fdd76d81d8a9150c2bf1ecf928ecdf97169 |
rules_scala |
5df8033f752be64fbe2cedfd1bdbad56e2033b15 |
bazel |
bazel 4.0.0-homebrew |