Skip to content

Commit

Permalink
Merge pull request #21 from csync/maven-publish
Browse files Browse the repository at this point in the history
Maven publish
  • Loading branch information
Narine C committed Apr 28, 2017
2 parents 2bf9e05 + ee0232f commit f25a5fe
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 16 deletions.
25 changes: 13 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,19 @@ The ACL for a key is set when the key is created by the first write performed to
# Getting Started

Adding the java SDK to your java project:

1. Build the csync-java SDK either in an IDE or from the command line using the command `gradle build`. This will generate the CSync .jar file in your `build/libs` directory.
2. From your java project, navigate to `File -> Project Structure` as shown in the screenshot below:

<img src="images/projectStructure.png" width="300">

3. Click on `Libraries`
4. Click the `+` sign and select `Java`
5. Navigate to the directory that contains the jar file for CSync.

Note: if you are using a gradle project, add the CSync SDK as a dependency in your `build.gradle` file like this:
`compile files('/Users/narinecholakyan/Documents/csync-java/build/libs/csync-1.0-SNAPSHOT.jar')`

Maven:
```
<dependency>
<groupId>com.ibm.csync</groupId>
<artifactId>csync-java</artifactId>
<version>1.4.0</version>
</dependency>
```
Gradle:
```
compile 'com.ibm.csync:csync-java:1.4.0'
```

#Usage

Expand Down
51 changes: 47 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
plugins {
id "com.jfrog.bintray" version "1.7.3"
}

def mavenVersion='1.4.0'
group 'com.ibm'
version '1.0-SNAPSHOT'
version "${mavenVersion}"

apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'maven-publish'

mainClassName = "Main"

sourceCompatibility = 1.8

repositories {
mavenCentral()
jcenter()
}


compileJava {
options.compilerArgs << "-Xlint:all" << "-Werror"
}
Expand All @@ -23,14 +31,49 @@ dependencies {
compile group: 'com.squareup.okhttp3', name: 'okhttp-ws', version: '3.4.2'
compile group: 'com.google.guava', name: 'guava', version: '20.0'
compile group: 'com.h2database', name: 'h2', version: '1.4.193'
//compile group: 'com.github.davidmoten', name: 'rxjava-jdbc', version: '0.7.3'
//compile group: 'com.appunite', name : 'websockets-rxjava', version : '4.0.1'
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.0'
testCompile group: 'junit', name: 'junit', version: '4.11'
}

publishing {
repositories {
maven{
url "github.com/csync/csync-java"
}
}
publications {
mavenJava(MavenPublication) {
from components.java
artifact sourcesJar
groupId 'com.ibm.csync'
artifactId 'csync-java'
version "${mavenVersion}"
}
}
}

bintray {
user = System.getenv('BINTRAY_USER')
key = System.getenv('BINTRAY_KEY')
publications = ['mavenJava']
pkg {
version {
name = "${mavenVersion}"
}
repo = 'maven'
name = 'csync-java'
licenses = ['Apache-2.0']
vcsUrl = 'https://github.com/csync/csync-java.git'
}
}

jar {
from {
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
}
}
}

task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}

0 comments on commit f25a5fe

Please sign in to comment.