Skip to content

Base plugin

The base plugin generally provides the same functionality as the main plugin, but it doesn’t configure anything automatically and instead relies on manual configuration.

Applying the plugin

Add the plugin to any Gradle project that should be published

plugins {
  id "com.vanniktech.maven.publish.base" version "0.28.0"
}
plugins {
  id("com.vanniktech.maven.publish.base") version "0.28.0"
}

General configuration

Follow the steps of the Maven Central or other Maven repositories guides. Note that the SONATYPE_HOST, SONATYPE_AUTOMATIC_RELEASE and RELEASE_SIGNING_ENABLED are not considered by the base plugin and the appropriate DSL methods need to be called.

For the pom configuration via Gradle properties the following needs to be enabled in the DSL:

mavenPublishing {
  pomFromGradleProperties()
}
mavenPublishing {
  pomFromGradleProperties()
}

Configuring what to publish

To define what should be published, the configure method in the mavenPublishing block needs to be called. Check out the what to publish page which contains a detailed description of available options for each project type.

It is also possible to get the automatic behavior of the main plugin by calling configureBasedOnAppliedPlugins() instead of configure

mavenPublishing {
  configure(...)
  // or
  configureBasedOnAppliedPlugins()
}
mavenPublishing {
  configure(...)
  // or
  configureBasedOnAppliedPlugins()
}