Is it possible to call Ant or NSIS scripts from Java code?

后端 未结 4 1356
旧时难觅i
旧时难觅i 2020-11-29 09:15

Is it possible to call Ant or NSIS scripts programmatically from Java code at runtime? If so, how?

4条回答
  •  北荒
    北荒 (楼主)
    2020-11-29 09:27

    Yes, and Nivas gave the most specific answer and probably the best answer too, but call me old fashioned, I still prefer just doing:

    Process child = Runtime.getRuntime().exec(command);
    

    where command is a String with your ant commands or a shell script to your ant commands;

    If you don't need all the "bells and whistles", which are pretty cool I admit, then it is less code to manage later. You don't get to step debug the ant calls, my way. The trade off is that your files need to be in special places with special names, but Java is already a little OCD in that regard anyway. (Don't flame me. ;) Java is my favorite language too, but come on, we're talking deployment options here and you know it's a little OCD in the deployment options area, right?) I guess all I'm really suggesting is "It may be over kill to use a commando knife to butter toast." and to consider that as well. ;)

    * self edited for preachiness

提交回复
热议问题