What is build automation software (for example, Ant)?

后端 未结 12 1842
情歌与酒
情歌与酒 2021-01-31 10:19

I see reference of ant a lot but I don\'t get exactly what its meant to do? from what i\'ve heard its supposed to compile your projects but can\'t i just do that by clicking Run

12条回答
  •  有刺的猬
    2021-01-31 10:34

    Ant is used to automate a build process, but a build process is often much more than compiling. Ant has "tasks" that can be used to perform miscellaneous useful functions. You can create your own task to do just about anything by writing a java class and telling ant where to find it. You can then mix and match these tasks to create targets that will execute a set of tasks.

    You can also set up a dynamic environment in which to build your application. You can set up property files to hold variables that can be used in the build process, i.e. to hold file paths, class paths, etc. This is useful for instance to differentiate between test and production builds where deployment paths, database instances, etc. might change. Ant also includes flow control (if, etc.)

    Some things I've seen ant do:

    • Compile code
    • Use version control to checkout the latest version or to tag the version being built
    • Run sql scripts to build or rebuild a test database
    • Copy files from an external resource for inclusion in a project
    • Bundle code into a jar, war or ear file
    • Deploy a web application to an application server
    • Restart an application server
    • Execute a test suite
    • Static analysis, i.e. CheckStyle or PMD
    • Send email to a team to alert them to a build.
    • Generate files based on information from the build.
      • Example: I have a jsp in my app that does nothing but display version/build information. It is generated by ant when I run a build, and the production operations team checks this page when they deploy the application to make sure they've deployed the correct build.

提交回复
热议问题