-
-
Notifications
You must be signed in to change notification settings - Fork 4
快速开始
huanmeng_qwq edited this page Dec 27, 2024
·
13 revisions
目前主流的构建系统主要分为Gradle和Maven,其它构建系统需要自行了解如何执行
在build.gradle或build.gradle.kts文件中添加:
plugins {
// 添加shadow插件,来将依赖打包到最终产物中
id("com.gradleup.shadow") version "8.3.0"
}
dependencies {
implementation("com.huanmeng-qwq:bukkit-gui:2.3.6")
// Kotlin DSL依赖
implementation("com.huanmeng-qwq:bukkit-gui-kotlin-dsl:2.3.6")
}
// 除此之外,还需要对包名进行重定向,以避免不同插件见的版本冲突
shadowJar {
// 替换 'com.yourpackage' 为你自己插件的包路径
relocate("org.bstats","com.yourpackage.bstats") // 这是必须的,否则无法正常运行
relocate 'me.huanmeng.opensource', 'com.yourpackage.huanmeng'
}
在pom.xml文件中添加:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.3</version> <!-- 版本可能不是最新的 -->
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
<configuration>
<relocations>
<relocation>
<pattern>me.huanmeng.opensource.bukkit.gui</pattern>
<!-- 替换 'com.yourpackage' 为你自己插件的包路径 -->
<shadedPattern>com.yourpackage.gui</shadedPattern>
</relocation>
<relocation>
<pattern>org.bstats</pattern>
<!-- 替换 'com.yourpackage' 为你自己插件的包路径 -->
<shadedPattern>com.yourpackage.bstats</shadedPattern>
</relocation>
</relocations>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.huanmeng-qwq</groupId>
<artifactId>bukkit-gui</artifactId>
<version>2.3.6</version>
</dependency>
<!--Kotlin DSL-->
<dependency>
<groupId>com.huanmeng-qwq</groupId>
<artifactId>bukkit-gui-kotlin-dsl</artifactId>
<version>2.3.6</version>
</dependency>
</dependencies>