1
我在哪裏gradle這個fatJar/uberJar導致試圖運行jar時以下異常的問題:搖籃fatJar/uberJar導致無法找到或加載主類
Error: Could not find or load main class com.domhauton.membrane.Main
簡單的jar任務,而不
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
工作沒有問題(直到它開始需要依賴關係)。
我想這是我的依賴關係改變類路徑的一個做的,但我不知道爲什麼會發生。
的build.gradle
project.version = '1.0.0-alpha.2'
project.group = 'com.domhauton.membrane'
jar {
baseName = 'membrane-daemon-simple'
version = project.version
manifest {
attributes 'Implementation-Title': 'Membrane Daemon',
'Implementation-Version': project.version,
'Main-Class': project.group + '.Main'
}
}
//create a single Jar with all dependencies
task fatJar(type: Jar) {
manifest {
attributes 'Implementation-Title': 'Membrane Daemon',
'Implementation-Version': project.version,
'Main-Class': project.group + '.Main'
}
baseName = 'membrane-daemon'
version = project.version
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}
搖籃構建文件的有關部分是在這裏(與代碼的其餘部分):
https://github.com/domhauton/membraned/blob/master/build.gradle
的META-INF文件夾非常滿檔,從其他的依賴關係,所以我不知道從哪裏開始尋找衝突。