软件打包和部署 installanywhere 用 ant 自动打包

jiaojiaon1024 · 发布于 2013年3月21日 · 215 次阅读
96

build文件编写内容如下:

执行ant build开始编译打包。最后打包成功。

问题:

若在配置的包里缺少某些文件,应该有报错信息输出,现无报错信息输出。 根据帮助文档理解InstallerStdErrRedirect 这个参数是输出在编译过程有错误可以写在一个文件里, 但是我设置了故意在包里少放了几个文件,编译过程并没有把报错信息放在这个路径下且这个路径下也没有报错文件产生。

请高手帮助,万分感谢!

共收到 3 条回复
96
scmroad · #1 · 2013年3月21日

你可以参考下面的信息

http://kb.flexerasoftware.com/doc/Helpnet/IA2011/Content/helplibrary/ia_ref_ant_task.htm

In order to redirect InstallAnywhere’s build process output to Ant’s log, you must specify a redirector as described in the Ant documentation (Exec task). For information about using Ant, see http://ant.apache.org/manual/.

然后在 http://ant.apache.org/manual/ 看到

redirector

Since Ant 1.6.2 A nested I/O Redirector can be specified. In general, the attributes of the redirector behave as the corresponding attributes available at the task level. The most notable peculiarity stems from the retention of the attributes for backwards compatibility. Any file mapping is done using a null sourcefile; therefore not all Mapper types will return results. When no results are returned, redirection specifications will fall back to the task level attributes. In practice this means that defaults can be specified for input, output, and error output files.

Errors and return codes

By default the return code of a is ignored; when you set failonerror="true" then any return code signaling failure (OS specific) causes the build to fail. Alternatively, you can set resultproperty to the name of a property and have it assigned to the result code (barring immutability, of course). If the attempt to start the program fails with an OS dependent error code, then halts the build unless failifexecutionfails is set to false. You can use that to run a program if it exists, but otherwise do nothing.

What do those error codes mean? Well, they are OS dependent. On Windows boxes you have to look at the documentation; error code 2 means 'no such program', which usually means it is not on the path. Any time you see such an error from any Ant task, it is usually not an Ant bug, but some configuration problem on your machine.

Sends the string "blah before blah" to the "cat" executable, using an to replace "before" with "after" on the way in. Output is sent to the file "redirector.out" and stored in a property of the same name. Similarly, error output is sent to a file and a property, both named "redirector.err". Note: do not try to specify arguments using a simple arg-element and separate them by spaces. This results in only a single argument containing the entire string.

Timeouts: If a timeout is specified, when it is reached the sub process is killed and a message printed to the log. The return value of the execution will be "-1", which will halt the build if failonerror=true, but be ignored otherwise.

96
jiaojiaon1024 · #2 · 2013年3月25日

[i=s] 本帖最后由 jiaojiaon1024 于 2013-3-25 09:51 编辑

最终解决方案为:在之前加以下代码获取log文件。

96
scmroad · #3 · 2013年3月25日

谢谢分享。

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册