@@ -8,10 +8,10 @@ buildscript {
88
99apply plugin : ' java'
1010apply plugin : ' maven'
11+ apply plugin : ' signing'
1112
1213repositories {
1314 mavenCentral()
14- maven { url ' https://commondatastorage.googleapis.com/maven-repository/' }
1515}
1616
1717configurations {
@@ -30,69 +30,83 @@ dependencies {
3030 testCompile ' com.google.truth:truth:0.25'
3131}
3232
33- def baseVersionName = " 1.1.4"
34- if (project. hasProperty(" versionSuffix" )) {
35- project. ext. versionSuffix = project. versionSuffix
36- } else {
37- project. ext. versionSuffix = " snapshot"
33+ task javadocJar (type : Jar ) {
34+ classifier = ' javadoc'
35+ from javadoc
3836}
39- if (project. ext. versionSuffix) {
40- version = " ${ baseVersionName} -${ project.versionSuffix} "
41- } else {
42- version = " ${ baseVersionName} "
37+
38+ task sourcesJar (type : Jar ) {
39+ classifier = ' sources'
40+ from sourceSets. main. allSource
41+ }
42+
43+ artifacts {
44+ archives javadocJar, sourcesJar
4345}
44- archivesBaseName = " websockets"
46+
47+ signing {
48+ required { gradle. taskGraph. hasTask(" uploadArchives" ) }
49+ sign configurations. archives
50+ }
51+
4552group = " com.appunite"
53+ archivesBaseName = " websockets-java"
54+ version = " 2.0.0"
4655
47- task createPomFile {
48- project. ext. pomFile = pom {
49- version = project . version
50- artifactId = project. archivesBaseName
51- groupId = project. group
52- project {
53- name ' AUWebSocket '
54- description ' Android socketio/websocket library. '
55- url ' https://github.com/jacek-marchwicki/AndroidSocketIO '
56- inceptionYear ' 2012 '
57-
58- licenses {
59- license {
60- name ' The Apache Software License, Version 2.0 '
61- url ' http://www.apache.org/licenses/LICENSE-2.0.txt '
62- distribution ' repo '
63- }
56+ if ( ! project . hasProperty( " ossrhUsername " )) {
57+ project. ext. setProperty( " ossrhUsername " , null )
58+ }
59+ if ( ! project. hasProperty( " ossrhPassword " )) {
60+ project. ext . setProperty( " ossrhPassword " , null )
61+ }
62+
63+ uploadArchives {
64+ repositories {
65+ mavenDeployer {
66+ beforeDeployment { MavenDeployment deployment -> signing . signPom(deployment) }
67+
68+ repository( url : " https://oss.sonatype.org/service/local/staging/deploy/maven2/ " ) {
69+ authentication(
70+ userName : project . ext . getProperty( " ossrhUsername " ),
71+ password : project . ext . getProperty( " ossrhPassword " )
72+ )
6473 }
6574
66- scm {
67- url " https://github.com/jacek-marchwicki/AndroidSocketIO"
68- connection " https://github.com/jacek-marchwicki/AndroidSocketIO.git"
75+ snapshotRepository(url : " https://oss.sonatype.org/content/repositories/snapshots/" ) {
76+ authentication(
77+ userName : project. ext. getProperty(" ossrhUsername" ),
78+ password : project. ext. getProperty(" ossrhPassword" )
79+ )
6980 }
70- developers {
71- developer {
72- name ' Jacek Marchwicki <jacek.marchwicki@gmail.com>'
81+
82+ pom. project {
83+ name ' JavaWebsocketClient'
84+ packaging ' jar'
85+ // optionally artifactId can be defined here
86+ description ' JavaWebsocketClient is simple library for Websocket connection for java and Android. It is designed to be fast and fault tolerant.'
87+ url ' https://github.com/jacek-marchwicki/JavaWebsocketClient'
88+
89+ scm {
90+ connection ' scm:git:https://github.com/jacek-marchwicki/JavaWebsocketClient.git'
91+ developerConnection ' scm:git:https://github.com/jacek-marchwicki/JavaWebsocketClient.git'
92+ url ' https://github.com/jacek-marchwicki/JavaWebsocketClient.git'
7393 }
74- }
75- }
76- }
77- }
7894
79- Properties props = new Properties ()
80- def credentialsProperties = file(" credentials.properties" )
81- if (credentialsProperties. exists()) {
82- props. load(new FileInputStream (credentialsProperties))
83- }
95+ licenses {
96+ license {
97+ name ' The Apache License, Version 2.0'
98+ url ' http://www.apache.org/licenses/LICENSE-2.0.txt'
99+ }
100+ }
84101
85- uploadArchives {
86- description = " Upload archives to maven repository"
87- dependsOn createPomFile
88- repositories. mavenDeployer {
89- configuration = configurations. deployerJars
90- repository(url : " gs://maven-repository" ) {
91- authentication(
92- userName : " ${ props.getProperty('mavenUser', null)} " ,
93- password : " ${ props.getProperty('mavenPassword', null)} " )
102+ developers {
103+ developer {
104+ id ' jacek'
105+ name ' Jacek Marchwicki'
106+ email ' jacek.marchwicki@gmail.com'
107+ }
108+ }
109+ }
94110 }
95- pom = project. ext. pomFile
96111 }
97112}
98-
0 commit comments