Specifying files to be added to build and jar

I’m trying to setup a composite build where one project contains the js/html files, and the other the Java classes. Let’s call these gradle projects “app-server” and “app-ui”.

In “app-ui”, let’s say I generate the js files into some folder “out”, then I add a task like so:

task webjar(type: Jar, dependsOn: 'jar') {
    from(fileTree('out')) {
        into 'META-INF/resources'

If I build the “webjar” task, I see the js/html files in META-INF/resources in the jar.

Now, In “app-server”, which is a spring boot app, I add the composite build dependency into build.gradle and settings.gradle, which works fine. Then, I also add “build.dependsOn gradle.includedBuild(‘app-ui’).task(’:webjar’)”, but that doesn’t seem to include the the js/html files anywhere.

How can I set this up so that the “app-ui” project always packages the js/html files into the jar, and the “app-server” project includes it? Thanks!