Sending an environment variable to jetty using jettyRun in Gradle

天涯浪子 提交于 2019-12-10 15:06:10

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/17999062/sending-an-environment-variable-to-jetty-using-jettyrun-in-gradle

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!