我正在尝试使用sbt将一个干净的组装步骤启动到jenkinsfile中。我使用以下步骤:
sh "${tool name: 'sbt-0.13.13', type: 'org.jvnet.hudson.plugins.SbtPluginBuilder$SbtInstallation'}/bin/sbt clean assembly -J-Dhttps.proxyHost=my-http-proxy -J-Dhttps.proxyPort=8080 -Xmx1g -Xms2g "
但是似乎由于Xms参数不起作用,即使我在上面的命令中给了Xms参数也没有覆盖。输出如下:
[Pipeline] tool
[Pipeline] sh
[workspace] Running shell script
+ /var/lib/jenkins/tools/org.jvnet.hudson.plugins.SbtPluginBuilder_SbtInstallation/sbt-0.13.13/bin/sbt clean assembly -J-Dhttps.proxyHost=egress-http-proxy -J-Dhttps.proxyPort=8080 -J-Xmx1g -J-Xms2g
Picked up JAVA_TOOL_OPTIONS: -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -Dsun.zip.disableMemoryMapping=true
Invalid initial heap size: -Xms7g-
Dorg.csanchez.jenkins.plugins.kubernetes.pipeline.PodTemplateStepExecution.defaultImage=172.30.37.22:5000/openpaas/jenkins-slave-jnlp:release
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
您知道为什么不使用我的论点还是有解决方案?谢谢
答案 0 :(得分:0)
实际上上述代码的问题来自错误的格式行:
-Xms7g-Dorg.csanchez.jenkins.plugins.kubernetes.pipeline.PodTemplateStepExecution.defaultImage=172.30.37.22:5000/openpaas/jenkins-slave-jnlp:release
缺少-Xms7g和-Dorg.csanchez之间的空格。 要传递参数,您想使用以下命令,并在参数-J之前加上前缀:
sh "${tool name: 'sbt-0.13.13', type: 'org.jvnet.hudson.plugins.SbtPluginBuilder$SbtInstallation'}/bin/sbt clean assembly -J-Dhttps.proxyHost=my-http-proxy -J-Dhttps.proxyPort=8080 -J-Xmx1g -J-Xms2g "