如何重新编译从命令行NetBeans项目? [英] How to recompile a netbeans project from commandline?
问题描述
我在NetBeans develeped Java应用程序。我想创建重新编译项目和包所产生的jar文件的一些文件,以一个zip文件沿批处理文件,并生成一个安装程序。
I have a java application develeped in netbeans. I want to create a batchfile that recompiles the project and packs the resulting jar files along with some documentation to a zip file and generate an installer.
安装程序的包装和代是没有问题的,但我不知道如何编译命令行从/自动批处理文件 - 每当我更改源 - code我必须手动点击清理并生成一些里面的NetBeans,之后运行我的批处理文件。
The packing and generation of the installer is no problem, but I dont know how to automate the compilation from commandline/batchfile - whenever I change something in the source-code I have to manually click on "Clean and Build" inside netbeans and run my batchfile afterwards.
我有什么要添加到批处理文件做同样为清理并生成,从里面的NetBeans?
What do I have to add to the batchfile to do the same as "Clean and Build" from inside netbeans?
推荐答案
我发现自己做了什么:
- 确保蚂蚁在路径(例如我加入C:\\计划\\ 6.9.1的NetBeans \\ java的\\蚂蚁\\ bin添加到我的PATH环境)
- 确保您的JAVA_HOME设置正确
- 在NetBeans项目的目录中执行蚂蚁干净和蚁罐子
该批处理文件我使用:
SET JAVA_HOME=C:\Programme\Java\jdk1.6.0_12
call ant deps-clean
call ant clean
call ant jar
pause
cp -r doc dist
cp -r scripts dist
cp -r examples dist
cp -r crypt dist
cp -r db dist
cp -r license dist
rm dist/README.TXT
cp README.TXT dist
echo package creation %date:~-4,4%_%date:~-7,2%_%date:~0,2% >> dist/README.TXT
cd win_service
RCEDIT.exe /C wizard.exe
RCEDIT.exe /I wizard.exe my_app.ico
RCEDIT.exe /N wizard.exe pre_wizard.ini
RCEDIT.exe /C my_app_service.exe
RCEDIT.exe /I my_app_service.exe my_app.ico
RCEDIT.exe /N my_app_service.exe pre_my_app_service.ini
cp my_app_service.ini ../dist
cp my_app_service.exe ../dist
cp wizard.exe ../dist
cp wizard.ini ../dist
cp service*.bat ../dist
cp *.nsi ../dist
cp *.nsh ../dist
cp my_app.log ../dist
cd ..
cd dist
mkdir windows
cp *.jar windows
cp -r lib windows
cp -r crypt windows
cp -r db windows
cp examples\empty_settings.ini windows\settings_example.ini
mv *.exe windows
mv *.ini windows
mv *.bat windows
mv *.nsi windows
mv *.nsh windows
mv my_app.log windows
cd windows
my_app.nsi
mv my_appInstaller.exe ../my_appInstaller_gpl.exe
rm lib\jdbc-mysql.jar
my_app.nsi
mv my_appInstaller.exe ../my_appInstaller.exe
cd ..
rm -rf my_app
mkdir my_app
mv *.jar my_app
mv lib my_app
mv crypt my_app
mv db my_app
mv examples\empty_settings.ini my_app\settings.ini
ren my_app 9880
mkdir my_app
mv 9880 my_app
7z a -r -tzip my_app_gpl.zip doc license examples scripts my_app README.txt my_appInstaller_gpl.exe
rm my_app\9880\lib\jdbc-mysql.jar
7z a -r -tzip my_app.zip doc license examples scripts my_app README.txt my_appInstaller.exe
cd ..
pause
这篇关于如何重新编译从命令行NetBeans项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!