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

后端 未结 12 1906
情歌与酒
情歌与酒 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

    I already know that ant is a 'build automation software', my question is, what exactly is build automation? I thought that you're supposed to test your app, and when it is running you click the 'build' button in eclipse or through command-line java, and it makes a .jar file out of it? So why do you need to 'automate' this process?

    Not all the Java development is done through eclipse and not all the jars may be built from the command line ( or should be built from the command line ) .

    You may need additionally run test cases, unit tests, and many, many other process.

    What ant does, is provide a mechanism to automate all this work ( so you don't have to do it every time ) and perhaps you may invoke this ant script each day at 6 p.m.

    For instance, in some projects, a daily build is needed, the following are the task that may be automated with ant, so they can run without human intervention.

    • Connect to subversion server.
    • Download/update with the latest version
    • Compile the application
    • Run the test cases
    • Pack the application ( in jar, war, ear, or whatever )
    • Commit this build binaries to subversion.
    • Install the application in a remote server
    • Restart the server
    • Send an email with the summary of the job.

    Of course for other projects this is overkill, but for some others is very helpful.

    0 讨论(0)
  • 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.
    0 讨论(0)
  • 2021-01-31 10:34

    If there's one close to you I think you'd get a lot out of CITCON, the Continuous Integration and Testing Conference. You get to talk with lots of people about the benefits of automation applied to building and testing software.

    Basically people use Ant (with other tools) to automate everything they want to have happen after a commit. The basic advantages of such automation are faster, better and cheaper.

    Faster because things happen right away without waiting for a human to get around to it.

    Better because computers are really really good at doing the same thing the same way every time. (Humans tend to suck at that.)

    Cheaper because you have fewer mistake and the mistakes that occur are caught sooner and therefore cheaper to fix.

    0 讨论(0)
  • 2021-01-31 10:38

    Ant is for automating software build processes:

    http://en.wikipedia.org/wiki/Apache_Ant

    0 讨论(0)
  • 2021-01-31 10:38

    Ant is a build tool, akin to makefiles (albeit with a very different syntax in XML). If you're only using Eclipse it's fine to stick to that and you can always convert an Ant build file into an Eclipse project (Eclipse's launch configurations are then, if I remember correctly, the equivalent of Ant's build targets).

    If you want to deploy the source code of the application and allow others to easily build or set it up, automating that using Ant is probably not a bad idea. But it's usually not a consistent experience for users or at least I haven't seen much consensus on what targets should be there and doing what so far.

    Ant may also be used for regular automated builds (you wouldn't want to hit Run in Eclipse every night, right? :-))

    0 讨论(0)
  • 2021-01-31 10:44

    Eclipse is using ant for building, running, deploying, ...

    "Ant is a Java-based build tool. In theory, it is kind of like Make, without Make's wrinkles and with the full portability of pure Java code." (from link text

    0 讨论(0)
提交回复
热议问题