简体   繁体   English

通过 gradle 运行 mlcp 并得到原因:java.io.IOException:CreateProcess 错误 = 206,文件名或扩展名太长

[英]running mlcp through gradle and getting Caused by: java.io.IOException: CreateProcess error=206, The filename or extension is too long

I am running a gradle task我正在运行 gradle 任务

gradlew -b import.gradle copy_taskName -PinputHost="Host1" -PoutputHost="Host2" -Pduration=1 --stacktrace

In import.gradle, there is a mlcp task, where we are passing a taskName.json(where all the query are written in json format to fetch the data from input host) in query_filter field.在 import.gradle 中,有一个 mlcp 任务,我们在query_filter字段中传递一个 taskName.json(其中所有查询都以 json 格式编写,以从输入主机获取数据)。

While running the task, I am getting:在运行任务时,我得到:

Caused by: java.io.IOException: Cannot run program "C:\Program Files\Java\jdk1.8.0_211\bin\java.exe" (in directory "D:\Data1"): CreateProcess error=206, The filename or extension is too long at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:25)... 5 more Caused by: java.io.IOException: CreateProcess error=206, The filename or extension is too long... 6 more原因:java.io.IOException:无法运行程序“C:\Program Files\Java\jdk1.8.0_211\bin\java.exe”(在目录“D:\Data1”中):CreateProcess error=206,文件or extension is too long at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:25)... 5 more Caused by: java.io.IOException: CreateProcess error=206, The filename or extension is too long ... 6 更多

When I removed some query from taskName.json, I am not getting any issue.当我从 taskName.json 中删除一些查询时,我没有遇到任何问题。 I want to know, are there any constraints over size or number of queries written in taskName.json that we should have to pass in query_filter parameter to run the mlcp task?我想知道,在 taskName.json 中写入的查询的大小或数量是否有任何限制,我们应该传入query_filter参数来运行 mlcp 任务?

total no of line of query content in taskName.json is 398 taskName.json中查询内容的总行数为398

taskName.json file content sample taskName.json 文件内容示例

{
    "andQuery": {
        "queries": [{
            "collectionQuery": {
                "uris": ["collection1"]
            }
        },
        {
            "orQuery": {
                "queries": [
                {
                    "elementValueQuery": {
                        "element": ["{http://namespace.com/a/b}id"],
                        "text": ["text1"],
                        "options": ["lang=en"]
                    }
                },
                {
                    "elementValueQuery": {
                        "element": ["{http://namespace.com/a/b}id"],
                        "text": ["text2"],
                        "options": ["lang=en"]
                    }
                }]
            }
        },
        {
            "notQuery": {
                "query": {
                    "elementRangeQuery": {
                        "element": ["{http://namespace.com/a/b}date"],
                        "operator": ">",
                        "value": [{
                            "type": "dateTime",
                            "val": "%%now%%"
                        }]
                    }
                }
            }
        }]
    }
}

import.gradle进口.gradle

def importDirs =  new File("./teams").listFiles()

importDirs.each { importDir ->
    def queries = importDir.listFiles()
    queries.each { file ->
        def taskname = importDir.name + "_" +file.name.replace('.json', '')        
        task "copy_$taskname" (
                    type: com.marklogic.gradle.task.MlcpTask,
                    group: 'abc',
                    dependsOn: []) {            
                classpath = configurations.mlcp
                command = 'COPY'
                input_database = mlAppConfig.contentDatabaseName
                input_host = inputHost
                input_port = port
                input_username = inputUsername
                input_password = inputPassword
                output_database = mlAppConfig.contentDatabaseName
                output_host = outputHost
                output_port = port
                output_username = outputUsername
                output_password = outputPassword
                query_filter = file.text.replaceAll('"','\\\\"').replaceAll('%%now%%', now).replaceAll('%%targetDate%%', targetDate)
                max_split_size = 500                   
        }
    }
}

MlcpTask is extending Gradle's JavaExec task, and the error is coming from the net.rubygrapefruit.platform.internal.DefaultProcessLauncher class. MlcpTask 正在扩展 Gradle 的 JavaExec 任务,错误来自 net.rubygrapefruit.platform.internal.DefaultProcessLauncher class。 So my hunch is that since the contents of task.json is being tossed into the command line arguments, some limit within the JavaExec class is being reached.所以我的预感是,由于 task.json 的内容被扔进命令行 arguments,JavaExec class 中的一些限制已经达到。 You could try extending JavaExec instead to confirm this - I am thinking you'd run into the same error.您可以尝试扩展 JavaExec 来确认这一点 - 我认为您会遇到同样的错误。

One possible solution would be to use the MLCP options_file option.一种可能的解决方案是使用 MLCP options_file 选项。 Since you're parameterizing the contents of task.json, you'd likely need to generate the contents of that file dynamically, presumably in a doFirst block on each Gradle task.由于您正在参数化 task.json 的内容,因此您可能需要动态生成该文件的内容,大概在每个 Gradle 任务的 doFirst 块中。 But that will avoid very long command line arguments, as you'll instead toss them into options_file - and you may only need to toss query_filter in there.但这将避免非常长的命令行 arguments,因为您会将它们扔到 options_file 中 - 您可能只需要将 query_filter 扔在那里。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 gradle 5 - windows java.io.IOException: CreateProcess error=206, 文件名太长 - gradle 5 - windows java.io.IOException: CreateProcess error=206, filename is too long CreateProcess error=206,运行gwtCompile时文件名或扩展名太长 - CreateProcess error=206, The filename or extension is too long when running gwtCompile java.io.IOException: 文件名或扩展名太长 Grails 4.0.8 - java.io.IOException : The filename or extension is too long Grails 4.0.8 构建gradle失败:无法识别路径JDK,CreateProcess错误= 206,文件名或扩展名太长 - Build gradle failed: can not identify path JDK, CreateProcess error=206, The filename or extension is too long JavaC CreateProcess错误= 206,文件名或扩展名太长 - JavaC CreateProcess error=206, The filename or extension is too long 无法运行程序 CreateProcess 错误=206,文件名或扩展名太长 - Cannot run program CreateProcess error=206, The filename or extension is too long CreateProcess error=206, 运行 main() 方法时文件名或扩展名太长 - CreateProcess error=206, The filename or extension is too long when running main() method Windows 10-在eclipse(Oxygen版本)中,createProcess错误= 206,文件名或扩展名过长 - Windows 10- In eclipse (Oxygen version), createProcess error=206, The filename or extension is too long inappmessaging-display:17.0.0'CreateProcess错误= 206,文件名或扩展名太长 - inappmessaging-display:17.0.0' CreateProcess error=206, The filename or extension is too long 执行proguard-maven-plugin时,出现“CreateProcess error=206, The filename or extension is too long” - When executing proguard-maven-plugin, "CreateProcess error=206, The filename or extension is too long" occurs
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM