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
25 changes: 25 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
This directory contains example ml-gradle projects to demonstrate various features and common
deployment scenarios.

To try a particular project, clone this repository, `cd` to the directory of the project you wish to try,
and do the following:

1. Most of the projects default to a username and password of "admin". You can change this either by modifying the
`mlPassword` property in the `gradle.properties` file in the project, or - if the project is using the [Gradle
properties plugin](https://plugins.gradle.org/plugin/net.saliman.properties) - you can create the file
`gradle-local.properties` and set both `mlUsername` and `mlPassword` in that file.
2. If the project has any ports defined in `gradle.properties`, verify that those ports are open and available on the
machine that is running MarkLogic.
3. Most projects have the [Gradle wrapper](https://docs.gradle.org/current/userguide/gradle_wrapper.html) setup, in
which case you can deploy the project to your MarkLogic instance via `./gradlew -i mlDeploy`. If the project does
not have the Gradle wrapper (you can tell by checking for a "gradlew" file in the project directory), then you'll
need to have [Gradle installed](https://gradle.org/install/). After installing Gradle, you can run `./gradle -i
mldeploy`.

After you've deployed and examined/tested the application, you can undeploy it via:

./gradlew -i -Pconfirm=true mlUndeploy

Please note that these example projects are not re-tested with every ml-gradle release. If you run into a problem with
any of them, please file an [issue with ml-gradle](https://github.com/marklogic-community/ml-gradle/wiki).

2 changes: 1 addition & 1 deletion examples/corb2-project/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ buildscript {
}

plugins {
id "com.marklogic.ml-gradle" version "4.1.0"
id "com.marklogic.ml-gradle" version "4.4.0"
}

repositories {
Expand Down
2 changes: 1 addition & 1 deletion examples/custom-rest-rewriter-project/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "com.marklogic.ml-gradle" version "3.9.0"
id "com.marklogic.ml-gradle" version "4.4.0"
}

task generateCustomRewriterModules {
Expand Down
12 changes: 6 additions & 6 deletions examples/data-services/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ plugins {
id "java"
id "net.saliman.properties" version "1.5.1"
id "com.marklogic.ml-gradle" version "4.4.0"
id 'com.marklogic.ml-development-tools' version '5.5.0'
id 'com.marklogic.ml-development-tools' version '6.0.0'
}

task generateHelloWorld(type: com.marklogic.client.tools.gradle.EndpointProxiesGenTask) {
Expand All @@ -20,12 +20,12 @@ test {

dependencies {
implementation 'org.slf4j:slf4j-api:1.7.31'
implementation 'com.marklogic:marklogic-client-api:5.5.0'
implementation 'com.marklogic:marklogic-client-api:6.0.0'

testImplementation "org.junit.jupiter:junit-jupiter:5.7.2"
testImplementation "org.junit.jupiter:junit-jupiter:5.9.1"

// Force usage of logback for logging
testImplementation "ch.qos.logback:logback-classic:1.2.4"
testImplementation "org.slf4j:jcl-over-slf4j:1.7.31"
testImplementation "org.slf4j:slf4j-api:1.7.31"
testImplementation "ch.qos.logback:logback-classic:1.3.5"
testImplementation "org.slf4j:jcl-over-slf4j:1.7.36"
testImplementation "org.slf4j:slf4j-api:1.7.36"
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ buildscript {
}

plugins {
id 'net.saliman.properties' version '1.4.6'
id 'net.saliman.properties' version '1.5.1'
}

apply plugin: "com.marklogic.ml-data-hub"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

plugins {
id "net.saliman.properties" version "1.5.1"
id "com.marklogic.ml-gradle" version "4.2.0"
id "com.marklogic.ml-gradle" version "4.4.0"
}

//apply plugin: "com.marklogic.ml-gradle"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ buildscript {
} else {
println "Using online buildscript dependency repositories"
mavenCentral()
maven { url "http://developer.marklogic.com/maven2/" }
}
}
}
Expand All @@ -26,7 +25,6 @@ repositories {
} else {
println "Using online dependency repositories"
mavenCentral()
maven { url "http://developer.marklogic.com/maven2/" }
}
}

Expand All @@ -35,9 +33,6 @@ configurations {
}

dependencies {
// sample java compile dependency. Remove if not required
compile 'com.marklogic:marklogic-xcc:10.0.7'

//sample mlcp dependency. Remove if not required
mlcp "com.marklogic:mlcp:10.0.6.2"
}
Expand All @@ -60,9 +55,8 @@ task downloadToProjectMavenRepo(type: Copy) {
/*
* Include any configuration dependencies here that you want to copy the dependencies for.
* These are defined in the 'dependencies' block. E.g. you need to include
* configurations.compile.files if you want your java 'compile' dependencies downloaded
* configurations.implementation.files if you want your java 'implementation' dependencies downloaded
*/
configurations.compile.files //includes 'java' compile dependencies. Remove if not needed
configurations.mlcp.files //includes 'mlcp' dependencies. Remove if not needed

from new File(gradle.gradleUserHomeDir, 'caches/modules-2/files-2.1') // correct as of gradle 4.7
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
mlUsername=admin
mlPassword=admin

projectMavenRepo=build/offline/maven-repo
# if you change this, you need to modify gradlew and gradlew.bat also
projectGradleHome=build/gradle-home
projectGradleHome=build/gradle-home
2 changes: 1 addition & 1 deletion examples/disconnected-project/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mlGradleDependency=com.marklogic:ml-gradle:3.6.0
mlGradleDependency=com.marklogic:ml-gradle:4.4.0
mlSalimanDependency=net.saliman:gradle-properties-plugin:1.4.6

mlHost=localhost
Expand Down
8 changes: 4 additions & 4 deletions examples/docker-projects/single-node-with-nifi/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
// gradle -PenvironmentName=x ...
id 'net.saliman.properties' version '1.4.6'
id "com.marklogic.ml-gradle" version "3.8.2"
id 'net.saliman.properties' version '1.5.1'
id "com.marklogic.ml-gradle" version "4.4.0"
id 'com.avast.gradle.docker-compose' version "0.6.11"
}
dockerCompose {
Expand All @@ -12,7 +12,7 @@ task mlDockerSetupNode(dependsOn:composeUp) {
doLast {
sleep(5 * 1000) //ensure node is up
exec {
commandLine 'docker', 'exec', 'node1.single', 'init-marklogic'
commandLine 'docker', 'exec', 'node1.single', 'init-marklogic'
}
}
}
Expand All @@ -30,4 +30,4 @@ task mlDockerStop(type:Exec) {
task mlDockerTeardown(dependsOn:composeDown) {
//remove logs directory
delete 'logs'
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
mlAppName=sample-single-node-app

mlRestPort=8003
mlUsername=admin
mlPassword=admin
mlRestPort=8003
8 changes: 4 additions & 4 deletions examples/docker-projects/single-node/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
// gradle -PenvironmentName=x ...
id 'net.saliman.properties' version '1.4.6'
id "com.marklogic.ml-gradle" version "3.8.2"
id 'net.saliman.properties' version '1.5.1'
id "com.marklogic.ml-gradle" version "4.4.0"
id 'com.avast.gradle.docker-compose' version "0.6.11"
}
dockerCompose {
Expand All @@ -12,7 +12,7 @@ task mlDockerSetupNode(dependsOn:composeUp) {
doLast {
sleep(5 * 1000) //ensure node is up
exec {
commandLine 'docker', 'exec', 'node1.single', 'init-marklogic'
commandLine 'docker', 'exec', 'node1.single', 'init-marklogic'
}
}
}
Expand All @@ -30,4 +30,4 @@ task mlDockerStop(type:Exec) {
task mlDockerTeardown(type: Delete, dependsOn:composeDown) {
//remove logs directory
delete 'logs'
}
}
5 changes: 3 additions & 2 deletions examples/docker-projects/single-node/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
mlAppName=sample-single-node-app

mlRestPort=8003
mlUsername=admin
mlPassword=admin
mlRestPort=8003
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
plugins {
// gradle -PenvironmentName=x ...
id 'net.saliman.properties' version '1.4.6'
id "com.marklogic.ml-gradle" version "3.8.2"
id 'net.saliman.properties' version '1.5.1'
id "com.marklogic.ml-gradle" version "4.4.0"
id 'com.avast.gradle.docker-compose' version "0.6.11"
}
dockerCompose {
Expand Down Expand Up @@ -37,4 +36,4 @@ task mlDockerStop(type:Exec) {
task mlDockerTeardown(dependsOn:composeDown) {
//remove logs directory
delete 'logs'
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
mlAppName=sample-cluster-app
mlUsername=admin
mlPassword=admin

mlRestPort=8003

# mapped ports for node1
mlManagePort=18002
mlAdminPort=18001
mlAppServicesPort=18000
mlAppServicesPort=18000
2 changes: 1 addition & 1 deletion examples/entity-services-project/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
plugins {
id "com.marklogic.ml-gradle" version "3.6.0"
id "com.marklogic.ml-gradle" version "4.4.0"
}
4 changes: 2 additions & 2 deletions examples/external-security/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
plugins {
id "com.marklogic.ml-gradle" version "3.6.0"
}
id "com.marklogic.ml-gradle" version "4.4.0"
}
2 changes: 1 addition & 1 deletion examples/failover-project/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
plugins {
id "com.marklogic.ml-gradle" version "3.6.0"
id "com.marklogic.ml-gradle" version "4.4.0"
}
2 changes: 1 addition & 1 deletion examples/flexrep-project/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/

plugins {
id "com.marklogic.ml-gradle" version "3.6.0"
id "com.marklogic.ml-gradle" version "4.4.0"
}

ext {
Expand Down
2 changes: 1 addition & 1 deletion examples/flexrep-with-path-project/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {
mavenLocal()
}
dependencies {
classpath "com.marklogic:ml-gradle:3.6.0"
classpath "com.marklogic:ml-gradle:4.4.0"
}
}

Expand Down
2 changes: 1 addition & 1 deletion examples/httpbuilder-project/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
}

plugins {
id "com.marklogic.ml-gradle" version "3.6.0"
id "com.marklogic.ml-gradle" version "4.4.0"
}

/*
Expand Down
2 changes: 1 addition & 1 deletion examples/ignore-resources-project/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "com.marklogic.ml-gradle" version "3.6.0"
id "com.marklogic.ml-gradle" version "4.4.0"
}

ext {
Expand Down
5 changes: 4 additions & 1 deletion examples/ignore-resources-project/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
mlUsername=admin
mlPassword=admin

# Specify multiple filenames by delimiting them with commas, e.g. role-2.json,user-1.xml.
# Remember that these filenames are ignored by all commands, so be careful if you have different resources with the
# same filename (should be rare and easily avoided).
mlResourceFilenamesToIgnore=role-2.json
mlResourceFilenamesToIgnore=role-2.json
6 changes: 3 additions & 3 deletions examples/jdbc-project/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "com.marklogic.ml-gradle" version "3.6.0"
id "com.marklogic.ml-gradle" version "4.4.0"
id "java"
}

Expand All @@ -8,14 +8,14 @@ repositories {
}

dependencies {
compile "org.springframework:spring-jdbc:5.0.1.RELEASE"
implementation "org.springframework:spring-jdbc:5.0.1.RELEASE"

/**
* 42.1.4 is the latest version that works.
* Any query using 42.2.0 results in an error of "The server's DateStyle parameter was changed to ISO. The
* JDBC driver requires DateStyle to begin with ISO for correct operation."
*/
runtime "org.postgresql:postgresql:42.1.4"
implementation "org.postgresql:postgresql:42.1.4"
}

task selectFromSysTables(type: JavaExec) {
Expand Down
3 changes: 3 additions & 0 deletions examples/jsdoc-project/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
platform=win
bitMode=64
extension=zip

mlUsername=admin
mlPassword=admin
2 changes: 1 addition & 1 deletion examples/maven-project/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
plugins {
id "com.marklogic.ml-gradle" version "3.6.0"
id "com.marklogic.ml-gradle" version "4.4.0"
}
2 changes: 1 addition & 1 deletion examples/mimetypes-project/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
plugins {
id "com.marklogic.ml-gradle" version "3.6.0"
id "com.marklogic.ml-gradle" version "4.4.0"
}
2 changes: 2 additions & 0 deletions examples/mimetypes-project/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
mlUsername=admin
mlPassword=admin
2 changes: 1 addition & 1 deletion examples/minimal-project/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
*/

plugins {
id "com.marklogic.ml-gradle" version "3.6.0"
id "com.marklogic.ml-gradle" version "4.4.0"
}
2 changes: 2 additions & 0 deletions examples/minimal-project/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
mlUsername=admin
mlPassword=admin
6 changes: 5 additions & 1 deletion examples/no-appservers-project/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
This project shows an example of modifying mlDeploy so that no REST API server is created by default.
This project shows an example of deploying an app without ml-gradle creating a REST API server by default via the
following property:

mlNoRestServer=true

21 changes: 1 addition & 20 deletions examples/no-appservers-project/build.gradle
Original file line number Diff line number Diff line change
@@ -1,22 +1,3 @@
plugins {
id "com.marklogic.ml-gradle" version "3.6.0"
}

ext {
/**
* ml-gradle's Gradle plugin class - MarkLogicPlugin - populates the mlAppDeployer instance with a set of
* commands. You are free to manipulate the list of commands as you see it. This is an example of removing
* the command for deploying a REST API server, which will result in mlDeploy not creating a REST API server
* by default.
*/
mlAppDeployer.getCommands().remove(mlAppDeployer.getCommand("DeployRestApiServersCommand"))

/**
* If you don't want a default REST API server, odds are you don't want the other thing that mlDeploy will create
* by default, which is a triggers database. There's not yet a Gradle property for this, so we have to manipulate the
* mlAppConfig instance directly.
*/
mlAppConfig {
createTriggersDatabase = false
}
id "com.marklogic.ml-gradle" version "4.4.0"
}
3 changes: 3 additions & 0 deletions examples/no-appservers-project/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
mlUsername=admin
mlPassword=admin
mlNoRestServer=true
2 changes: 1 addition & 1 deletion examples/partition-project/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mlGradleVersion=3.17.0
mlGradleVersion=4.4.0

mlHost=localhost
mlAppName=partition-example
Expand Down
Loading