Examples of using gradle to add kotlin JS output to a WAR?



I’m converting a project to use gradle. My root project has two subprojects. Let’s say they’re called ServerSide and ClientSide. ServerSide uses gradle plugins ‘java’, ‘kotlin’, ‘war’. And ClientSide is for compiling kotlin to JS, so it uses the ‘kotlin2js’ plugin.

Are there any examples on how to get the .js output files from ClientSide into the war produced by ServerSide? If I simply add the ClientSide project as a dependency in ServerSide, gradle puts ClientSide.jar in ServerSide’s WEB-INF/lib.



You can try putting generated JS files to META-INF/resources/ directory, this makes servlet containers to expose these files as static resources. See https://blogs.oracle.com/alexismp/entry/web_inf_lib_jar_meta