我正在创建gradle构建作为新的gradle用户,但我过去曾与maven合作。
我正在尝试重现maven发布插件的操作:
如您所见,我正在使用:
我正试图用这两个插件实现我的目标:
命令行: gradle release
Maven Publish Plugin部署到Nexus:
命令行: gradle发布
我是如何创建一个版本并一次性将其自动部署到Nexus的?
以下是我的 build.gradle :
plugins {
id 'net.researchgate.release' version '2.3.4'
}
apply plugin: 'maven-publish'
/*------------------------
----- PUBLISH PLUGIN -----
--------------------------
https://docs.gradle.org/current/userguide/publishing_maven.html
--------------------------*/
publishing {
publications {
maven(MavenPublication) {
groupId mavenGroup
artifactId mavenArtifact
version version
from components.java
}
}
repositories {
maven {
if(project.version.endsWith('-SNAPSHOT')) {
url "${nexusUrl}/content/repositories/repo-snapshots"
} else {
url "${nexusUrl}/content/repositories/repo-releases"
}
credentials {
username nexusUsername
password nexusPassword
}
}
}
}
/*------------------------
----- RELEASE PLUGIN -----
--------------------------
https://github.com/researchgate/gradle-release
--------------------------*/
release {
failOnCommitNeeded = false
failOnUnversionedFiles = false
scmAdapters = [
net.researchgate.release.SvnAdapter
]
}