Skip to content

Commit a575928

Browse files
committed
Setup publishing to OSS artifactory
1 parent 59784f2 commit a575928

File tree

4 files changed

+46
-19
lines changed

4 files changed

+46
-19
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.gradle
22
.idea
33
build
4+
.env

circle.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ dependencies:
2727
- ~/.gradle
2828
test:
2929
override:
30-
- ./gradlew clean build jacocoTestReport
30+
- ./gradlew clean build jacocoTestReport artifactoryPublish
3131
- bash <(curl -s https://codecov.io/bash)

springfox-grails/build.gradle

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016 the original author or authors.
2+
* Copyright 2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -13,21 +13,24 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
1716
buildscript {
1817
repositories {
18+
maven {
19+
url "https://plugins.gradle.org/m2/"
20+
}
1921
jcenter()
2022
mavenCentral()
2123
}
22-
dependencies {
23-
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
24-
}
24+
25+
}
26+
27+
plugins {
28+
id "com.jfrog.bintray" version "1.7.3"
29+
id "com.jfrog.artifactory" version "4.4.13"
2530
}
2631

2732
apply plugin: 'groovy'
2833
apply plugin: 'idea'
29-
apply plugin: 'maven-publish'
30-
apply plugin: 'com.jfrog.bintray'
3134
apply plugin: 'jacoco'
3235
apply from: 'gradle/publishing.gradle'
3336

springfox-grails/gradle/publishing.gradle

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
1+
apply plugin: 'maven-publish'
2+
apply plugin: 'com.jfrog.bintray'
3+
14
import java.text.SimpleDateFormat
25

36
Date buildTimeAndDate = new Date()
7+
48
ext {
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-
1517
bintray {
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

Comments
 (0)