>1
This is ok, but I don't see a good reason to have different directories. I put all my java code in a "java"
folder the contents of which mirror the package path. So if I have packages "org.dlila.x" and "org.dlila.y.z",
my directory structure will look like:
java
org
dlila
x
*.java
y
*.java
z
*.java
I see that you have defined BUILD files in "app" and "persistence" and are globbing your
sources over multiple directories. In larger code bases it's probably better to have one BUILD
file per directory, and only include sources from that directory in the srcs attribute.
So, in my example above, my build files would be:
java/org/dlila/x/BUILD
java/org/dlila/y/BUILD
java/org/dlila/y/z/BUILD
and the srcs for each of these would be "srcs = glob(["*.java"])", unless I had a test app or something
that I wanted to not include in the library, in which case I would add an exclude for that file.
> 2
You can do
bazel test <directory>/...
> 3
Yes, this is expected. In general, there shouldn't be that many shared direct dependencies between your test target and
the library target. If there are, and you don't want to repeat them, you can always define a new target with the shared
dependencies and use that in both your java_library and the corresponding java_test