Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
722 views
in Technique[技术] by (71.8m points)

ant - How to automatically create batch / shell scripts to run a Java console application?

I have a Java command-line application, and would like to create an Ant* build script that will create all the required batch/shell scripts to run the application successfully including all the classpath variables. I need it to do the following:

  1. Create a shell script file for Linux/Unix and a batch file for Windows/DOS
  2. Add all classpath dependencies (from Maven or simply use the build path in Eclipse)
  3. Add any necessary boilerplate sh/bat code to run (ENV variables, JAVA_HOME, etc.)

I found only a partial answer here.

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

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...