My java application produces some visualisations (html, xml+xls) as outputs that cannot be served from the filesystem due to browser safeguards.
I want to make a commant like ./gradlew view that would serve those for me. For example in npm one of the ways is to use webpack-server or some other dependency then run it.
Is there an established way to run a webserver with gradle?
I think you should take a look at Ratpack. It can easily be used in a gradle script using the following configurations:
and then you can spin up a simple web server like this:
We use it mainly for testing APIs. If you want to serve static contents, you should take a look at asset-pipeline project in GitHub.