Why is gradle not excluding a specific package from my jar?


(Scott Alexander-Bown) #1

Hi, I’m looking to exclude all files and sub packages from internal package when creating a Jar for the source code.

task androidSourcesJar(type: Jar) {
    excludes['**/internal/**']
    classifier = 'sources'
    from android.sourceSets.main.java.srcDirs
}

What I’ve tried so far in the excludes com.mycomp.internal, com.mycomp.internal.**, com/mycomp/internal, com/mycomp/internal.* and the one above /internal/.

But each time I run the task the internal package is still included :frowning: is using excludes the best way to achieve this? if so what’s wrong with my exclucion pattern?

Thanks