Skip to content

Commit f6168f0

Browse files
Dermot SmythDermot Smyth
authored andcommitted
Merge branch 'dev' of github.com:marklogic-community/ml-gradle into dev
# Conflicts: # examples/disconnected-project-using-plugins-and-gradlew/README.md
2 parents 426b140 + a2078e6 commit f6168f0

File tree

29 files changed

+522
-157
lines changed

29 files changed

+522
-157
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ First, [install Gradle](https://gradle.org/install/).
2424

2525
Then, in an empty directory, create a file named "build.gradle" with your favorite text editor and enter the following:
2626

27-
plugins { id "com.marklogic.ml-gradle" version "3.4.0" }
27+
plugins { id "com.marklogic.ml-gradle" version "3.6.1" }
2828

2929
Then run:
3030

31-
gradle mlNew
31+
gradle mlNewProject
3232

3333
This starts a project wizard to stub out files for your new application. You can accept all the defaults, but be sure to
3434
enter a valid port number for the "REST API port" question. ml-gradle will then print the following logging:

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ if (project.hasProperty("myBintrayUser")) {
7070
bintray {
7171
user = myBintrayUser
7272
key = myBintrayKey
73-
publications = ['mainJava', 'sourcesJava', 'mavenJavadoc']
73+
publications = ['mainJava', 'sourcesJava']
7474
pkg {
7575
repo = 'maven'
7676
name = project.name
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
build
2+
.gradle

examples/disconnected-project-using-plugins-and-gradlew/README.md

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,22 @@ Summary of the steps required. See sections below for more detailed steps
1212
```
1313
2. Copy zip (build/distributions/offline.zip) to desired location / server and unzip
1414

15-
3. Run disconnected tasks from unzip location
15+
3. Run disconnected tasks from unzip location
1616
```
1717
./gradlew mlDeploy -Pdisconnected=true
1818
```
1919

2020

2121
## Overview
2222

23-
An example of how to create a completely self-contained deployer zip that contains -
24-
1. All of the plugin / depencencies required to run the deployment (including ml-gradle)
25-
2. The gradle distribution
23+
An example of how to create a completely self-contained deployer zip that contains:
2624

27-
Once the zip has been created, you only need Java to run the deployment tasks
25+
1. All of the plugin / dependencies required to run the deployment (including ml-gradle)
26+
2. The Gradle distribution
2827

29-
This approach is useful when you need to create a package that does not require any external ressources (e.g. maven/gradle repositories) to perform deployment operations.
28+
Once the zip has been created, you only need Java to run the deployment tasks.
29+
30+
This approach is useful when you need to create a package that does not require any external resources (e.g. Maven/Gradle repositories) to perform deployment operations.
3031

3132
## Requirements
3233

@@ -36,18 +37,19 @@ This approach is useful when you need to create a package that does not require
3637

3738
## How it works
3839

39-
This project will -
40-
* Download all of the required dependencies (including plugins) into the 'build/offline/maven-repo' directory in the project.
41-
* Download the gradle binary distribution (zip) into the 'build/offline/gradle/wrapper' directory in the project
40+
This project will:
41+
42+
* Download all of the required dependencies (including plugins) into the 'build/offline/maven-repo' directory in the project
43+
* Download the Gradle binary distribution (zip) into the 'build/offline/gradle/wrapper' directory in the project
4244
* Create an offline.zip in build/distributions that contains
43-
* the gradle project itsself
44-
* all of the required depenencies
45-
* the gradle distribution that works with the gradlew executable
45+
* the Gradle project itself
46+
* all of the required dependencies
47+
* the Gradle distribution that works with the gradlew executable
4648

4749

4850
## Usage
4951

50-
*NOTE:* It is important to use the gradlew executable as it will download the gradle distribution that will be encorporated into the self-contained deployer zip
52+
*NOTE:* It is important to use the gradlew executable as it will download the Gradle distribution that will be incorporated into the self-contained deployer zip.
5153

5254
## 1. Create the self-contained deployer zip
5355

@@ -74,7 +76,7 @@ Copy the created offline.zip to the desired location and unzip
7476
unzip offline.zip
7577
```
7678

77-
## 3. Execute disconnected the gradle tasks
79+
## 3. Execute disconnected the Gradle tasks
7880

7981
From the directory that you have unzipped the offline.zip file into
8082

@@ -88,7 +90,7 @@ This will use the jars that you have already downloaded to 'build/offline/maven-
8890

8991
**IMPORTANT**: If you want to include dependencies for a configuration (e.g. compile, runtime, mlcp etc), then you need to modify the 'downloadToProjectMavenRepo' task to include the relevant configuration. E.g. by adding 'configurations.compile.files' to the beginning of the task, all of the dependencies for the 'compile' task will be downloaded.
9092

91-
E.g. (assuming you are using the java plugin), the configuration below will download all the compile and runtime dependencies that you have defined
93+
E.g. (assuming you are using the Java plugin), the configuration below will download all the compile and runtime dependencies that you have defined:
9294

9395
```
9496
task downloadToProjectMavenRepo(type: Copy) {
@@ -112,4 +114,4 @@ gradle -Dgradle.user.home=build/gradle-home makeOfflineZip
112114
4. Run disconnected tasks from unzip location
113115
```
114116
gradle mlDeploy -Pdisconnected=true
115-
```
117+
```

examples/disconnected-project-using-plugins-and-gradlew/build.gradle

Lines changed: 46 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,73 @@
11
plugins {
2-
id 'java' //optional - delete if not needed
3-
id 'net.saliman.properties' version '1.4.6'
4-
id 'com.marklogic.ml-gradle' version '3.7.1'
2+
id 'java' //optional - delete if not needed
3+
id 'net.saliman.properties' version '1.4.6'
4+
id 'com.marklogic.ml-gradle' version '3.7.1'
55
}
66

77
repositories {
8-
// To use gradle in disconnected mode, you just need to set the 'disconnected' property. E.g. gradle compileJava -Pdisconnected
9-
if ( project.hasProperty("disconnected") && !"FALSE".equalsIgnoreCase(disconnected)) {
10-
println "Using offline repositories"
11-
maven {url uri( projectMavenRepo ) }
12-
} else {
13-
println "Using online repositories"
14-
jcenter()
15-
maven { url "https://developer.marklogic.com/maven2/" }
16-
}
8+
// To use gradle in disconnected mode, you just need to set the 'disconnected' property. E.g. gradle compileJava -Pdisconnected
9+
if (project.hasProperty("disconnected") && !"FALSE".equalsIgnoreCase(disconnected)) {
10+
println "Using offline repositories"
11+
maven { url uri(projectMavenRepo) }
12+
} else {
13+
println "Using online repositories"
14+
jcenter()
15+
maven { url "https://developer.marklogic.com/maven2/" }
16+
}
1717
}
1818

1919
configurations {
2020
mlcp //example if you want to use mlcp. Delete otherwise
2121
}
2222

2323
dependencies {
24-
// sample java compile dependency. Remove if not required
25-
compile 'com.marklogic:marklogic-xcc:9.0.4'
24+
// sample java compile dependency. Remove if not required
25+
compile 'com.marklogic:marklogic-xcc:9.0.4'
2626

27-
//sample mlcp dependency. Remove if not required
28-
mlcp "com.marklogic:mlcp:9.0.5"
27+
//sample mlcp dependency. Remove if not required
28+
mlcp "com.marklogic:mlcp:9.0.5"
2929
}
3030

31-
32-
3331
/**
3432
* START: Disconnected gradle tasks
3533
*/
3634
gradle.taskGraph.whenReady { graph ->
37-
if (graph.hasTask(downloadToProjectMavenRepo)) {
38-
println project.gradle.gradleUserHomeDir
39-
if (!project.gradle.gradleUserHomeDir.equals(new File(rootDir,projectGradleHome))) {
40-
throw new GradleException("Please set the gradle user home property to $projectGradleHome on the gradle command line - e.g. \n " +
41-
(System.getProperty("os.name").startsWith("Windows") ? "" : "./") +
42-
"gradlew -Dgradle.user.home=$projectGradleHome <task_to_execute>")
43-
}
44-
}
35+
if (graph.hasTask(downloadToProjectMavenRepo)) {
36+
println project.gradle.gradleUserHomeDir
37+
if (!project.gradle.gradleUserHomeDir.equals(new File(rootDir, projectGradleHome))) {
38+
throw new GradleException("Please set the gradle user home property to $projectGradleHome on the gradle command line - e.g. \n " +
39+
(System.getProperty("os.name").startsWith("Windows") ? "" : "./") +
40+
"gradlew -Dgradle.user.home=$projectGradleHome <task_to_execute>")
41+
}
42+
}
4543
}
4644

4745
task downloadToProjectMavenRepo(type: Copy) {
48-
/*
49-
* Include any configuration dependencies here that you want to copy the dependencies for.
50-
* These are defined in the 'dependencies' block. E.g. you need to include
51-
* configurations.compile.files if you want your java 'compile' dependencies downloaded
52-
*/
53-
configurations.compile.files //includes 'java' compile dependencies. Remove if not needed
54-
configurations.mlcp.files //includes 'mlcp' dependencies. Remove if not needed
55-
56-
from new File(gradle.gradleUserHomeDir, 'caches/modules-2/files-2.1') // correct as of gradle 4.7
57-
into new File(rootDir, projectMavenRepo)
58-
eachFile {
59-
List<String> parts = it.path.split('/')
60-
it.path = (parts[0].replace('.','/') + '/' + parts[1]) + '/' + parts[2] + '/' + parts[4]
61-
}
62-
includeEmptyDirs false
46+
/*
47+
* Include any configuration dependencies here that you want to copy the dependencies for.
48+
* These are defined in the 'dependencies' block. E.g. you need to include
49+
* configurations.compile.files if you want your java 'compile' dependencies downloaded
50+
*/
51+
configurations.compile.files //includes 'java' compile dependencies. Remove if not needed
52+
configurations.mlcp.files //includes 'mlcp' dependencies. Remove if not needed
53+
54+
from new File(gradle.gradleUserHomeDir, 'caches/modules-2/files-2.1') // correct as of gradle 4.7
55+
into new File(rootDir, projectMavenRepo)
56+
eachFile {
57+
List<String> parts = it.path.split('/')
58+
it.path = (parts[0].replace('.', '/') + '/' + parts[1]) + '/' + parts[2] + '/' + parts[4]
59+
}
60+
includeEmptyDirs false
6361
}
6462

6563
task makeOfflineZip(type: Zip, dependsOn: downloadToProjectMavenRepo) {
66-
from rootDir
67-
excludes = ['.tmp','.gradle','build/gradle-home','build/distributions','build/offline/gradle/wrapper/dists']
68-
destinationDir(file('build/distributions'))
69-
archiveName = 'offline.zip'
70-
doLast {
71-
println "Created offline project zip at build/distributions/offline.zip"
72-
}
64+
from rootDir
65+
excludes = ['.tmp', '.gradle', 'build/gradle-home', 'build/distributions', 'build/offline/gradle/wrapper/dists']
66+
destinationDir(file('build/distributions'))
67+
archiveName = 'offline.zip'
68+
doLast {
69+
println "Created offline project zip at build/distributions/offline.zip"
70+
}
7371
}
7472

7573
/**
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
gradle-local.properties
2+
.gradle
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
This project shows how to configure an external security and use it in an application server.
2+
3+
If you want to deploy using a user with external security you'll need to configure the Admin, App-Services and Manage servers ahead of time.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
plugins {
2+
id "com.marklogic.ml-gradle" version "3.6.0"
3+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
mlHost=localhost
2+
mlAppName=external-security-example
3+
mlRestPort=8141
4+
mlUsername=admin
5+
mlPassword=admin
6+
7+
#leave blank if you do not want an External Security Configuration used for an application server
8+
cpExternalSecurity=example
9+
10+
#the below is needed if you want to deploy with an external user
11+
#basic is used in this example but kerberos-ticket could also be used
12+
mlRestAuthentication=basic
13+
mlAppServicesAuthentication=basic
14+
mlAdminAuthentication=basic
15+
mlManageAuthentication=basic
16+
17+
53.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)