Skip to content

Commit

Permalink
Add maven central publishing data
Browse files Browse the repository at this point in the history
  • Loading branch information
shyamz-22 committed Dec 16, 2017
1 parent f4fee62 commit ba46fac
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 1 deletion.
18 changes: 17 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ setGroup("io.github.shyamz-22")

jar {
baseName = 'conditional'
version = '0.0.1-SNAPSHOT'
version = VERSION_NAME
}


Expand All @@ -42,3 +42,19 @@ task wrapper(type: Wrapper) {
bootRepackage {
enabled = false
}

task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}

task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}

artifacts {
archives javadocJar, sourcesJar
}

apply from: 'publishToMaven.gradle'
18 changes: 18 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
VERSION_NAME=0.0.1-SNAPSHOT
ARTIFACT_ID=conditional
GROUP=io.github.shyamz-22

POM_NAME=Conditional On Profiles
POM_PACKAGING=jar
POM_DESCRIPTION=Create a Spring Bean only if All profiles are active.
POM_URL=https://github.com/shyamz-22/conditional-profiles.git
POM_SCM_URL=https://github.com/shyamz-22/conditional-profiles.git
POM_SCM_CONNECTION=git@github.com:shyamz-22/conditional-profiles.git
POM_SCM_DEV_CONNECTION=git@github.com:shyamz-22/conditional-profiles.git
POM_LICENCE_NAME=MIT License
POM_LICENCE_URL=https://github.com/shyamz-22/conditional-profiles/blob/master/LICENSE
POM_DEVELOPER_ID=shyamz-22
POM_DEVELOPER_NAME=Syamala Umamaheswaran

RELEASE_REPOSITORY_URL=https://oss.sonatype.org/service/local/staging/deploy/maven2
SNAPSHOT_REPOSITORY_URL=https://oss.sonatype.org/content/repositories/snapshots
57 changes: 57 additions & 0 deletions publishToMaven.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
apply plugin: 'maven'
apply plugin: 'signing'

ext.isReleaseVersion = !version.endsWith("SNAPSHOT")

signing {
required { isReleaseVersion && gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}

uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}

snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}

pom.groupId = GROUP
pom.artifactId = ARTIFACT_ID
pom.version = VERSION_NAME

pom.project {
name POM_NAME
packaging POM_PACKAGING
// optionally artifactId can be defined here
description POM_DESCRIPTION
url POM_URL

scm {
connection POM_SCM_CONNECTION
developerConnection POM_SCM_DEV_CONNECTION
url POM_SCM_URL
}

licenses {
license {
name POM_LICENCE_NAME
url POM_LICENCE_URL
}
}

developers {
developer {
id POM_DEVELOPER_ID
name POM_DEVELOPER_NAME
}
}
}
}
}
}

0 comments on commit ba46fac

Please sign in to comment.