How exclude Ant subproject from sourceSets

I have multi-project build. One jar created based on what I have in all subprojects:

jar {
 archiveName = 'mineAll.jar'
 from getRootProject().subprojects.sourceSets.main.output
}

Now I need to add another subproject that uses Ant (rest of them are using Java plugin) and I need to exclude that project from mineAll.jar creation.

For now I’m getting error: * What went wrong: A problem occurred evaluating root project ‘proj1’. > Could not find property ‘sourceSets’ on project ‘:antProj’.

The solution is pretty easy:

from getRootProject().subprojects.findAll{it.name != 'antProj'}.sourceSets.main.output

Or a flag can be added:

def javaProject = true
  project(':antProj') {
 ant.importBuild 'some-build.xml'
         javaProject = false
}
...
from getRootProject().subprojects.findAll{it.javaProject
== 'true'}.sourceSets.main.output