mirror of
https://github.com/System-End/Discord-MC-Chat.git
synced 2026-04-19 19:45:14 +00:00
jar main method
This commit is contained in:
parent
62d216391d
commit
5b27d432c9
1 changed files with 10 additions and 4 deletions
|
|
@ -22,11 +22,17 @@ java {
|
|||
targetCompatibility = JavaVersion.VERSION_21
|
||||
}
|
||||
|
||||
jar {
|
||||
manifest {
|
||||
attributes "Main-Class": "com.xujiayao.discord_mc_chat.common.DMCC"
|
||||
}
|
||||
}
|
||||
|
||||
//========== Merge JARs ==========
|
||||
|
||||
def otherSubprojects = rootProject.subprojects.findAll { it.name != project.name }
|
||||
|
||||
tasks.register('mergeJars') {
|
||||
tasks.register("mergeJars") {
|
||||
dependsOn otherSubprojects.collect { ":$it.name:jar" }
|
||||
|
||||
def commonJar = tasks.jar.archiveFile.get().asFile
|
||||
|
|
@ -36,11 +42,11 @@ tasks.register('mergeJars') {
|
|||
tempDir.mkdirs()
|
||||
def addedFiles = [:]
|
||||
otherSubprojects.each { subproj ->
|
||||
def jarFile = subproj.tasks.named('jar').get().archiveFile.get().asFile
|
||||
def jarFile = subproj.tasks.named("jar").get().archiveFile.get().asFile
|
||||
copy {
|
||||
from zipTree(jarFile)
|
||||
into tempDir
|
||||
exclude 'META-INF/MANIFEST.MF'
|
||||
exclude "META-INF/MANIFEST.MF"
|
||||
eachFile { fcd ->
|
||||
def relPath = fcd.relativePath.toString()
|
||||
if (addedFiles.containsKey(relPath)) {
|
||||
|
|
@ -60,6 +66,6 @@ tasks.register('mergeJars') {
|
|||
}
|
||||
|
||||
// 保证 mergeJars 在 jar 之后执行
|
||||
tasks.named('assemble').configure {
|
||||
tasks.named("assemble").configure {
|
||||
dependsOn mergeJars
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue