I have a Gradle project which uses Spring\'s dependency management plugin to define a list of dependency versions. I am also using the Maven plugin to deploy the project to
You could have a build.gradle
such as:
apply plugin: 'maven-publish'
apply plugin: 'signing'
publishing {
repositories {
maven {
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username ossrhUsername
password ossrhPassword
}
}
}
publications {
maven(MavenPublication) {
groupId = 'com.example.id'
artifactId = 'my-artifact-id'
version = '1.0.0'
pom.withXml {
asNode().children().last() + {
resolveStrategy = Closure.DELEGATE_FIRST
name 'My Lib Name'
description 'My Lib Description'
url 'https://example.com/id/lib'
licenses {
license {
name 'The Apache License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
scm {
connection 'scm:git:git@example.com:acdcjunior/lib/id.git'
developerConnection 'scm:git:git@example.com:acdcjunior/lib/id.git'
url 'git@example.lib/id.git'
}
developers {
developer {
id 'someone'
name 'Someone Name'
email 'someone@example.com'
}
}
dependencies {
dependency {
groupId 'com.example.other'
artifactId 'some-dependency'
version '1.0.0'
}
dependency {
groupId 'org.apache.commons'
artifactId 'commons-lang3'
version '3.9'
}
}
}
}
}
}
}
signing {
sign publishing.publications.maven
}
Example of a project using this: https://github.com/acdcjunior/domain-id/blob/master/domain-id-all/build.gradle