From 88f38bcd2e4f1be707eb256fdd21fef15f3da200 Mon Sep 17 00:00:00 2001 From: Gavin Lambert Date: Sat, 30 Mar 2024 19:39:00 +1300 Subject: [PATCH 1/5] Respect the archivesName --- build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/build.gradle b/build.gradle index 462b8253..1b5f7182 100644 --- a/build.gradle +++ b/build.gradle @@ -127,6 +127,7 @@ tasks.withType(ProcessResources).configureEach { publishing { publications { register('mavenJava', MavenPublication) { + artifactId = project.base.archivesName.get() from components.java } } From 1b9b6c06eea01bfef0400c009a2c89c774abdd49 Mon Sep 17 00:00:00 2001 From: Gavin Lambert Date: Mon, 1 Apr 2024 14:59:28 +1300 Subject: [PATCH 2/5] Add minecraft version and sources jar by default --- build.gradle | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 1b5f7182..bf61e094 100644 --- a/build.gradle +++ b/build.gradle @@ -14,7 +14,7 @@ repositories { } base { - archivesName = mod_id + archivesName = "${name}-${minecraft_version}" } // Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17. @@ -124,6 +124,9 @@ tasks.withType(ProcessResources).configureEach { } // Example configuration to allow publishing using the maven-publish plugin +java { + withSourcesJar() +} publishing { publications { register('mavenJava', MavenPublication) { From 0857ed0b7f48e492ac5ee870121c73211fb066e3 Mon Sep 17 00:00:00 2001 From: Gavin Lambert Date: Mon, 1 Apr 2024 22:30:04 +1300 Subject: [PATCH 3/5] Add file_name property --- gradle.properties | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 346805df..be6c38cd 100644 --- a/gradle.properties +++ b/gradle.properties @@ -29,6 +29,8 @@ loader_version_range=[2,) mod_id=examplemod # The human-readable display name for the mod. mod_name=Example Mod +# The mod filename, usually the mod_id or the mod_name WithoutSpaces +file_name=ExampleMod # The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default. mod_license=All Rights Reserved # The mod version. See https://semver.org/ @@ -40,4 +42,4 @@ mod_group_id=com.example.examplemod # The authors of the mod. This is a simple text string that is used for display purposes in the mod list. mod_authors=YourNameHere, OtherNameHere # The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list. -mod_description=Example mod description.\nNewline characters can be used and will be replaced properly. \ No newline at end of file +mod_description=Example mod description.\nNewline characters can be used and will be replaced properly. From c769d8706e87c5b972638e4f6f8f43d09bc69a0a Mon Sep 17 00:00:00 2001 From: Gavin Lambert Date: Mon, 1 Apr 2024 22:30:56 +1300 Subject: [PATCH 4/5] Use file_name property --- build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index bf61e094..c853ec94 100644 --- a/build.gradle +++ b/build.gradle @@ -14,7 +14,7 @@ repositories { } base { - archivesName = "${name}-${minecraft_version}" + archivesName = "${file_name}-${minecraft_version}" } // Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17. @@ -113,7 +113,7 @@ tasks.withType(ProcessResources).configureEach { minecraft_version : minecraft_version, minecraft_version_range: minecraft_version_range, neo_version : neo_version, neo_version_range: neo_version_range, loader_version_range: loader_version_range, - mod_id : mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version, + mod_id : mod_id, mod_name: mod_name, file_name: file_name, mod_license: mod_license, mod_version: mod_version, mod_authors : mod_authors, mod_description: mod_description, ] inputs.properties replaceProperties From d3cb70ee8e7cee2ad2b1cbfbb530225dc497839a Mon Sep 17 00:00:00 2001 From: Gavin Lambert Date: Sat, 6 Apr 2024 18:42:28 +1300 Subject: [PATCH 5/5] Amend per review --- build.gradle | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index c853ec94..afd99947 100644 --- a/build.gradle +++ b/build.gradle @@ -113,7 +113,7 @@ tasks.withType(ProcessResources).configureEach { minecraft_version : minecraft_version, minecraft_version_range: minecraft_version_range, neo_version : neo_version, neo_version_range: neo_version_range, loader_version_range: loader_version_range, - mod_id : mod_id, mod_name: mod_name, file_name: file_name, mod_license: mod_license, mod_version: mod_version, + mod_id : mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version, mod_authors : mod_authors, mod_description: mod_description, ] inputs.properties replaceProperties @@ -123,10 +123,12 @@ tasks.withType(ProcessResources).configureEach { } } -// Example configuration to allow publishing using the maven-publish plugin +// Build and publish a -sources.jar as well (useful for addons) java { withSourcesJar() } + +// Example configuration to allow publishing using the maven-publish plugin publishing { publications { register('mavenJava', MavenPublication) {