How to add a resources directory into the jar?

In my build.gradle

I tried:

 task pomPropertiesGeneration << {
    String      destDir     = "build/resources/main/META-INF/maven"
    String      filepath    = "${destDir}/pom.properties"
    File        dir         = new File( destDir )
    dir.mkdirs()
    Properties  maven       = new Properties()
    File        propsFile   = new File( "${filepath}" )
    maven.setProperty( 'version'    , theVersion )
    maven.setProperty( 'groupId'    , theGroup )
    maven.setProperty( 'artifactId' , theName )
    maven.store(propsFile.newWriter(), null)
}
build.dependsOn pomPropertiesGeneration

this create a directory into “build/resources/main/META-INF/” but this is not part of generated jar.

Thanks for your help

I finally found myself by using the target compileJava instead of build