1+ plugins {
2+ id ' signing'
3+ id(' io.github.gradle-nexus.publish-plugin' ) version ' 1.1.0'
4+ id ' maven-publish'
5+ }
6+
17apply plugin : ' java'
28apply plugin : ' maven'
39
@@ -14,6 +20,10 @@ allprojects {
1420sourceCompatibility = 1.6
1521targetCompatibility = 1.6
1622
23+ // load version number from file
24+ def config = new ConfigSlurper (). parse(new File (" ${ projectDir} /src/main/resources/version.properties" ). toURI(). toURL())
25+ version = config. versionNumber
26+
1727dependencies {
1828 compile ' org.jetbrains:annotations:13.0'
1929 testCompile ' junit:junit:4.12'
@@ -22,49 +32,78 @@ dependencies {
2232}
2333
2434task sourcesJar (type : Jar , dependsOn : classes) {
25- classifier = ' sources'
35+ archiveClassifier . set( ' sources' )
2636 from sourceSets. main. allSource
2737}
2838
2939task javadocJar (type : Jar , dependsOn : javadoc) {
30- classifier = ' javadoc'
40+ archiveClassifier . set( ' javadoc' )
3141 from javadoc. destinationDir
3242}
3343
34- task createPom {
35- doLast {
36- pom {
37- project {
38- groupId ' io.tus.java.client'
39- artifactId ' tus-java-client'
40- name ' tus-java-client'
41- version project. getProperties(). get(' pomVersion' )
42- packaging ' pom'
43- description ' Java client for tus, the resumable file uploading protocol.'
44- url ' http://tus.io'
45-
46- scm {
47- url ' https://github.com/tus/tus-java-client'
48- connection ' https://github.com/tus/tus-java-client'
49- developerConnection ' https://github.com/tus/tus-java-client'
50- }
51-
52- developers {
53- developer {
54- id ' acconut'
55- name ' Marius Kleidl'
56- email ' maerious@gmail.com'
57- }
58- }
59-
60- inceptionYear ' 2015'
61- licenses {
62- license {
63- name ' The MIT License (MIT)'
64- url ' http://opensource.org/licenses/MIT'
65- }
66- }
44+ artifacts {
45+ archives sourcesJar, javadocJar
46+ }
47+
48+
49+ def pomConfig = {
50+ name ' tus-java-client'
51+ url ' https://tus.io'
52+
53+ scm {
54+ url ' https://github.com/tus/tus-java-client'
55+ connection ' https://github.com/tus/tus-java-client'
56+ developerConnection ' https://github.com/tus/tus-java-client'
57+ }
58+
59+ developers {
60+ developer {
61+ id ' acconut'
62+ name ' Marius Kleidl'
63+ email ' maerious@gmail.com'
64+ }
65+ }
66+
67+ inceptionYear ' 2015'
68+ licenses {
69+ license {
70+ name ' The MIT License (MIT)'
71+ url ' http://opensource.org/licenses/MIT'
72+ }
73+ }
74+ }
75+
76+ publishing {
77+ publications {
78+ mavenJava(MavenPublication ) {
79+ groupId = ' io.tus.java.client'
80+ artifactId = ' tus-java-client'
81+ version
82+ artifact sourcesJar
83+ artifact javadocJar
84+
85+ pom. withXml {
86+ def root = asNode()
87+ root. appendNode(' description' , ' Java client for tus, the resumable file uploading protocol.' )
88+ root. children(). last() + pomConfig
6789 }
68- }. writeTo(" build/libs/pom.xml" )
90+ }
91+ }
92+ }
93+
94+ signing {
95+ def signingKeyId = System . getenv(" SIGNING_KEY_ID" )
96+ def signingPassword = System . getenv(" SIGNING_KEY_PASSWORD" )
97+ def signingKey = System . getenv(" SIGNING_KEY_AMORED" )
98+ useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
99+ sign publishing. publications. mavenJava
100+ }
101+
102+ nexusPublishing {
103+ repositories {
104+ sonatype {
105+ username = System . getenv(" SONATYPE_USER" )
106+ password = System . getenv(" SONATYPE_KEY" )
107+ }
69108 }
70109}
0 commit comments