我有一个bash脚本:
C:/Jenkins/workspace/xmlstarlet-1.6.1-win32/xmlstarlet-1.6.1/xml.exe ed -L -s "/Package/types[name='$TYPENAME']" -t elem -n members -v "$ENTITY" $SCRIPTFILE
C:/Jenkins/workspace/xmlstarlet-1.6.1-win32/xmlstarlet-1.6.1/xml.exe ed -L -s "/Package" -t elem -n types -v "" $SCRIPTFILE
在xml中插入特定类型的节点,在本地运行良好,但是当尝试通过任何脚本运行时会失败:
蚂蚁脚本:
<exec executable="C:\Program Files\Git\bin\bash.exe" osfamily="windows">
<arg value="generate_package.sh" />
<arg value="C:/Jenkins/workspace/TrailheadBranchDemo/final.txt" />
<arg value="package" />
<arg value="C:/Jenkins/workspace/deploy/src" />
</exec>
错误消息: 无效的表达形式:C:/ Program Files / Git / Package
它无法选择/Package
或/Package/types[not(*)]
表达式。
答案 0 :(得分:0)
问题是:
在Windows上,bash脚本的工作方式如下:
$ C:/Jenkins/workspace/xmlstarlet/xmlstarlet/xml.exe ed -L -i "Package" -t attr -n xmlns -v "http://soap.sforce.com/2006/04/metadata" C:/Jenkins/workspace/deploy/src/package.xml
代替此:
$ C:/Jenkins/workspace/xmlstarlet/xmlstarlet/xml.exe ed -L -i '/Package' -t attr -n xmlns -v "http://soap.sforce.com/2006/04/metadata" C:/Jenkins/workspace/deploy/src/package.xml
在Windows中无法正确识别/Package
。