akhikhl / gretty

Advanced gradle plugin for running web-apps on jetty and tomcat.
MIT License
654 stars 174 forks source link

Gretty/Tomcat7: Static web resources included in jars in multi-project builds #148

Open uli-heller opened 9 years ago

uli-heller commented 9 years ago

I do have the impression that web resources don't work properly in Gretty.

What does work is this: Including a webjar, for example "bootstrap", works fine. http://localhost:8080/webjar/webjars/bootstrap/3.3.2-2/webjars-requirejs.js shows the embedded js file. For this, I have a prototype here: https://github.com/uli-heller/uli-java-prototypes/tree/master/webjar

Additionally, static resources within src/main/resources/META-INF/resources to work, too.

However: Dynamically adding resources to a jar by a task like this:

ext.jarTasks = tasks.withType(Jar);
jarTasks.all {
  into("META-INF/resources/doc/${project.name}") {
    from 'doc'
  }
}

does not work for gretty. The resources don't show up. They are within the jar and they do show up when deploying the war to tomcat.

A small prototype is here: https://github.com/uli-heller/uli-java-prototypes/tree/master/webjar

slavashvets commented 9 years ago

I was faced with a similar behavior recently. Please check my solution, probably it can solve your issue. https://gist.github.com/slavashvets/add44d424e0d7d7cf43c

akhikhl commented 9 years ago

Is the problem reproducible with appRunWar task?

uli-heller commented 9 years ago

Using "appRunWar", it works perfectly fine.

Best regards, Uli

On Mon, April 20, 2015 11:29 am, Andrey Hihlovskiy wrote:

Is the problem reproducible with appRunWar task?


Reply to this email directly or view it on GitHub: https://github.com/akhikhl/gretty/issues/148#issuecomment-94406513