famous-author-71879
06/27/2023, 9:18 PMbackend/BUILD
like so:
scala_sources(
name = 'main',
sources = ['src/main/scala/**/*.scala'],
dependencies = [':resources'],
main = "com.mycompany.some.package.name.Main$"
)
I thought I'd be able to run the thing with`pants run backend:main`, but that fails with an error:
TooManyTargetsException: The `run` goal only works with one valid target, but was given multiple valid targets:
<complete list of source files here>
Please select one of these targets to run.
I can indeed run it by specifying the .scala file that my Main
object is defined in explicitly, but then what's the point of scala_sources
having a main
setting? That's not how it's supposed to work, right?happy-kitchen-89482
06/28/2023, 1:00 AMscala_sources()
shouldn't have a main
field at allhappy-kitchen-89482
06/28/2023, 1:01 AMjvm_artifact
has a main
, and that makes sense to me. But I'm not sure why a sources
target would.happy-kitchen-89482
06/28/2023, 1:01 AMhappy-kitchen-89482
06/28/2023, 1:03 AMscala_sources()
target is a generator for many individual scala_source()
targets, one for each source filehappy-kitchen-89482
06/28/2023, 1:03 AMmain
field is defined on each scala_source()
, which doesn't seem to make any sensehappy-kitchen-89482
06/28/2023, 1:04 AMmain
requiredhappy-kitchen-89482
06/28/2023, 1:05 AMscala_source
has a main
to begin withhappy-kitchen-89482
06/28/2023, 1:05 AMjava_source
and kotlin_source
, but presumably this is an error that persisted via copy-pastahappy-kitchen-89482
06/28/2023, 1:08 AMhappy-kitchen-89482
06/28/2023, 1:09 AMancient-vegetable-10556
06/28/2023, 1:09 AMhappy-kitchen-89482
06/28/2023, 3:00 AMmain
on the underlying scala_source()
(singular) which doesn't seem to make senseancient-vegetable-10556
06/28/2023, 3:01 AMfamous-author-71879
06/28/2023, 7:43 AMhappy-kitchen-89482
06/29/2023, 2:09 AMhappy-kitchen-89482
06/29/2023, 2:09 AMhappy-kitchen-89482
06/29/2023, 2:10 AMfamous-author-71879
06/29/2023, 7:31 PMfamous-author-71879
06/29/2023, 7:32 PMfamous-author-71879
06/29/2023, 7:32 PMsubproject/main/src/scala/com/company/some/package/Main.scala
famous-author-71879
06/29/2023, 7:33 PMsubproject/run
happy-kitchen-89482
06/29/2023, 11:29 PMmain
field doesn't work? You have to specify the file specifically?