开源软件名称(OpenSource Name):deepmedia/MavenDeployer开源软件地址(OpenSource Url):https://github.com/deepmedia/MavenDeployer开源编程语言(OpenSource Language):Kotlin 100.0%开源软件介绍(OpenSource Introduction):MavenDeployerA lightweight, handy Gradle plugin to deploy your maven packages (for example, Android AARs, Java JARs, Kotlin KLibs) to different kinds of repositories. It supports publishing to:
// settings.gradle.kts
pluginManagement {
repositories {
gradlePluginPortal()
mavenCentral()
}
}
// build.gradle.kts of deployable modules
plugins {
id("io.deepmedia.tools.deployer") version "0.8.0"
} The plugin uses an older version of itself to publish itself to the Maven Central repository and to GitHub Packages. This means that you can check the plugin source code to see an example of how to use it. It also uses itself to publish snapshots to UsagePlugin configuration happens through the deployer {
defaultSpec {
release.version.set("1.0.0")
}
sonatypeSpec {
// release.version is 1.0.0
...
}
sonatypeSpec("snapshot") {
release.version.set("1.0.0-SNAPSHOT") // override default value
...
}
} For each spec, the plugin will register a gradle task named
Deploy contentsThe contents of a deploy spec (e.g. AARs, JARs, additional artifacts like sources or javadocs) can be configured at Component inferenceBy default, the plugin will try to infer the spec components based on the project structure and plugins. We currently support the following use cases:
Custom componentsTo declare custom components, simply add them to
deployer {
defaultSpec.content {
component {
fromSoftwareComponent("mySoftwareComponent")
}
component {
// cloning the publication makes sure that it can be shared across multiple specs.
fromMavenPublication("myMavenPublication", clone = true)
}
}
} Spec configurationIn addition to its contents, the Project infoUse the // Inside a spec...
projectInfo {
// Project name. Defaults to rootProject.name
name.set("MavenDeployer")
// Project description. Defaults to rootProject.name
description.set("Handy tool to publish maven packages in different repositories.")
// Project url
url.set("https://github.com/deepmedia/MavenDeployer")
// Package group id. Defaults to project's group
groupId.set("io.deepmedia.tools")
// Package artifact. Defaults to project's archivesName or project.name
artifactId.set("deployer")
// Project SCM information. Defaults to project.url
scm {
// or: fromGithub("deepmedia", "MavenDeployer")
// or: fromBitbucket("deepmedia", "MavenDeployer")
// or: set url, connection and developerConnection directly
}
// Licenses. Apache 2.0 and MIT are built-in
license(apache2)
license(MIT)
license("MyLicense", "mylicense.com")
// Developers
developer("natario1", "mattia@deepmedia.io")
} Release detailsUse the // Inside a spec...
release {
// Release version. Defaults to project.version, or AGP configured version for Android projects
release.version.set("1.0.0")
// Release VCS tag. Defaults to "v${release.version}"
release.tag.set("v0.1.4")
// Release description. Defaults to "${project.name} {release.tag}"
release.description.set("Brand new release")
// Release packaging. Automatically set to AAR for Android libraries
project.packaging = "jar"
} Signing configurationUse the // Inside a spec...
signing {
key.set(secret("SIGNING_KEY"))
password.set(secret("SIGNING_PASSWORD"))
} The signing key and password are considered secrets. This means that you will not pass the actual value to the deployer, but rather a lookup string. This lookup string can be:
The resolved key and password are then passed to the Supported repositoriesDifferent types or repositories offer differ APIs to configure them, which is often mandatory. These options are
exposed through subclasses of the Local repositoriesAdd a new spec with deployer {
localSpec {
directory.set(file("my/dir/here"))
}
// If needed, you can add other named specs.
localSpec("other") { ... }
} If the directory is not set, this defaults to the Sonatype / Nexus / Maven Central repositoriesAdd a new spec with Sonatype repositories make many fields mandatory:
Deployment will fail with clear errors notifying you about what's missing. deployer {
// Common configuration...
project.description.set("Handy tool to publish maven packages in different repositories.")
sonatypeSpec {
// Sonatype configuration...
repositoryUrl.set(ossrh1)
// Credentials used to register the package group into the OSSRH repository...
auth.user.set(secret("SONATYPE_USER"))
auth.password.set(secret("SONATYPE_PASSWORD"))
// Signing is required
signing.key.set(secret("SIGNING_KEY"))
signing.password.set(secret("SIGNING_PASSWORD"))
}
// If needed, you can add other named specs.
sonatypeSpec("snapshot") {
repositoryUrl.set(ossrhSnapshots1)
release.version.set("latest-SNAPSHOT")
...
}
} Github Packages repositoriesAdd a new spec with In addition to this, it is also mandatory to authenticate to GitHub using your username and a
personal access token.
These can be added as secrets to the deployer {
// Common configuration...
project.description.set("Handy tool to publish maven packages in different repositories.")
githubSpec {
// Identify the GitHub repository: deepmedia/MavenDeployer
owner.set("deepmedia")
repository.set("MavenDeployer")
// Personal GitHub username and a personal access token linked to it
auth.user.set(secret("GITHUB_USER"))
auth.token.set(secret("GITHUB_TOKEN"))
}
// If needed, you can add other named specs.
githubSpec("private") {
...
}
} |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论