当我运行这个FatJar / UberJar任务时,我最终得到一个.jar文件,其META-INF \文件夹包含两个MANIFEST.MF文件 . 一个是正确的,我将信息插入到任务定义中,另一个只包含"Manifest-Version: 1.0" . This causes a "Could not find or load main class" error when attempting to run the application (我假设它只是阅读第一个并且无法识别主类)

task fatJar(type: Jar) {
baseName = project.name

manifest {
    attributes 'Implementation-Title': 'Synchronizer',
               'Main-Class': 'net.xxx.yyy.Main'
}     
     from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } } 
     with jar 
}

MANIFEST.MF#1
清单 - 版本:1.0

MANIFEST.MF#2:
清单 - 版本:1.0
实现 - Headers :同步器
主类:net.xxx.yyy.Main

什么是重复清单的原因?
我已经尝试使用排除MANIFEST.MF

it.isDirectory() ? it : zipTree(it).matching{exclude{it.path.contains == 'META-INF'}}  
it.isDirectory() ? it : zipTree(it).matching{exclude{it.name.contains == 'MANIFEST'}}

***这些确实排除了子JAR META-INF文件夹和Manifest文件,所以我不确定MANIFEST.MF#1来自哪里 . 它似乎是默认的?