如何自动创建批处理/ shell脚本运行Java控制台应用程序? [英] How to automatically create batch / shell scripts to run a Java console application?

查看:346
本文介绍了如何自动创建批处理/ shell脚本运行Java控制台应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Java comman线应用程序,并wouldl要创建一个Ant *构建脚本,它将创建所需的所有批次/ shell脚本来运行应用程序成功地包括所有的classpath变量:

I have a Java comman-line application, and wouldl like to create an Ant* build script that will create all the required batch / shell scripts to run the application succesfully including all classpath variables:


  1. 创建2批/ shell脚本文件,一个用于Linux / Unix和一个用于Windows / DOS

  2. 添加所有的类路径依赖(Maven的距离或者干脆使用在Eclipse中构建路径)

  3. 添加任何nessecary样板SH /蝙蝠code运行(ENV变量JAVA_HOME ...)

我发现只有一个答案(ε2)这里:<一href=\"http://stackoverflow.com/questions/3927975/is-there-a-way-to-have-ant-create-a-shell-or-batch-runtime-script\">Is有没有办法让蚂蚁创建一个shell或批处理脚本运行?

I found only a patial answer here: Is there a way to have Ant create a shell or batch runtime script?

但我没有发现任何东西,做每一个构建涉及到这个基本的和琐碎的任务

But I haven't found anything that does this basic and trivial task that every build involves

*免责条款 - 原来问题是蚂蚁/ Maven的,但我会preFER,看它是否能够在蚂蚁做

* Disclaimer - the original question was Ant / Maven, but I would prefer to see if it can be done in Ant

推荐答案

在Maven的这个最好的解决办法是的 Maven的appassembler-插件,它处理的shell脚本/批处理文件的创建。在与Maven组装组合可以创建一个包含其需要的一切一个tar.gz或zip压缩包。

In Maven the best solution for this is the maven-appassembler-plugin which handles the creation of a shell script / batch file. In combination with maven-assembly you can create a tar.gz or zip archive which contains everything which is needed.

这篇关于如何自动创建批处理/ shell脚本运行Java控制台应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆