bazelbuild/rules_appengine

How to pass args and jvm_flags to the war rules?

jiaqi opened this issue · 4 comments

jiaqi commented

I'd like to "bazel run" the war targets with additional arguments like java_binary. Is there a way to do it?

what do you mean by 'additional arguments' ? Why do you need a java_binary?

jiaqi commented

Sorry I didn't make it clear.

To compare with java_binary. java_binary rule has args and jvm_flags attributes. When user runs the target with bazel run, these arguments are passed to the application.

I'm hoping java_war and appengine_war can do something similar. Specifically, I want to define jvm_flags in BUILD file and bazel run the target, then these arguments are passed to the JVM that runs jetty. It'd be something like

java_war(
  name = "my_app",
  ...
  jvm_flags = [ "-Dparam1=value1", "-Dparam2=value2" ]
)

I don't want to specify these arguments in command every time I ran the command.

bazel run myproject:myapp -- --jvm_flags="-Dparam1=value1 -Dparam2=value2"

Does it make sense?

ah I see. jvm_flags might be confusing as a user might think those would somehow be sent to appengine on deploy.

maybe we should call it
local_jvm_flags ?

If you want to write the code and send me a PR?

jiaqi commented

Here's the PR
#110