代码更新后执行ant clean all导致SAP Commerce 2205构建失败求助
问题描述
环境信息
- 操作系统:Ubuntu
- SAP Commerce版本:2205
- Java版本:SAP Machine 17.0.5 LTS
现象
首次搭建环境执行ant clean all无报错,代码更新后再次执行该命令必构建失败,多次重装环境问题依旧。
配置日志
SAP Commerce 2205 openjdk version "17.0.5" 2022-10-18 LTS OpenJDK Runtime Environment SapMachine (build 17.0.5+8-LTS) OpenJDK 64-Bit Server VM SapMachine (build 17.0.5+8-LTS, mixed mode, sharing) [delete] Deleting directory /home/ccc/v11/core-customize/hybris/temp/hybris/bofs [script] [To redirect Truffle log output to a file use one of the following options: [script] * '--log.file=<path>' if the option is passed using a guest language launcher. [script] * '-Dpolyglot.log.file=<path>' if the option is passed using the host Java launcher. [script] * Configure logging using the polyglot embedding API.] [script] [engine] WARNING: The polyglot context is using an implementation that does not support runtime compilation. [script] The guest application code will therefore be executed in interpreted mode only. [script] Execution only in interpreted mode will strongly impact the guest application performance. [script] For more information on using GraalVM see https://www.graalvm.org/java/quickstart/. [script] To disable this warning the '--engine.WarnInterpreterOnly=false' option or use the '-Dpolyglot.engine.WarnInterpreterOnly=false' system property.
构建失败日志
BUILD FAILED /home/ccc/v11/core-customize/hybris/bin/platform/build.xml:13: The following error occurred while executing this line: /home/ccc/v11/core-customize/hybris/bin/platform/resources/ant/compiling.xml:95: The following error occurred while executing this line: /home/ccc/v11/core-customize/hybris/bin/platform/resources/ant/compiling.xml:207: The following error occurred while executing this line: /home/ccc/v11/core-customize/hybris/bin/platform/resources/ant/util.xml:13: The following error occurred while executing this line: /home/ccc/v11/core-customize/hybris/bin/platform/resources/ant/compiling.xml:209: The following error occurred while executing this line: /home/ccc/v11/core-customize/hybris/bin/platform/resources/ant/util.xml:142: The following error occurred while executing this line: /home/ccc/v11/core-customize/hybris/bin/modules/backoffice-framework/backoffice/buildcallbacks.xml:469: The following error occurred while executing this line: /home/ccc/v11/core-customize/hybris/bin/modules/backoffice-framework/backoffice/buildcallbacks.xml:510: TypeError: invokeMember (setProperty) on org.apache.tools.ant.Project@8923ce failed due to: Unknown identifier: setProperty at <js> :program(<eval>:3:15-74) at org.graalvm.polyglot.Context.eval(Context.java:379) at com.oracle.truffle.js.scriptengine.GraalJSScriptEngine.eval(GraalJSScriptEngine.java:458) at com.oracle.truffle.js.scriptengine.GraalJSScriptEngine.eval(GraalJSScriptEngine.java:426) at java.scripting/javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:262) at org.apache.tools.ant.util.optional.JavaxScriptRunner.evaluateScript(JavaxScriptRunner.java:150) at org.apache.tools.ant.util.optional.JavaxScriptRunner.executeScript(JavaxScriptRunner.java:82) at org.apache.tools.ant.taskdefs.optional.Script.execute(Script.java:53) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292) at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99) at org.apache.tools.ant.Task.perform(Task.java:350) at java.base/java.util.Vector.forEach(Vector.java:1365) at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:67)
解决方案
- 清理临时缓存目录:删除
hybris/temp和hybris/backoffice/temp下的所有内容,再重新执行ant clean all。 - 添加Java系统属性执行构建:执行命令时带上参数,兼容GraalJS的Nashorn模式并关闭警告:
ant clean all -Dpolyglot.engine.WarnInterpreterOnly=false -Dtruffle.js.nashorn-compat=true - 检查代码更新中的自定义脚本:如果代码更新包含自定义Ant脚本或Backoffice相关JS脚本,排查是否存在
setProperty调用的语法问题,因为GraalJS与Nashorn的Java对象调用语法存在差异。 - 验证SAP Machine版本:更换为SAP Commerce 2205官方推荐的SAP Machine 17版本,避免小版本兼容性问题。
- 重新初始化平台:先执行
ant clean platformupdate,再执行ant clean all,确保平台构建脚本与代码更新同步。
内容的提问来源于stack exchange,提问作者John Mas
相关产品推荐
相关产品推荐

