-
Notifications
You must be signed in to change notification settings - Fork 123
Draft: Add support for mounting additional resources #206
base: master
Are you sure you want to change the base?
Draft: Add support for mounting additional resources #206
Conversation
path = new File(projectDir, "src/assets/vendor") | ||
mountpoint = "/client" | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's an example on how to configure this in the target application
@Override | ||
void addResource(Resource resource) { | ||
context.resources.createWebResourceSet(getResourceSetType('PRE'), resource.mountpoint, resource.path.toURI().toURL(), '/') | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's straight-forward to mount the resources on Tomcat 8+
@@ -40,6 +40,11 @@ abstract class BaseTomcatServerImpl implements TomcatServer { | |||
context.loader.addRepository(resource.toURI().toURL().toString()) | |||
} | |||
|
|||
@Override | |||
void addResource(Resource resource) { | |||
// TODO: how to implement this here for Tomcat 7x? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
However I haven't found out how to do it on Tomcat7.
I'm not sure if it's worth finding a solution for Tomcat7; maybe Tomcat7 should be removed anyway and instead support for Tomcat 10 be implemented as a replacement? #204
Here's an example web app using the feature: https://github.com/sebkur/example-web-app Note that it depends on |
I added the plugin to a web app I work on. Works nicely, I just found I couldn't configure something that I usually configure for development in Eclipse and deployment as WAR files: additional resources that are mounted at a specific location of the web app.
I usually use this to make client side JavaScript/CSS libraries available at a specific location and also serve static files generated by other Gradle plugins.