-
-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Respect the archivesName #46
base: 1.21
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ repositories { | |
} | ||
|
||
base { | ||
archivesName = mod_id | ||
archivesName = "${file_name}-${minecraft_version}" | ||
} | ||
|
||
// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17. | ||
|
@@ -123,10 +123,16 @@ tasks.withType(ProcessResources).configureEach { | |
} | ||
} | ||
|
||
// Build and publish a -sources.jar as well (useful for addons) | ||
java { | ||
withSourcesJar() | ||
} | ||
Comment on lines
+127
to
+129
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Move this above the comment (which is for the |
||
|
||
// Example configuration to allow publishing using the maven-publish plugin | ||
publishing { | ||
publications { | ||
register('mavenJava', MavenPublication) { | ||
artifactId = project.base.archivesName.get() | ||
sciwhiz12 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
from components.java | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See above: the file name can be this for the local file and that's fine, but for the published module (the bit in the publishing block) it should be a normal, conventional module name -- in this case, probably |
||
# 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. | ||
mod_description=Example mod description.\nNewline characters can be used and will be replaced properly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR has set the base archives name to be the name of the published module -- however, you're now publishing the artifact at
com.example.examplemod:ExampleMod-1.20.4
. By convention, module names are lowercase, so this is not great. The inclusion of the minecraft version in the module name is also not optimal - it means that someone could depend on bothExampleMod-1.20.4
and, say,ExampleMod-1.20.2
and gradle would just pull in both -- whereas publishing every version of a mod under the same module name wouldn't allow this to happen.The other solution to the latter problem is the use of capabilities but that is way to complicated for the MDK.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost every mod file I've ever seen has published using WordCase names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, and that's fine for CF/MR publishing but a bad pattern for maven publishing (which is all this block is for) because it's the opposite of what is done in the wider gradle and maven world. Let's set a good example instead of propagating a problematic pattern. The use of the MC version in the module name is an even bigger issue, as it can lead to issues during dependency resolution and getting two copies of a module.