Can the java-library-distribution plugin place the main artifact jar in the lib directory as well?

I am using the java-library-distribution plugin to build my application distribution. However, the main artifact jar is placed in the top level of the archive while all other dependencies are placed in the lib directory. I can explicitly put the main artifact jar in the lib directory by adding some configuration like:

into(‘lib’) {

from { ‘build/libs’ }

}

}

however, the main artifact jar is still present in the top-level directory. How do I prevent it being copied there or change the location?

Thanks, Stan

This isn’t as nice as I’d like it to be but you can exclude the root jar.

distributions {

main {

contents {

into(‘lib’) {

from jar

}

eachFile { details ->

if(details.name == jar.archiveName && !details.relativePath.toString().contains(’/lib’)) {

details.exclude()

}

}

}

}

}