Don't set artifactId manually for publishing - #121
Conversation
|
As discussed on discord, this is a major change in how artifacts will be published to maven, while I understand what the template is doing may not be best practices, I am hesitant to change publishing coordinates. |
Changing the group back to what it was previously and adding the minecraft version to the subproject name would keep the coords the same as they were before, i could go ahead and make that change if you'd like |
Just out of curiosity, how would that look? I'm going to do a proper review of this PR before you make those changes though |
| && (new File(it, "build.gradle").exists() || new File(it, "build.gradle.kts").exists()) | ||
| }.forEach { | ||
| String relativePath = rootDir.toPath().relativize(it.toPath()).toString() | ||
| String projectName = ":$modId-$relativePath" |
There was a problem hiding this comment.
Is there a specific benefit to naming the projects modid-?
There was a problem hiding this comment.
Is there a specific benefit to naming the projects
modid-?
Yes, this means that whenever something in gradle builds maven coords, it'll create something along the lines of "com.examplemod:$modId-$relativePath:version", which fixes the issue with having to set artifactId manually to get the coords to be correct
|
|
||
| rootDir.listFiles().findAll { | ||
| it.isDirectory() | ||
| && it.name != "buildSrc" |
There was a problem hiding this comment.
Since I merged PRs out of order, this would now need to be changed to build-logic
| && it.name != "buildSrc" | |
| && it.name != "build-logic" |
| group = property("group") | ||
| version = property("version") No newline at end of file |
There was a problem hiding this comment.
What is the purpose of this? as far as I'm aware setting group and version in gradle.properties sets the properties already
| rootDir.listFiles().findAll { | ||
| it.isDirectory() | ||
| && it.name != "buildSrc" | ||
| && (new File(it, "build.gradle").exists() || new File(it, "build.gradle.kts").exists()) | ||
| }.forEach { | ||
| String relativePath = rootDir.toPath().relativize(it.toPath()).toString() | ||
| String projectName = ":$modId-$relativePath" | ||
|
|
||
| include(projectName) | ||
| project(projectName).projectDir = it | ||
| } |
There was a problem hiding this comment.
Is this code worth it? isn't this adding a bunch of io checks every time a gradle command is ran?
This also doesn't let people temporarily disable projects, for example, if fabric has ported to a new MC version but neoforge has not, they can't just temporarily disable neoforge.
This also makes the readme outdated for removing projects.
Setting artifactId manually is bad practice, the name of the projects should be changed instead.
Reference: https://lukebemish.dev/2026/02/22/gradle-shorts-1-publication-coordinates.html