Home  >  

Anatomy of an Enterprise Flex RIA Part 5: Build Life Cycle

Author photo
| | Comments (0)
AddThis Social Bookmark Button
riaseries_part5.jpg
Last installment we looked at more of Maven's project structure. Now we'll look at the Maven build lifecycle and where the tests are located in our sample application.

The build life cycle that Maven defines is the set of events that make up the build process. At different points during this life cycle we can configure Maven, or even extend Maven with Ant.

Table 3 lists all the Maven life cycles shown on the Maven web site, at http://maven.apache.org.

Table 3. Maven life cycles
Life cycle phaseDescription
ValidateValidate that the project is correct and that all necessary information is available.
generate-sourcesGenerate any source code for inclusion in compilation.
process-sourcesProcess the source code—for example, to filter any values.
generate-resourcesGenerate resources for inclusion in the package.
process-resourcesCopy and process the resources into the destination directory, ready for packaging.
CompileCompile the project’s source code.
process-classesPost-process the generated files from compilation—for example, to do bytecode enhancement on Java classes.
generate-test-sourcesGenerate any test source code for inclusion in compilation.
process-test-sourcesProcess the test source code—for example, to filter any values.
generate-test-resourcesCreate resources for testing.
process-test-resourcesCopy and process the resources into the test destination directory.
test-compileCompile the test source code into the test destination directory.
TestRun tests using a suitable unit-testing framework. These tests should not require that the code be packaged or deployed.
prepare-packagePerform any operations necessary to prepare a package before the actual packaging. This often results in an unpacked, processed version of the package (Maven 2.1 and later).
PackageTake the compiled code and package it in its distributable format, such as a JAR.
pre-integration-testPerform actions required before integration tests are executed. This may involve such things as setting up the required environment.
integration-testProcess and deploy the package, if necessary, into an environment where integration tests can be run.
post-integration-testPerform actions required after integration tests have been executed. This may include cleaning up the environment.
VerifyRun any checks to verify that the package is valid and meets quality criteria.
InstallInstall the package into the local repository, for use as a dependency in other projects locally.
DeployDone in an integration or release environment; copies the final package to the remote repository for sharing with other developers and projects.


anatomy_fig14.jpg
Figure 14. The classes and resources used in the tests thus far. (Click to enlarge.)


These tests are fairly simple, but keep in mind that any untested code is a surprise waiting to happen. It’s like the high school student who worried and worried about an upcoming test and so studied every night. When the test came and he aced it, he said, “I wish I wouldn’t have wasted all that time studying; that test was easy!” Having a bunch of simple passing tests isn’t a waste of time writing tests; it’s coverage. Changes to the code can break things in simple places as well as complex ones.


Enough preaching! Let’s look at building out the service layer so that we can get another step closer to getting these entities from Java to Flex.

The two life cycle phases during which we’ll use Ant tasks to customize our build are the process-resources phase in the data project, and the compile phase in the web project.

Next installment we'll start to break the project down and show how we'll use Maven to automate the process of building the project's code. You can always find the entire series here.

Read more from Tony Hillerson. Tony Hillerson's Atom feed thillerson on Twitter

Comments

Leave a comment


Tag Cloud

Question of the Week: Dream App

If you had an unlimited budget and unlimited resources what application would you build and why would you build it?

Answer

Latest Features

Recommended for You

@InsideRIA on Twitter

Archives

  • Or, visit our complete archive.  

About This Site

Welcome to the premiere community site for all things RIA sponsored by O'Reilly Media and Adobe Systems Incorporated.