Call makefile in Ant and use the make command in the shell
<?XML version= "1.0" encoding= "Utf-8"?> <Projectname= "Dy_cike_init"Basedir="."> <Targetname= "HAIT_CPR"Description=""> <execexecutable= "/bin/sh"> <Arg Line= "-C make-f/home/test/ant/makefile"/> </exec> </Target> </Project>
using the Exec<Targetname= "Copy_lib"Description= "Copy library files from Project1 to Project2"> <execexecutable= "cmd.exe"> <Arg Line= "/C "CD. /project1 && Ant Copy_to_project2_lib " "/> </exec> </Target>translated as command line is: cmd.exe/c "CD. /project && ant copy_to_project2_lib "means to call the system console directly, execute the CD command first, then execute the ant script to specify the task,/C to execute subsequent String-specified commands, and then stop.
http://blog.csdn.net/samlei/article/details/4231496
<project name= "Maketest" default= "MK" >
<target name= "MK" >
<exec dir= "/ci/opt/cruisecontrol-bin-2.7.3/projects/maketest" executable= "make" os= "Linux" failonerror= "true" >
</exec>
</target>
</project>
And our makefile file is simple as follows:
Targets
@echo "Hello make!"
Pwd
Du
@echo "Test is ok!" >>/ci/opt/cruisecontrol-bin-2.7.3/projects/maketest/test.txt
By following the Build.xml file, Ant will execute the make command.
The results are as follows:
[email protected] maketest]# ant
Buildfile:build.xml
Mk:
[EXEC] Hello make!
[EXEC] pwd
[EXEC]/ci/opt/cruisecontrol-bin-2.7.3/projects/maketest
[Exec] du
[EXEC] 16.
BUILD Successful
Total Time:1 Second
[Email protected] maketest]#
We can see that Ant has successfully executed and output the results of the makefile. This is a reminder that ant's detection of syntax errors during execution is fairly lenient, so we see that the ant "Build successful" statement does not necessarily indicate that the ant statement is not a problem.
Ant invoke Shell command (Ubuntu)