我正在编写一个批处理文件,以便从本地存储库安装eclipse上的特性。
eclipse.exe -application org.eclipse.equinox.p2.director
-repository C:/repo,http://download.eclipse.org/releases/indigo/
-installIU com.app.feature.feature.group但是我无法从批处理脚本中检测到操作是失败还是成功。似乎eclipse没有设置错误级别?有什么可行的解决方法吗?
发布于 2012-08-14 08:21:40
我发现的一种解决方法是通过ant exec运行命令,而不是直接从批处理文件调用。它会报告所有的错误。
<exec executable="eclipse.exe" failonerror="true">
<arg value="-noSplash"/>
<arg value="-application"/>
<arg value="org.eclipse.equinox.p2.director"/>
<arg value="-repository"/>
<arg value="file:C:/repo,http://download.eclipse.org/releases/indigo/"/>
<arg value="-installIU"/>
<arg value="com.app.feature.feature.group"/>
</exec>发布于 2012-08-23 23:18:44
Equinox 3.6.0中有一个bug (已在3.6.1中修复),导致失败的应用程序返回退出代码0。除非您使用的是Equinox版本,否则p2控制器应用程序具有正确的退出代码。
我认为问题出在您如何检查批处理脚本中的退出代码。您可以使用IF ERRORLEVEL 1 GOTO LabelOfErrorHandling检查非零退出代码。
https://stackoverflow.com/questions/11927259
复制相似问题