1+ plugins {
2+ id ' fabric-loom' version ' 1.9-SNAPSHOT'
3+ id ' maven-publish'
4+ }
5+
6+ version = project. mod_version
7+ group = project. maven_group
8+
9+ base {
10+ archivesName = project. archives_base_name
11+ }
12+
13+ repositories {
14+ // Add repositories to retrieve artifacts from in here.
15+ // You should only use this when depending on other mods because
16+ // Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
17+ // See https://docs.gradle.org/current/userguide/declaring_repositories.html
18+ // for more information about repositories.
19+ }
20+
21+ dependencies {
22+ // To change the versions see the gradle.properties file
23+ minecraft " com.mojang:minecraft:${ project.minecraft_version} "
24+ mappings " net.fabricmc:yarn:${ project.yarn_mappings} :v2"
25+ modImplementation " net.fabricmc:fabric-loader:${ project.loader_version} "
26+
27+ // Fabric API. This is technically optional, but you probably want it anyway.
28+ modImplementation " net.fabricmc.fabric-api:fabric-api:${ project.fabric_version} "
29+
30+ }
31+
32+ processResources {
33+ inputs. property " version" , project. version
34+
35+ filesMatching(" fabric.mod.json" ) {
36+ expand " version" : project. version
37+ }
38+ }
39+
40+ tasks. withType(JavaCompile ). configureEach {
41+ it. options. release = 21
42+ }
43+
44+ java {
45+ // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
46+ // if it is present.
47+ // If you remove this line, sources will not be generated.
48+ withSourcesJar()
49+
50+ sourceCompatibility = JavaVersion . VERSION_21
51+ targetCompatibility = JavaVersion . VERSION_21
52+ }
53+
54+ jar {
55+ from(" LICENSE" ) {
56+ rename { " ${ it} _${ project.base.archivesName.get()} " }
57+ }
58+ }
59+
60+ // configure the maven publication
61+ publishing {
62+ publications {
63+ create(" mavenJava" , MavenPublication ) {
64+ artifactId = project. archives_base_name
65+ from components. java
66+ }
67+ }
68+
69+ // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
70+ repositories {
71+ // Add repositories to publish to here.
72+ // Notice: This block does NOT have the same function as the block in the top level.
73+ // The repositories here will be used for publishing your artifact, not for
74+ // retrieving dependencies.
75+ }
76+ }
0 commit comments