Skip to content

Commit 966b6ca

Browse files
Merge pull request #8 from jacek-marchwicki/added-maven-central
Added maven central
2 parents ec0c508 + 2c4efdc commit 966b6ca

4 files changed

Lines changed: 162 additions & 57 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ proguard-project.txt
3939
#Gradle
4040
.gradle
4141
build
42+
gradle.properties
4243

4344
#Secrets
4445
credentials.properties

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,15 @@ Imperative example:
110110
```bash
111111
./gradlew :websockets-example:installDebug
112112
```
113+
114+
## How to add to your project
115+
116+
to your gradle file:
117+
118+
```groovy
119+
compile "com.appunite:websockets-java:2.0.0"
120+
compile "com.appunite:websockets-rxjava:2.0.0"
121+
```
113122
114123
## License
115124

websockets-rxjava/build.gradle

Lines changed: 84 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,101 @@ buildscript {
88
}
99

1010
apply plugin: 'java'
11+
apply plugin: 'maven'
12+
apply plugin: 'signing'
1113

1214
repositories {
1315
mavenCentral()
14-
maven { url 'https://commondatastorage.googleapis.com/maven-repository/' }
1516
}
1617

1718
dependencies {
1819
compile project(":websockets")
1920
compile "io.reactivex:rxjava:1.0.9"
2021
compile "com.google.code.gson:gson:2.3"
21-
//compile "com.appunite:websockets:1.0"
22+
//compile "com.appunite:websockets-java:2.0.0"
2223

2324
testCompile "org.hamcrest:hamcrest-all:1.3"
2425
testCompile 'junit:junit:4.11'
2526
testCompile 'org.mockito:mockito-all:1.9.5'
2627
testCompile 'com.google.truth:truth:0.25'
27-
}
28+
}
29+
30+
task javadocJar(type: Jar) {
31+
classifier = 'javadoc'
32+
from javadoc
33+
}
34+
35+
task sourcesJar(type: Jar) {
36+
classifier = 'sources'
37+
from sourceSets.main.allSource
38+
}
39+
40+
artifacts {
41+
archives javadocJar, sourcesJar
42+
}
43+
44+
signing {
45+
required { gradle.taskGraph.hasTask("uploadArchives") }
46+
sign configurations.archives
47+
}
48+
group = "com.appunite"
49+
archivesBaseName = "websockets-rxjava"
50+
version = "2.0.0"
51+
52+
if (!project.hasProperty("ossrhUsername")) {
53+
project.ext.setProperty("ossrhUsername", null)
54+
}
55+
if (!project.hasProperty("ossrhPassword")) {
56+
project.ext.setProperty("ossrhPassword", null)
57+
}
58+
59+
uploadArchives {
60+
repositories {
61+
mavenDeployer {
62+
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
63+
64+
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
65+
authentication(
66+
userName: project.ext.getProperty("ossrhUsername"),
67+
password: project.ext.getProperty("ossrhPassword")
68+
)
69+
}
70+
71+
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
72+
authentication(
73+
userName: project.ext.getProperty("ossrhUsername"),
74+
password: project.ext.getProperty("ossrhPassword")
75+
)
76+
}
77+
78+
pom.project {
79+
name 'RxJavaWebsocketClient'
80+
packaging 'jar'
81+
// optionally artifactId can be defined here
82+
description 'RxJavaWebsocketClient is simple library for Websocket connection for java and Android. It is designed to be fast and fault tolerant.'
83+
url 'https://github.com/jacek-marchwicki/JavaWebsocketClient'
84+
85+
scm {
86+
connection 'scm:git:https://github.com/jacek-marchwicki/JavaWebsocketClient.git'
87+
developerConnection 'scm:git:https://github.com/jacek-marchwicki/JavaWebsocketClient.git'
88+
url 'https://github.com/jacek-marchwicki/JavaWebsocketClient.git'
89+
}
90+
91+
licenses {
92+
license {
93+
name 'The Apache License, Version 2.0'
94+
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
95+
}
96+
}
97+
98+
developers {
99+
developer {
100+
id 'jacek'
101+
name 'Jacek Marchwicki'
102+
email 'jacek.marchwicki@gmail.com'
103+
}
104+
}
105+
}
106+
}
107+
}
108+
}

websockets/build.gradle

Lines changed: 68 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ buildscript {
88

99
apply plugin: 'java'
1010
apply plugin: 'maven'
11+
apply plugin: 'signing'
1112

1213
repositories {
1314
mavenCentral()
14-
maven { url 'https://commondatastorage.googleapis.com/maven-repository/' }
1515
}
1616

1717
configurations {
@@ -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+
4552
group = "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

Comments
 (0)