I have some JavaScript and CSS files which are not part of my WAR module source repository. They are not packaged in a Maven dependency either. I separately extract them to a path on my local system.
How can I use include these resources in my Maven WAR application and still take advantage of liberty dev mode for rapid, iterative development?
To include web resources from locations other than the typical src/main/webapp directory, configure a property and the maven-war-plugin with the
<webResources>
parameter with something like this:pom.xml
NOTES
While the basic idea still applies at earlier versions, you'll get a better experience with recommended minimum versions:
PREREQ MINIMUM VERSIONS
PLUGIN-LEVEL CONFIGURATION
Note too the maven-war-plugin configuration should be added at the plugin level for liberty dev mode to access it, rather than at the level of an execution defined under the maven-war-plugin.
PROPERTY OVERRIDE
As with Maven project properties in general, this can now be overridden:
mvn -DwebResDir=/some/path ... <goals, phases>
REFERENCES
More examples here: https://maven.apache.org/plugins/maven-war-plugin/examples/adding-filtering-webresources.html