Preventing Build Breaks

Problem

You are concerned because developers keep “breaking the build” by checking in broken code to your version control tool.[17]

Solution

Adopt a policy in which developers must perform a clean build using Ant before checking in changes to the source repository. Ask them to run all unit tests, as well.

Discussion

This is largely a project management issue. If your team has an Ant buildfile along with a suite of unit tests, the build should not be breaking on a routine basis. Understand that people do make mistakes, such as forgetting to commit some changes to CVS despite having tested their changes.

Each developer should follow these suggestions in order to minimize integration problems:

  • Work in pairs. Your partner should encourage you to follow the full testing procedure before checking in code.

  • Work on one problem at a time. Keeping track of dozens of changes for days at a time is a good way to get out of sync with the rest of the team and introduce build problems.

  • Perform a clean build before testing changes.

  • Run the entire suite of unit tests before committing changes to the version control tool.

See Also

Chapter 1 and Chapter 2 discuss XP practices such as continuous integration and pair programming.

[17] A version control tool is something like CVS or Microsoft Visual SourceSafe.

Get Java Extreme Programming Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.