Gradle move directory to root before war is generated

I have a .war which must have an entry point that can be run by command line, so the directory of the class must be on the root of the .war file.

How can I move the directory to the root of the war?

I tried:

plugins {
    id 'war'

war {
    manifest {
            'Main-Class': '____embedded.____EntryPoint'

tasks.register('moveEntryPoint') {
    description 'Copies entrypoint to root dir.'
    doLast {
        ant.move file: "${buildDir}/classes/java/main/____embedded/",
                 todir: "${buildDir}/____embedded/"


When I try to build I get this error:

Received unknown event for /home/username/eclipse-workspace/apex/app/build/classes/java/main/____embedded
Stopping file watching and invalidating VFS after an error happened


There are couple ways to do this:

  1. Don’t move, just copy.

Then, attach your task it to processResources.

  1. Tell war plugin to include a directory.
war {
    webAppDirectory = file('src/main/webapp')
    from 'src/rootContent' // adds a file-set to the root of the archive