What is the difference between Gradle's "maven" and "maven-publish" plugins?

Viewed 2927

I am confused when and why I should choose one of them. Most of functions are common.

2 Answers

Both maven and maven-publish are Gradle plugins for publishing an artifact in a Maven compatible format, that is most often a pom.xml and associated jar file.

The former is now considered deprecated and maven-publish should be used instead, as of Gradle 4.8. Features like signing of artifacts and improved DSL for pom file manipulation have recently been added to maven-publish making it the preferred choice from now on.

Maven-publish is for publish artifacts to Maven repository, from documentation

The Maven Publish Plugin provides the ability to publish build artifacts to an Apache Maven repository. A module published to a Maven repository can be consumed by Maven

https://docs.gradle.org/current/userguide/publishing_maven.html

And when these artifacts are published you can use them with Maven or Gradle.

Related