Quick Start is a simple example, if you want to do more detailed configuration, you can refer to this document
The purpose of this step is to generate Metadata that conforms to the Maven standard.
Medivh-Publish Encapsulates the maven-publish plugin of Gradle to achieve this function
If you have not import this plugin, Medivh-publisher will automatically help you import it, you do not need to do any configuration.
If you have already used the Maven-Publish plugin configuration, Medivh-Publish will automatically use your configuration, you do not need to do any additional configuration.
If you do not fill in the Maven-Publish plugin configuration completely, Medivh-Publish will help you fill in the default values, and will output a warning message on the console.
publishing {
publications {
create<MavenPublication>("medivh-api") {
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
from(components["java"])
pom{
name = "medivh-api"
description = "medivh plugin api"
url = "https://github.com/medivh-project/medivh"
licenses{
license{
name = "GPL-3.0 license"
url = "https://www.gnu.org/licenses/gpl-3.0.txt"
}
}
developers {
developer {
id = "id"
name = "name"
email = "email"
}
}
scm {
connection = "scm:git:"
url = "https://github.com/medivh-project/medivh"
}
}
}
}
}
This is very similar to the Maven-Publish configuration
medivhPublisher{
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
pom{
name = "medivh-api"
description = "medivh plugin api"
url = "https://github.com/medivh-project/medivh"
licenses{
license{
name = "GPL-3.0 license"
url = "https://www.gnu.org/licenses/gpl-3.0.txt"
}
}
developers {
developer {
id = "id"
name = "name"
email = "email"
}
}
scm {
connection = "scm:git:"
url = "https://github.com/medivh-project/medivh"
}
}
}
Medivh-Publish guarantees that you will not make mistakes no matter how you configure it, because Medivh-Publish will help you fill in the default values, but it is still recommended that you check your configuration for omissions.
In Sonatype’s Document,the Pom Xml required to be pulished must contain the following configuration:
The configuration is populated granularly to each attribute configured. For example:
The Scm information must contain connection
and url
attributes.
If you have configured connection
but not url
, Medivh-Publish will still help you fill in the other attribute.
If you have manually configured these parameters, even if they are empty, Medivh-Publish will use your configuration and will not override the default values, unless null is set, because this is illegal in Maven.
Configuration | require | remark |
---|---|---|
No |
If don’t upload,you can’t download source and doc in your IDE |
|
Yes |
Use to verify the file, will be detailed later |
|
Yes |
artifact id like "com.example:my-library:1.0.0" |
|
Yes |
|
|
Yes |
||
Yes |
||
Yes |
info about version control |
Medivh-Publish
upload source and doc by default, if you don’t need it, you can configure it in build.gradle:
medivhPublisher{
withoutJavaDocJar()
withoutSourcesJar()
}
Configuration is equivalent to:
java {
withJavadocJar()
withSourcesJar()
}
The purpose of this configuration is to get the signing file required by Maven
Medivh-Publish encapsulates the signing plugin of Gradle to achieve this function, generally no special configuration is required
You need to make sure that you have configured the necessary information. Gpg Guide
The purpose of this configuration is to get the correct coordinate required by Maven Likecom.example:my-library:1.0.0
Default configuration value in Medivh-Publish:
groupId = project.group
artifactId = project.name
version = project.version
Contains three attributes: name
, description
, url
Medivh-Publish default value:
name = project.name
description = project.description
Medivh-Publish will get your git remote url as the value of url, otherwise it will fill in an empty string
url = gitRemoteUrl or empty
Developer Info contains three attributes: id
, name
, email
Medivh-Publish will get the developer information of the git repository by default
name git config user.name
email git config user.email
id git config user.name