Skip to content

Commit

Permalink
Added mavenJava publication and oss repo for publishing to maven central
Browse files Browse the repository at this point in the history
Added signing plugin for signing sourcesJar and javadocJar
Removed bintray and jfrog tasks
  • Loading branch information
JelleKuebler-IfV committed May 3, 2021
1 parent 75213e0 commit 6c45340
Showing 1 changed file with 54 additions and 36 deletions.
90 changes: 54 additions & 36 deletions mobitopp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ plugins {
id "com.jfrog.bintray" version "1.8.5"
id "com.jfrog.artifactory" version "4.15.2"
id "maven-publish"
id 'signing'
}

configurations {
Expand Down Expand Up @@ -101,9 +102,48 @@ publishing {
def snapshotVersion = project.version.replaceAll("\\.${buildNumber}", '') + '-SNAPSHOT'
version snapshotVersion
}
mavenJava(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar
groupId project.group
artifactId project.name
version project.version
pom {
name = 'mobiTopp'
description = 'mobiTopp (http://mobitopp.ifv.kit.edu/) is an agent-based travel demand model developed at the Institute for transport studies at the Karlsruhe Institute of Technology (http://www.ifv.kit.edu/english/index.php). Publications about mobiTopp can be found on the project site (http://mobitopp.ifv.kit.edu/28.php).'
url = 'https://github.com/kit-ifv/mobitopp'
licenses {
license {
name = 'GNU GENERAL PUBLIC LICENSE, Version 3'
url = 'https://www.gnu.org/licenses/gpl-3.0-standalone.html'
}
}
developers {
developer {
id = 'lb'
name = 'Lars Briem'
email = '[email protected]'
}
developer {
id = 'jk'
name = 'Jelle Kuebler'
email = '[email protected]'
}
}
scm {
connection = 'scm:git:git:https://github.com/kit-ifv/mobitopp.git'
developerConnection = 'scm:git:ssh:[email protected]:kit-ifv/mobitopp.git'
url = 'https://github.com/kit-ifv/mobitopp'
}
}

}

}
repositories {
maven {
name = 'Internal'
credentials {
username getPropertyOrDefault('repositoryUsername')
password getPropertyOrDefault('repositoryPassword')
Expand All @@ -113,48 +153,26 @@ publishing {
def snapshotsRepoUrl = "${repositoryUrl}/repository/maven-snapshots"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
}
}
}
maven {
name = 'External'
credentials {
username getPropertyOrDefault('user_oss')
password getPropertyOrDefault('pw_oss')
}

def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
}

artifactory {
contextUrl = 'http://oss.jfrog.org'
publish {
repository {
repoKey = 'oss-snapshot-local'
username = project.hasProperty('user') ? project.property('user') : 'user'
password = project.hasProperty('key') ? project.property('key') : 'key'
}
defaults {
publications('snapshot')
publishArtifacts = true
publishPom = true
}
}
resolve {
repoKey = 'jcenter'
}
def buildnumber = project.hasProperty('build.number') ? project.property('build.number') : ''
clientConfig.info.setBuildNumber(buildnumber)
}

bintray {
user = project.hasProperty('user') ? project.property('user') : 'user'
key = project.hasProperty('key')? project.property('key') : 'key'
publications = ['release']
pkg {
repo = 'ifv-mobitopp'
name = project.name
userOrg = 'ifv-mobitopp'
licenses = ['GPL-3.0']
vcsUrl = 'https://github.com/ifv-mobitopp/mobitopp'
version {
name = project.version
description = project.version
released = new Date()
}
}
signing {
sign publishing.publications.mavenJava
}


def getPropertyOrDefault(key) {
return project.hasProperty(key) ? project.property(key) : key
}

0 comments on commit 6c45340

Please sign in to comment.