1+ apply plugin : ' maven-publish'
2+ apply plugin : ' com.jfrog.bintray'
3+
14import java.text.SimpleDateFormat
25
36Date buildTimeAndDate = new Date ()
7+
48ext {
59 buildDate = new SimpleDateFormat (' yyyy-MM-dd' ). format(buildTimeAndDate)
610 buildTime = new SimpleDateFormat (' HH:mm:ss.SSSZ' ). format(buildTimeAndDate)
11+ bintrayUsername = project. hasProperty(' bintrayUsername' ) ? project. bintrayUsername : System . getenv(' BINTRAY_USER' )
12+ bintrayApiKey = project. hasProperty(' bintrayApiKey' ) ? project. bintrayApiKey : System . getenv(' BINTRAY_API_KEY' )
13+ ossUser = project. hasProperty(' ossUser' ) ? project. ossUser : System . getenv(' OSS_USER' )
14+ ossPassword = project. hasProperty(' ossPassword' ) ? project. ossPassword : System . getenv(' OSS_PASSWORD' )
715}
816
9- if (! project. hasProperty(' bintrayUsername' )) ext. bintrayUsername = ' '
10- if (! project. hasProperty(' bintrayApiKey' )) ext. bintrayApiKey = ' '
11- if (! project. hasProperty(' gpgPassphrase' )) ext. gpgPassphrase = ' '
12- if (! project. hasProperty(' ossUser' )) ext. ossUser = ' '
13- if (! project. hasProperty(' ossPassword' )) ext. ossPassword = ' '
14-
1517bintray {
1618 user = project. bintrayUsername
1719 key = project. bintrayApiKey
@@ -32,12 +34,8 @@ bintray {
3234
3335 version {
3436 vcsTag = project. version
35- gpg {
36- sign = false // Determines whether to GPG sign the files. The default is false
37- passphrase = project. gpgPassphrase // Optional. The passphrase for GPG signing'
38- }
3937 mavenCentralSync {
40- sync = false // Optional (true by default). Determines whether to sync the version to Maven Central.
38+ sync = true // Optional (true by default). Determines whether to sync the version to Maven Central.
4139 user = ossUser // OSS user token
4240 password = ossPassword // OSS user password
4341 }
@@ -85,3 +83,28 @@ publishing {
8583 }
8684 }
8785}
86+
87+ artifactory {
88+ contextUrl = ' https://oss.jfrog.org'
89+ resolve {
90+ repository {
91+ repoKey = ' libs-release'
92+ }
93+ }
94+ publish {
95+ repository {
96+ repoKey = ' oss-snapshot-local' // The Artifactory repository key to publish to
97+ // when using oss.jfrog.org the credentials are from Bintray. For local build we expect them to be found in
98+ // ~/.gradle/gradle.properties, otherwise to be set in the build server
99+ username = bintrayUsername
100+ password = bintrayApiKey
101+ }
102+ defaults {
103+ publications(' mavenJava' )
104+ }
105+ }
106+ }
107+
108+ tasks. artifactoryPublish {
109+ dependsOn ' check'
110+ }
0 commit comments