Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,23 @@ public static void main (String [] args) throws CouchbaseLiteException, Interrup
// end::getting-started[]

// tag::getting-startedGradle[]

plugins {
id 'java'
id 'application'
}

// Comment out the below line if no source code is Kotlin
kotlinOptions { jvmTarget = '1.8' }

// Set minimum JVM level to ensure availability of, for example, lambda expressions
compileOptions
{
targetCompatibility 1.8
sourceCompatibility 1.8

// Declare repositories
repositories {
// Add your Maven/Ivy/file repository here.
jcenter()
Expand Down Expand Up @@ -170,20 +182,31 @@ implementation fileTree(include: ['*.jar'], dir: libs>
id 'java'
id 'application'
}
allprojects {
repositories {
google()
jcenter()
maven {
url "https://mobile.maven.couchbase.com/maven2/dev/"
}

// Comment out the below line if no source code is Kotlin
kotlinOptions { jvmTarget = '1.8' }

// Set minimum JVM level to ensure availability of, for example, lambda expressions
compileOptions
{
targetCompatibility 1.8
sourceCompatibility 1.8

repositories {
maven {
url "https://mobile.maven.couchbase.com/maven2/dev/"
}
google()
jcenter()
}


dependencies {
// Use for Enterprise version
// Comment out below line if using Enterprise version
implementation "com.couchbase.lite:couchbase-lite-java:2.7.0"
// Comment out below line if using Community version
implementation "com.couchbase.lite:couchbase-lite-java-ee:2.7.0"
// Use for community versions
// implementation "com.couchbase.lite:couchbase-lite-java:2.7.0"
}

application {
Expand Down
54 changes: 54 additions & 0 deletions modules/ROOT/pages/_partials/gsBuildGradleAndroid.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// tag::allContent[]

// Define the main class for the application.
application {mainClassName = 'gettingstarted.GettingStarted'}

plugins {
id 'java'
id 'application'
// ... other section content as required by user
}


// tag::compileOptions[]
android {
// Required only if your project has some Kotlin source code
kotlinOptions { jvmTarget = '1.8' }

// Set minimum JVM level to ensure availability of, for example, lambda expressions
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8

// ... other section content as required by user
}
// end::compileOptions[]

// tag::dependencies[]
dependencies {
implementation "com.couchbase.lite:couchbase-lite-android-ee:${version}"

// ... other section content as required by user
}
// end::dependencies[]

// tag::repositories[]
repositories {
maven { url 'https://mobile.maven.couchbase.com/maven2/dev/' }
google()
jcenter()

// ... other section content as required by user
}
// end::repositories[]

// end::allContent[]

// tag::dependenciesCE[]
dependencies {
implementation "com.couchbase.lite:couchbase-lite-android:${version}"

// ... other section content as required by user
}
// end::dependenciesCE[]
50 changes: 50 additions & 0 deletions modules/ROOT/pages/_partials/gsBuildGradleJava.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@

:packageNm: couchbase-lite-java
// tag::allContent[]

// Define the main class for the application.
application {mainClassName = 'gettingstarted.GettingStarted'}

plugins {
id 'java'
id 'application'
}

// tag::compileOptions[]
// Required only if your project has some Kotlin source code
kotlinOptions { jvmTarget = '1.8' }

// Set minimum JVM level to ensure availability of, for example, lambda expressions
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8

// ... other section content as required by user
// end::compileOptions[]

// tag::dependencies[]
dependencies {
implementation "com.couchbase.lite:couchbase-lite-java-ee:${version}"

// ... other section content as required by user
}
// end::dependencies[]

// tag::repositories[]
repositories {
maven {url 'https://mobile.maven.couchbase.com/maven2/dev/'}

// ... other section content as required by user
}
// end::repositories[]

// end::allContent[]

// tag::dependenciesCE[]
dependencies {
implementation "com.couchbase.lite:couchbase-lite-java:${version}"

// ... other section content as required by user
}
// end::dependenciesCE[]
61 changes: 36 additions & 25 deletions modules/ROOT/pages/java-android.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
:ziputils: {examplesdir}/java-android/app/src/main/java/com/couchbase/code_snippets/ZipUtils.java
:source-language: java
:version: 2.7.0
:packageNm: couchbase-lite-android
:blank-field: ____
:url-issues-java: https://github.com/couchbase/couchbase-lite-android/issues
:url-api-references: http://docs.couchbase.com/mobile/{version}/couchbase-lite-android
Expand All @@ -16,47 +17,57 @@ include::_attributesLocal.adoc[]

== Getting Started

Create or open an existing Android Studio project and install Couchbase Lite using the following method.

=== Android Studio
Make the following additions to the module-level `build.gradle` file (typically in the *app* folder).

Create or open an existing Android Studio project and install Couchbase Lite using the following method.

==== Couchbase Lite Community Edition
[{tabs}]
====
Community::
+
--
. Include the following in the `android {}` section:
+
[source,groovy]
----
include::partial$gsBuildGradleAndroid.adoc[tag=compileOptions]
----
. Include the following in the `dependencies{}` section:
+
[source,groovy]
----
include::partial$gsBuildGradleAndroid.adoc[tag=dependenciesCE]
----

* Add the following in the `dependencies` section of the application's *build.gradle* (the one in the *app* folder).
--
Enterprise::
+
[source,groovy,subs=attributes+]
--
. Include the following in the `android {}` section:
+
[source,groovy]
----
dependencies {
implementation 'com.couchbase.lite:couchbase-lite-android:{version}'
}
include::partial$gsBuildGradleAndroid.adoc[tag=compileOptions]
----

==== Couchbase Lite Enterprise Edition

* In the top-level *build.gradle* file, add the following Couchbase Maven repository in the `allprojects` section.
. Include the following in the `dependencies{}` section:
+
[source,groovy]
----
allprojects {
repositories {
google()
jcenter()
maven {
url "https://mobile.maven.couchbase.com/maven2/dev/"
}
}
}
include::partial$gsBuildGradleAndroid.adoc[tag=dependencies]
----

* Next, add the following in the `dependencies` section of the application's *build.gradle* (the one in the *app* folder).
+
[source,groovy,subs=attributes+]
. Include the following in the `repositories {}` section:
+
[source,groovy]
----
dependencies {
implementation 'com.couchbase.lite:couchbase-lite-android-ee:{version}'
}
include::partial$gsBuildGradleAndroid.adoc[tag=repositories]
----
--
====


=== Starter code

Expand Down
77 changes: 36 additions & 41 deletions modules/ROOT/pages/java-platform.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ include::partial$mobAttrCBL.adoc[]
:JP: Java
:Android: Java (android)
:cblJP: {product} {JP}
:packageNmCE: couchbase-lite-java-{version-full}
:packageNmEE: couchbase-lite-java-ee-{version-full}
:packageNm: couchbase-lite-java
:packageNmCE: {packageNm}-{version-full}
:packageNmEE: {packageNm}-ee-{version-full}
:url-api-references: http://docs.couchbase.com/mobile/{version-full}/couchbase-lite-java
:hdIndent:
:snippet: {snippet-java-jvm}
Expand Down Expand Up @@ -61,10 +62,8 @@ It assumes a familiarity with these products, however you are free to use your o

The contents of your `build.gradle` file will depend on the type of project you are building, whether you are using Community or Enterprise edition and whether you prefer to use Maven-distributed binaries or a zip download.


TIP: If you wish to use a downloaded zip instead of Maven then see - <<Using Downloaded Binaries>>


NOTE: If you are deploying to Linux, you will need the {cbl} `support` library, which is available _only_ on the zip download distributable -- see <<Additional Steps for Linux>>

anchor:bmkUsingMavenRepos[Using Maven repositories]
Expand All @@ -81,34 +80,42 @@ Console App Development::

. Create a project folder
. Initialize it for a Gradle Java application
. Create your `build.gradle` file, including the following repositories and dependencies:
. Include the following in the `build.gradle` file:

* For Community edition
Community edition::
+
[source,groovy,subs=attributes+]
Compile options
+
[source,groovy]
----
dependencies {
implementation 'com.couchbase.lite:couchbase-lite-java:2.7.0'
}
include::partial$gsBuildGradleJava.adoc[tag=compileOptions]
----

* For Enterprise Edition
Dependencies
+
[source,groovy]
----
include::partial$gsBuildGradleJava.adoc[tag=dependenciesCE]
----

Enterprise Edition::
+
Compile options
+
[source,groovy]
----
allprojects {
repositories {
google()
jcenter()
maven {
url "https://mobile.maven.couchbase.com/maven2/dev/"
}
}
}
dependencies {
implementation 'com.couchbase.lite:couchbase-lite-java-ee:2.7.0'
}
include::partial$gsBuildGradleJava.adoc[tag=compileOptions]
----
Dependencies
+
[source,groovy]
----
include::partial$gsBuildGradleJava.adoc[tag=dependencies]
----
Repositories
+
[source,groovy]
----
include::partial$gsBuildGradleJava.adoc[tag=repositories]
----

. Open the project folder in {gpIDE} and import the {gpBuildTool} settings.
Expand All @@ -127,9 +134,9 @@ That's it. You're all set to start building your own {cblJP} applications -- see

.Sample build.gradle content

[source,groovy,subs=attributes+]
[source,groovy]
----
include::{snippet}[tags=gsGradleMavenExample,indent=0]
include::partial$gsBuildGradleJava.adoc[tag=allContent]
----

--
Expand Down Expand Up @@ -182,28 +189,16 @@ gradle init
+
[source,groovy,subs=attributes+]
----
dependencies {
implementation 'com.couchbase.lite:couchbase-lite-java:2.7.0'
}
include::partial$gsBuildGradleJava.adoc[tag=dependenciesCE]
----

* For Enterprise Edition
+
[source,groovy]

----
allprojects {
repositories {
google()
jcenter()
maven {
url "https://mobile.maven.couchbase.com/maven2/dev/"
}
}
}
dependencies {
implementation 'com.couchbase.lite:couchbase-lite-java-ee:2.7.0'
}
include::partial$gsBuildGradleJava.adoc[tag=repositories]
include::partial$gsBuildGradleJava.adoc[tag=dependencies]
----

. Open the project folder in {gpIDE} and import the {gpBuildTool} settings.
Expand Down