build: 优化构建脚本
This commit is contained in:
44
build.gradle
44
build.gradle
@@ -1,5 +1,7 @@
|
||||
//file:noinspection GrDeprecatedAPIUsage
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'com.github.johnrengelman.shadow' version '7+'
|
||||
}
|
||||
|
||||
group 'cn.hamster3.mc.plugin'
|
||||
@@ -8,6 +10,7 @@ version '1.0.0-SNAPSHOT'
|
||||
subprojects {
|
||||
apply plugin: 'java-library'
|
||||
apply plugin: 'maven-publish'
|
||||
apply plugin: 'com.github.johnrengelman.shadow'
|
||||
|
||||
group = rootProject.group
|
||||
version = rootProject.version
|
||||
@@ -18,10 +21,6 @@ subprojects {
|
||||
}
|
||||
}
|
||||
|
||||
configurations {
|
||||
shade
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// https://mvnrepository.com/artifact/org.jetbrains/annotations
|
||||
compileOnly 'org.jetbrains:annotations:23.0.0'
|
||||
@@ -46,6 +45,10 @@ subprojects {
|
||||
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
|
||||
}
|
||||
|
||||
jar {
|
||||
classifier = 'dev'
|
||||
}
|
||||
|
||||
javadoc {
|
||||
options.quiet()
|
||||
options.setEncoding("UTF-8")
|
||||
@@ -58,4 +61,37 @@ subprojects {
|
||||
'https://bukkit.windit.net/javadoc'
|
||||
]
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
classifier = ''
|
||||
relocate 'org.slf4j', 'cn.hamster3.mc.plugin.core.lib.slf4j'
|
||||
relocate 'net.kyori', 'cn.hamster3.mc.plugin.core.lib.kyori'
|
||||
relocate 'com.zaxxer.hikari', 'cn.hamster3.mc.plugin.core.lib.hikari'
|
||||
relocate 'de.tr7zw.changeme.nbtapi', 'cn.hamster3.mc.plugin.core.lib.nbtapi'
|
||||
relocate 'de.tr7zw.annotations', 'cn.hamster3.mc.plugin.core.lib.nbtapi.annotations'
|
||||
destinationDir(rootProject.buildDir)
|
||||
}
|
||||
tasks.build.dependsOn(shadowJar)
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
from project.components.java
|
||||
}
|
||||
}
|
||||
repositories {
|
||||
maven {
|
||||
def releasesRepoUrl = 'https://maven.airgame.net/maven-releases/'
|
||||
def snapshotsRepoUrl = 'https://maven.airgame.net/maven-snapshots/'
|
||||
|
||||
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
|
||||
|
||||
credentials {
|
||||
username = rootProject.properties.getOrDefault("maven_username", "")
|
||||
password = rootProject.properties.getOrDefault("maven_password", "")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user