Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bazel run - passing main arguments

Tags:

bazel

I created an image using java_image but I would like to pass arguments to my main function (i.e. String args[]). How can I do that when I use "bazel run name_of_image" command?

like image 319
Adib Rastegarnia Avatar asked Jan 14 '19 03:01

Adib Rastegarnia


2 Answers

bazel run //your:rule -- arg1 arg2 ... argN

Everything after -- is passed to the binary.

like image 164
László Avatar answered Oct 06 '22 21:10

László


When using java_image, bazel run //my_image will only load the image into the Docker daemon, it won't run it. To run it, you should use:

docker run bazel/my_image:my_image [args]
like image 26
Rodrigo Queiro Avatar answered Oct 06 '22 19:10

Rodrigo Queiro