# gradle-maven-publish-plugin
Gradle plugin that creates an `uploadArchives` task to automatically upload all of your Java, Kotlin or Android libraries to any Maven instance. This plugin is based on [Chris Banes initial implementation](https://github.com/chrisbanes/gradle-mvn-push) and has been enhanced to add Kotlin support and keep up with the latest changes.
# Set up
**module/build.gradle**
```groovy
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.8.0'
}
}
apply plugin: "com.vanniktech.maven.publish"
```
Information: [This plugin is also available on Gradle plugins](https://plugins.gradle.org/plugin/com.vanniktech.maven.publish)
### Snapshots
Can be found [here](https://oss.sonatype.org/#nexus-search;quick~gradle-maven-publish-plugin). Current one is:
```groovy
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.9.0-SNAPSHOT'
```
## Configuration
Those are all the available configurations - shown with default values and their types. More information can be found in the [Documentation of the Extension](src/main/kotlin/com/vanniktech/maven/publish/MavenPublishPluginExtension.kt).
```groovy
mavenPublish {
targets {
uploadArchives {
releaseRepositoryUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
snapshotRepositoryUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
repositoryUsername = null // This defaults to either the SONATYPE_NEXUS_USERNAME Gradle property or the system environment variable.
repositoryPassword = null // This defaults to either the SONATYPE_NEXUS_PASSWORD Gradle property or the system environment variable.
}
}
}
```
Once you've configured this and defined the typical pom attributes via Gradle properties you can upload your library using the `uploadArchives` task.
If you need to upload to multiple repositories you can also add additional targets.
```groovy
mavenPublish {
targets {
uploadArchives {
// Configure as above.
}
internalRepo {
// Configure as above.
}
betaRepo {
// Configure as above.
}
}
}
```
This will create `uploadArchivesInternalRepo` and `uploadArchivesBetaRepo` tasks.
__Note:__ To prevent looping behavior, especially in Kotlin projects / modules, you need to run the `uploadArchives` task with `--no-daemon`and `--no-parallel` flags:
`./gradlew uploadArchives --no-daemon --no-parallel`
__Note:__ Other than the common maven plugin you must do the [release steps at sonatype](https://central.sonatype.org/pages/releasing-the-deployment.html) manually.
# Sample
This Gradle plugin is using itself to publish any of the updates. It applies a previously released version in the build.gradle just as mentioned above and sets the Gradle properties in this [gradle.properties](gradle.properties).
# License
Copyright (C) 2018 Vanniktech - Niklas Baudy
Licensed under the Apache License, Version 2.0
没有合适的资源?快使用搜索试试~ 我知道了~
gradle-maven-publish-plugin,gradle插件,配置一个uploadarchives任务,自动将所有j...
共32个文件
kt:12个
java:3个
md:2个
需积分: 37 12 下载量 134 浏览量
2019-10-11
04:20:18
上传
评论
收藏 99KB ZIP 举报
温馨提示
Gradle插件,创建一个UploadArchives任务,自动将所有Java、Kotlin或Android库上载到任何Maven实例。这个插件基于chris-banes的初始实现,并且已经被增强以添加kotlin支持并跟上最新的更改。
资源推荐
资源详情
资源评论
收起资源包目录
gradle-maven-publish-plugin.zip (32个子文件)
gradle-maven-publish-plugin-master
.gitignore 206B
build.gradle 3KB
src
integrationTest
kotlin
com
vanniktech
maven
publish
MavenPublishPluginIntegrationTest.kt 5KB
fixtures
passing_java_library_with_groovy_project
src
main
java
com
vanniktech
maven
publish
test
TestClass.java 320B
groovy
com
vanniktech
maven
publish
test
TestClass.groovy 304B
passing_java_library_project
src
main
java
com
vanniktech
maven
publish
test
TestClass.java 320B
passing_java_project
src
main
java
com
vanniktech
maven
publish
test
TestClass.java 320B
main
kotlin
com
vanniktech
maven
publish
Utils.kt 531B
MavenPublishPom.kt 2KB
MavenPublishTarget.kt 1KB
Configurer.kt 326B
MavenPublishConfigurer.kt 4KB
MavenPublishPluginExtension.kt 2KB
UploadArchivesConfigurer.kt 3KB
BaseMavenPublishPlugin.kt 2KB
groovy
com
vanniktech
maven
publish
MavenPublishPlugin.groovy 6KB
test
kotlin
com
vanniktech
maven
publish
MavenPublishPluginExtensionTest.kt 3KB
MavenPublishTargetTest.kt 719B
MavenPublishPluginTest.kt 4KB
.travis.yml 2KB
.buildscript
deploy_snapshot.sh 1KB
gradlew 6KB
LICENSE 11KB
CHANGELOG.md 5KB
code_quality_tools
detekt.yml 345B
README.md 3KB
gradlew.bat 3KB
gradle.properties 859B
gradle
wrapper
gradle-wrapper.properties 202B
gradle-wrapper.jar 54KB
integration-test.gradle 680B
.editorconfig 26B
共 32 条
- 1
资源评论
weixin_38744207
- 粉丝: 343
- 资源: 2万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功