Ant invoke Shell command (Ubuntu)

Source: Internet
Author: User

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 &QUOT;CD. /project1 &amp;&amp; Ant Copy_to_project2_lib &quot; "/>    </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)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.