jar main method

This commit is contained in:
Xujiayao 2025-08-01 15:35:22 +08:00
parent 62d216391d
commit 5b27d432c9

View file

@ -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
}