来自 shell 脚本的配置和 运行 Ant
Config and Run Ant from shell script
我想从终端(我使用 ubuntu)用 Ant(1.8) 构建我的项目,并且想知道当我的 shell 脚本是 运行.
1、如何设置Ant_Home?没有在 bashrc 或任何其他位置设置路径,我的脚本需要设置用于构建项目的 Ant。 (这是因为,一些项目 运行 使用 Ant 1.7。)
如何在我的脚本中按顺序 运行 几个 build.xml 文件(一个接一个,如果之前 运行 构建文件成功)。此外,让我知道如何将参数从终端传递到 shell 脚本,以便可以更改 Ant home。
我的 shell 脚本如何知道构建是否成功以便执行后面的命令。
编辑:我预期的 shell 脚本会像 this.I 对编写脚本和寻找类似下面的内容非常陌生。
ANT_HOME = {#exact ant home path here or value passed from terminal at run time}
ANT_BUILD_XML_FILE_1 #Define the build xml file. This values should be taken from the terminal inputs
ANT_BUILD_XML_FILE_2 #this values should be taken from the terminal inputs
set ANT_HOME #This line will load or call the ant home
ant build -buildfile ANT_BUILD_XML_FILE_1 # run the ant build file
if(#above build is successfull)
ant build -buildfile ANT_BUILD_XML_FILE_2 #run the 2nd build file.
if(#above build 2 is successful)
#some other command
echo"projects and jars built successfully"
请注意,这也是伪代码,有点...
export ANT_HOME=/path/to/ant #this will export the path variable for this session
或者如果您想将其作为输入阅读
read ANT_HOME; export ANT_HOME
read buildXml1; read buildXml2
echo "Building"
ant build -buildfile $buildXml1 #You now have ant command available
antReturnCode=$?
echo "ANT: Return code is: \""$antReturnCode"\""
if [ $antReturnCode -ne 0 ];then
echo "BUILD FAILED"
exit 1;
else
echo "BUILD SUCCESSFUL"
fi
等等验证...
如果可以的话,也请多多指教。如果您计划构建这样的脚本供使用,您必须在这样做之前使用一些教程来增强您的游戏。
我想从终端(我使用 ubuntu)用 Ant(1.8) 构建我的项目,并且想知道当我的 shell 脚本是 运行.
1、如何设置Ant_Home?没有在 bashrc 或任何其他位置设置路径,我的脚本需要设置用于构建项目的 Ant。 (这是因为,一些项目 运行 使用 Ant 1.7。)
如何在我的脚本中按顺序 运行 几个 build.xml 文件(一个接一个,如果之前 运行 构建文件成功)。此外,让我知道如何将参数从终端传递到 shell 脚本,以便可以更改 Ant home。
我的 shell 脚本如何知道构建是否成功以便执行后面的命令。
编辑:我预期的 shell 脚本会像 this.I 对编写脚本和寻找类似下面的内容非常陌生。
ANT_HOME = {#exact ant home path here or value passed from terminal at run time}
ANT_BUILD_XML_FILE_1 #Define the build xml file. This values should be taken from the terminal inputs
ANT_BUILD_XML_FILE_2 #this values should be taken from the terminal inputs
set ANT_HOME #This line will load or call the ant home
ant build -buildfile ANT_BUILD_XML_FILE_1 # run the ant build file
if(#above build is successfull)
ant build -buildfile ANT_BUILD_XML_FILE_2 #run the 2nd build file.
if(#above build 2 is successful)
#some other command
echo"projects and jars built successfully"
请注意,这也是伪代码,有点...
export ANT_HOME=/path/to/ant #this will export the path variable for this session
或者如果您想将其作为输入阅读
read ANT_HOME; export ANT_HOME
read buildXml1; read buildXml2
echo "Building"
ant build -buildfile $buildXml1 #You now have ant command available
antReturnCode=$?
echo "ANT: Return code is: \""$antReturnCode"\""
if [ $antReturnCode -ne 0 ];then
echo "BUILD FAILED"
exit 1;
else
echo "BUILD SUCCESSFUL"
fi
等等验证...
如果可以的话,也请多多指教。如果您计划构建这样的脚本供使用,您必须在这样做之前使用一些教程来增强您的游戏。