Skip to content

Maven

The maven-publish plugin is automatically applied and a maven artifact is configured.

within the upload extension, there are a few helper methods to configure repositories commonly used by me.

Everything is also published to mavenLocal by default, there is no need to do the specifically.

build.gradle.kts
upload {
   // publishes to https://registry.somethingcatchy.net
   // uses the NEXUS_USER and NEXUS_TOKEN variables
   nexus()
   // publishes to the github packages maven registry
   // uses the GITHUB_ACTOR and GITHUB_TOKEN env variables
   githubPackages()

   repositories {
      // additional maven repositories
      maven(url = uri("..."))
   }
}

Artifact Modifications

There are some modifications that are applied to the artifact's metadata:

  • disables module metadata generation. This is an additional file that will be preferred over the POM, but is known to cause issues within mod development setups.
  • for forge projects: remove POM dependencies completely, as they are not working transitivily at all in ForgeGradle 6
  • for non-forge projects: remove runtime dependencies. These are usually things like JEI that are only used for testing in the dev environment and should not be included transitively by other mods. The table below visualizes the different types of dependencies

The com.possible-triangle.publishing plugin, that is resposible for these modifications also exposes the helper method MavenPublication.removePomDependencies, which can be used to additionally exclude certain dependencies from the POM by group, artifact id, scope (1), or version

  1. like runtime or compile

Dependency Types

You can read about what dependency configuration to use at what time and which are represented in the POM in the following table:

Configuration Description Examples Included Transitively
modApi required dependencies that are needed to complile & run the mod Blueprint, Registrate, Moonlight Lib
modImplementation optional dependencies that should be there for compile & runtime mods to have compatiblity with
modCompileOnly optional dependencies that are needed only at compile time mods to have compatiblity with
modCompileOnlyApi required dependencies that are only needed at compile time no idea
modRuntimeOnly optional dependencies that are only needed at runtim mods to have compatiblity with or help within the dev environment like JEI