完全禁用 ml-gradle 中的 REST 端点创建 for MarkLogic



我一直在努力从MarkLogic实例构建配置文件,以便通过ml-gradle进行部署。 我想在 8003 处完全禁用 REST 端点。我使用的是 ml-gradle 版本 2.7.0。 我能够使用 gradle mlExportResources 收集我的大部分配置。

在我的 gradle.properties 中,我添加了

mlNoRestServer=true

我的build.gradle文件是

plugins {
  id "com.marklogic.ml-gradle" version "2.7.0"
  id "net.saliman.properties" version "1.4.6"
}
ext {
    mlAppConfig {
        modulesDatabaseName = "my-modules"
        contentDatabaseName = "my-documents"
        createTriggersDatabase = false
    }
    // Here's an example of not creating a REST API server at all - just remove the command
    mlAppDeployer.getCommands().remove(mlAppDeployer.getCommand("DeployRestApiServersCommand"))
}

在到达 REST 阶段之前,部署看起来正常。 即使给定配置,它仍然引用端口 8003。

13:03:10.226 [INFO] [org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor] Initializing ExecutorService 
13:03:10.227 [INFO] [com.marklogic.client.modulesloader.impl.DefaultModulesLoader] Writing REST server configuration
13:03:10.227 [INFO] [com.marklogic.client.modulesloader.impl.DefaultModulesLoader] Default document read transform: null
13:03:10.227 [INFO] [com.marklogic.client.modulesloader.impl.DefaultModulesLoader] Transform all documents on read: false
13:03:10.228 [INFO] [com.marklogic.client.modulesloader.impl.DefaultModulesLoader] Validate query options: true
13:03:10.228 [INFO] [com.marklogic.client.modulesloader.impl.DefaultModulesLoader] Validate queries: true
13:03:10.228 [INFO] [com.marklogic.client.modulesloader.impl.DefaultModulesLoader] Output debugging: false
13:03:10.228 [INFO] [com.marklogic.client.impl.ServerConfigurationManagerImpl] Writing server configuration
13:03:10.229 [DEBUG] [com.marklogic.client.impl.JerseyServices] Putting config/properties/null
13:03:10.229 [DEBUG] [org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager] Get connection: {}->http://localhost:8003, timeout = 0
13:03:10.230 [DEBUG] [org.apache.http.impl.conn.tsccm.ConnPoolByRoute] [{}->http://localhost:8003] total kept alive: 0, total issued: 0, total allocated: 0 out of 200
13:03:10.230 [DEBUG] [org.apache.http.impl.conn.tsccm.ConnPoolByRoute] No free connections [{}->http://localhost:8003][null]
13:03:10.230 [DEBUG] [org.apache.http.impl.conn.tsccm.ConnPoolByRoute] Available capacity: 100 out of 100 [{}->http://localhost:8003][null]
13:03:10.231 [DEBUG] [org.apache.http.impl.conn.tsccm.ConnPoolByRoute] Creating new connection [{}->http://localhost:8003]
13:03:10.232 [DEBUG] [org.apache.http.impl.conn.DefaultClientConnectionOperator] Connecting to localhost:8003
13:03:10.233 [DEBUG] [org.apache.http.impl.conn.DefaultClientConnection] Connection org.apache.http.impl.conn.DefaultClientConnection@9770e0c closed
13:03:10.233 [DEBUG] [org.apache.http.impl.conn.DefaultClientConnection] Connection org.apache.http.impl.conn.DefaultClientConnection@9770e0c shut down
13:03:10.233 [DEBUG] [org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager] Released connection is not reusable.
13:03:10.233 [DEBUG] [org.apache.http.impl.conn.tsccm.ConnPoolByRoute] Releasing connection [{}->http://localhost:8003][null]
13:03:10.233 [DEBUG] [org.apache.http.impl.conn.DefaultClientConnection] Connection org.apache.http.impl.conn.DefaultClientConnection@9770e0c closed
13:03:10.233 [DEBUG] [org.apache.http.impl.conn.tsccm.ConnPoolByRoute] Notifying no-one, there are no waiting threads
13:03:10.233 [INFO] [com.marklogic.client.impl.DatabaseClientImpl] Releasing connection
13:03:10.233 [DEBUG] [com.marklogic.client.impl.JerseyServices] Releasing connection
13:03:10.233 [DEBUG] [org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter] Removed task artifact state for {} from context.
13:03:10.233 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':mlDeployApp'
13:03:10.233 [LIFECYCLE] [class org.gradle.internal.buildevents.TaskExecutionLogger] :mlDeployApp FAILED
13:03:10.234 [INFO] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] :mlDeployApp (Thread[Daemon worker Thread 11,5,main]) completed. Took 3 mins 12.831 secs.
13:03:10.234 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationWorkerRegistry] Worker root.3 completed (0 in use)
13:03:10.234 [DEBUG] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] Task worker [Thread[Daemon worker Thread 11,5,main]] finished, busy: 3 mins 12.835 secs, idle: 0.002 secs
13:03:10.235 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
13:03:10.235 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception.

缺少什么配置才能不在端口 8003 上部署 REST 服务器?

从 2.7.0 开始,您现在可以在 gradle.properties 中设置 mlNoRestServer=true 以禁用 REST 服务器创建 - https://github.com/marklogic-community/ml-gradle/wiki/Property-reference

上面的错误是由于以下行造成的:

13:

03:10.228 [INFO] [com.marklogic.client.impl.ServerConfigurationManagerImpl] 编写服务器配置13:03:10.229 [调试] [com.marklogic.client.impl.JerseyServices] 放置配置/属性/null

你有 src/main/ml-modules/rest.properties 文件吗?如果是这样,ml-gradle 看到它并认为 - 我需要将其发送到/v1/config/properties 以更新 REST API 服务器,但它不存在,并且会导致错误。我的猜测是该文件存在;尝试删除它并再次运行 mlDeploy。