How might I make an environment variable available to jetty using the gradle plugin? Some of the code it runs in a servlet requires a particular environment variable to be set, but I can't figure out a good way to send it to the jetty process like you can for a JavaExec task (via the environment
method).
Also acceptable would be a property. For example, if I were to run some java, I'd include a -Dproperty.name=blah
to send it the property.name
property.
We can do it for Test and JavaExec tasks... can we do it for the JettyRun task?
The container managed by the Jetty plugin runs in the Gradle process, so you need to set an environment variable or system property for that process.
The Jetty plugin is also quite outdated and limited, partly for exactly the reason that it runs inside the Gradle process. I recommend to instead give the arquillian-gradle-plugin a try. We think that this plugin paves the way to better Gradle web container support.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With