build: 更改项目结构

This commit is contained in:
2023-06-16 19:29:00 +08:00
parent 57357c6ae2
commit 20517e7207
61 changed files with 19 additions and 38 deletions

View File

@@ -16,9 +16,9 @@ repositories {
dependencies { dependencies {
// 对于 Bukkit 插件 // 对于 Bukkit 插件
compileOnly "cn.hamster3.mc.plugin:hamster-core-bukkit:1.0.0" compileOnly "cn.hamster3.mc.plugin:core-bukkit:1.0.0"
// 对于 BungeeCord 插件 // 对于 BungeeCord 插件
compileOnly "cn.hamster3.mc.plugin:hamster-core-bungeecord:1.0.0" compileOnly "cn.hamster3.mc.plugin:core-bungeecord:1.0.0"
} }
``` ```
@@ -40,13 +40,13 @@ dependencies {
<!--对于 Bukkit 插件--> <!--对于 Bukkit 插件-->
<dependency> <dependency>
<groupId>cn.hamster3.mc.plugin</groupId> <groupId>cn.hamster3.mc.plugin</groupId>
<artifactId>hamster-core-bukkit</artifactId> <artifactId>core-bukkit</artifactId>
<version>1.0.0</version> <version>1.0.0</version>
</dependency> </dependency>
<!--对于 BungeeCord 插件--> <!--对于 BungeeCord 插件-->
<dependency> <dependency>
<groupId>cn.hamster3.mc.plugin</groupId> <groupId>cn.hamster3.mc.plugin</groupId>
<artifactId>hamster-core-bungeecord</artifactId> <artifactId>core-bungeecord</artifactId>
<version>1.0.0</version> <version>1.0.0</version>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@@ -2,7 +2,7 @@ plugins {
id 'java' id 'java'
} }
group 'cn.hamster3.mc.plugin.core' group 'cn.hamster3.mc.plugin'
version '1.0.0-SNAPSHOT' version '1.0.0-SNAPSHOT'
subprojects { subprojects {

View File

@@ -6,7 +6,7 @@ plugins {
} }
setArchivesBaseName("HamsterCore-Bukkit") setArchivesBaseName("HamsterCore-Bukkit")
evaluationDependsOn(':hamster-core-common') evaluationDependsOn(':core-common')
dependencies { dependencies {
//noinspection VulnerableLibrariesLocal //noinspection VulnerableLibrariesLocal
@@ -15,15 +15,15 @@ dependencies {
compileOnly 'net.milkbowl.vault:VaultAPI:1.7' transitive false compileOnly 'net.milkbowl.vault:VaultAPI:1.7' transitive false
compileOnly 'org.black_ixx:playerpoints:2.1.3' transitive false compileOnly 'org.black_ixx:playerpoints:2.1.3' transitive false
implementation project(":hamster-core-common") transitive false implementation project(":core-common") transitive false
//noinspection GradlePackageUpdate //noinspection GradlePackageUpdate
implementation "com.zaxxer:HikariCP:${HikariCP_version}" implementation "com.zaxxer:HikariCP:${HikariCP_version}"
//noinspection VulnerableLibrariesLocal //noinspection VulnerableLibrariesLocal
implementation "net.kyori:adventure-platform-bukkit:${adventure_version}" exclude group: 'org.jetbrains' implementation "net.kyori:adventure-platform-bukkit:${adventure_version}" exclude group: 'org.jetbrains' exclude group: 'com.google.code.gson'
// https://mvnrepository.com/artifact/net.kyori/adventure-text-minimessage // https://mvnrepository.com/artifact/net.kyori/adventure-text-minimessage
implementation "net.kyori:adventure-text-minimessage:${adventure_serializer_version}" exclude group: 'org.jetbrains' implementation "net.kyori:adventure-text-minimessage:${adventure_serializer_version}" exclude group: 'org.jetbrains'
// https://mvnrepository.com/artifact/net.kyori/adventure-text-serializer-gson // https://mvnrepository.com/artifact/net.kyori/adventure-text-serializer-gson
implementation "net.kyori:adventure-text-serializer-gson:${adventure_serializer_version}" exclude group: 'org.jetbrains' implementation "net.kyori:adventure-text-serializer-gson:${adventure_serializer_version}" exclude group: 'org.jetbrains' exclude group: 'com.google.code.gson'
// https://mvnrepository.com/artifact/net.kyori/adventure-text-serializer-legacy // https://mvnrepository.com/artifact/net.kyori/adventure-text-serializer-legacy
implementation "net.kyori:adventure-text-serializer-legacy:${adventure_serializer_version}" exclude group: 'org.jetbrains' implementation "net.kyori:adventure-text-serializer-legacy:${adventure_serializer_version}" exclude group: 'org.jetbrains'
implementation "de.tr7zw:item-nbt-api:2.11.2" implementation "de.tr7zw:item-nbt-api:2.11.2"
@@ -40,12 +40,12 @@ jar {
classifier = 'dev' classifier = 'dev'
} }
tasks.compileJava.dependsOn(":hamster-core-common:build") tasks.compileJava.dependsOn(":core-common:build")
shadowJar { shadowJar {
classifier = '' classifier = ''
dependencies { dependencies {
exclude(dependency { exclude(dependency {
it.moduleGroup == 'com.google.code.gson' || it.moduleName == 'org.jetbrains' it.moduleGroup == 'com.google.code.gson'
}) })
} }
relocate 'org.slf4j', 'cn.hamster3.mc.plugin.core.lib.slf4j' relocate 'org.slf4j', 'cn.hamster3.mc.plugin.core.lib.slf4j'
@@ -61,8 +61,6 @@ publishing {
publications { publications {
shadow(MavenPublication) { publication -> shadow(MavenPublication) { publication ->
{ {
def projectNameSplit = project.name.split('-')
artifactId = projectNameSplit[projectNameSplit.length - 1]
from components.java from components.java
} }
} }

View File

@@ -6,21 +6,21 @@ plugins {
} }
setArchivesBaseName("HamsterCore-BungeeCord") setArchivesBaseName("HamsterCore-BungeeCord")
evaluationDependsOn(':hamster-core-common') evaluationDependsOn(':core-common')
dependencies { dependencies {
//noinspection VulnerableLibrariesLocal //noinspection VulnerableLibrariesLocal
compileOnly 'net.md-5:bungeecord-api:1.19-R0.1-SNAPSHOT' compileOnly 'net.md-5:bungeecord-api:1.19-R0.1-SNAPSHOT'
implementation project(":hamster-core-common") transitive false implementation project(":core-common") transitive false
//noinspection GradlePackageUpdate //noinspection GradlePackageUpdate
implementation "com.zaxxer:HikariCP:${HikariCP_version}" implementation "com.zaxxer:HikariCP:${HikariCP_version}"
// https://mvnrepository.com/artifact/net.kyori/adventure-platform-bungeecord // https://mvnrepository.com/artifact/net.kyori/adventure-platform-bungeecord
implementation "net.kyori:adventure-platform-bungeecord:${adventure_version}" exclude group: 'org.jetbrains' implementation "net.kyori:adventure-platform-bungeecord:${adventure_version}" exclude group: 'org.jetbrains' exclude group: 'com.google.code.gson'
// https://mvnrepository.com/artifact/net.kyori/adventure-text-minimessage // https://mvnrepository.com/artifact/net.kyori/adventure-text-minimessage
implementation "net.kyori:adventure-text-minimessage:${adventure_serializer_version}" exclude group: 'org.jetbrains' implementation "net.kyori:adventure-text-minimessage:${adventure_serializer_version}" exclude group: 'org.jetbrains'
// https://mvnrepository.com/artifact/net.kyori/adventure-text-serializer-gson // https://mvnrepository.com/artifact/net.kyori/adventure-text-serializer-gson
implementation "net.kyori:adventure-text-serializer-gson:${adventure_serializer_version}" exclude group: 'org.jetbrains' implementation "net.kyori:adventure-text-serializer-gson:${adventure_serializer_version}" exclude group: 'org.jetbrains' exclude group: 'com.google.code.gson'
// https://mvnrepository.com/artifact/net.kyori/adventure-text-serializer-legacy // https://mvnrepository.com/artifact/net.kyori/adventure-text-serializer-legacy
implementation "net.kyori:adventure-text-serializer-legacy:${adventure_serializer_version}" exclude group: 'org.jetbrains' implementation "net.kyori:adventure-text-serializer-legacy:${adventure_serializer_version}" exclude group: 'org.jetbrains'
} }
@@ -36,14 +36,9 @@ jar {
classifier = 'dev' classifier = 'dev'
} }
tasks.compileJava.dependsOn(":hamster-core-common:build") tasks.compileJava.dependsOn(":core-common:build")
shadowJar { shadowJar {
classifier = '' classifier = ''
dependencies {
exclude(dependency {
it.moduleGroup == 'com.google.code.gson' || it.moduleName == 'org.jetbrains'
})
}
relocate 'org.slf4j', 'cn.hamster3.mc.plugin.core.lib.slf4j' relocate 'org.slf4j', 'cn.hamster3.mc.plugin.core.lib.slf4j'
relocate 'net.kyori', 'cn.hamster3.mc.plugin.core.lib.kyori' relocate 'net.kyori', 'cn.hamster3.mc.plugin.core.lib.kyori'
relocate 'com.zaxxer.hikari', 'cn.hamster3.mc.plugin.core.lib.hikari' relocate 'com.zaxxer.hikari', 'cn.hamster3.mc.plugin.core.lib.hikari'
@@ -55,8 +50,6 @@ publishing {
publications { publications {
shadow(MavenPublication) { publication -> shadow(MavenPublication) { publication ->
{ {
def projectNameSplit = project.name.split('-')
artifactId = projectNameSplit[projectNameSplit.length - 1]
from components.java from components.java
} }
} }

View File

@@ -29,8 +29,6 @@ test {
publishing { publishing {
publications { publications {
mavenJava(MavenPublication) { mavenJava(MavenPublication) {
def projectNameSplit = project.name.split('-')
artifactId = projectNameSplit[projectNameSplit.length - 1]
from project.components.java from project.components.java
} }
} }

View File

@@ -25,12 +25,4 @@ public abstract class CoreAPI {
public Connection getConnection() throws SQLException { public Connection getConnection() throws SQLException {
return getDataSource().getConnection(); return getDataSource().getConnection();
} }
public void reportError(@NotNull String apiKey, @NotNull String projectID, @NotNull Throwable exception) {
// todo
}
public void reportFile(@NotNull String apiKey, @NotNull String projectID, @NotNull String filename, byte @NotNull [] bytes) {
// todo
}
} }

View File

@@ -1,5 +1,5 @@
rootProject.name = 'hamster-core' rootProject.name = 'hamster-core'
include 'hamster-core-common' include 'core-common'
include 'hamster-core-bukkit' include 'core-bukkit'
include 'hamster-core-bungeecord' include 'core-bungeecord'