Tải bản đầy đủ (.pdf) (1,639 trang)

OReilly java power tools apr 2008 ISBN 0596527934

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (20.45 MB, 1,639 trang )

JavaPowerTools
byJohnFergusonSmart
Publisher:O'Reilly
PubDate:April22,2008
PrintISBN-13:978-0-596-52793-8
Pages:910
TableofContents|Index

Overview
Alltruecraftsmenneedthebesttoolstodotheirfinestwork,
andprogrammersarenodifferent.JavaPowerToolsdelivers30
opensourcetoolsdesignedtoimprovethedevelopment
practicesofJavadevelopersinanysizeteamororganization.
Eachchapterincludesaseriesofshortarticlesaboutone
particulartool--whetherit'sforbuildsystems,versioncontrol,
orotheraspectsofthedevelopmentprocess--givingyouthe
equivalentof30shortreferencebooksinonepackage.No
matterwhichdevelopmentmethodyourteamchooses,whether
it'sAgile,RUP,XP,SCRUM,oroneofmanyothersavailable,
JavaPowerToolsprovidespracticaltechniquesandtoolstohelp
youoptimizetheprocess.ThebookdiscusseskeyJava
developmentproblemareasandbestpractices,andfocuseson
opensourcetoolsthatcanhelpincreaseproductivityineach
areaofthedevelopmentcycle,including:
BuildtoolsincludingAntandMaven2
VersioncontroltoolssuchasCVSandSubversion,the
twomostprominentopensourcetools
Qualitymetricstoolsthatmeasuredifferentaspectsof
codequality,includingCheckStyle,PMD,FindBugsand
Jupiter
Technicaldocumentationtoolsthatcanhelpyou




generategoodtechnicaldocumentationwithoutspending
toomucheffortwritingandmaintainingit
UnitTestingtoolsincludingJUnit4,TestNG,andtheopen
sourcecoveragetoolCobertura
Integration,LoadandPerformanceTestingtointegrate
performancetestsintounittests,load-testyourapplication,
andautomaticallytestwebservices,Swinginterfacesand
webinterfaces
IssuemanagementtoolsincludingBugzillaandTrac
ContinuousIntegrationtoolssuchasContinuum,Cruise
Control,LuntBuildandHudson
IfyouareaJavadeveloper,thesetoolscanhelpimproveyour
developmentpractices,andmakeyourlifeeasierinthe
process.Leaddevelopers,softwarearchitectsandpeople
interestedinthewiderpicturewillbeabletogatherfromthese
pagessomeusefulideasaboutimprovingyourproject
infrastructureandbestpractices.


JavaPowerTools
byJohnFergusonSmart
Publisher:O'Reilly
PubDate:April22,2008
PrintISBN-13:978-0-596-52793-8
Pages:910
TableofContents|Index

Copyright

Dedication
Foreword
Preface
Introduction
Part1:BuildTools
Chapter1.SettingUpaProjectUsingAnt
Section1.1.AntintheBuildProcess
Section1.2.InstallingAnt
Section1.3.AGentleIntroductiontoAnt
Section1.4.CompilingYourJavaCodeinAnt
Section1.5.CustomizingYourBuildScriptUsing
Properties
Section1.6.RunningUnitTestsinAnt
Section1.7.GeneratingDocumentationwithJavadoc
Section1.8.PackagingYourApplication
Section1.9.DeployingYourApplication
Section1.10.BootstrappingYourBuildScripts
Section1.11.UsingMavenDependenciesinAntwiththe
MavenTasks
Section1.12.UsingAntinEclipse
Section1.13.UsingAntinNetBeans
Section1.14.ManipulatingXMLwithXMLTask
Section1.15.Conclusion


Chapter2.SettingUpaProjectUsingMaven2
Section2.1.MavenandtheDevelopmentBuildProcess
Section2.2.MavenandAnt
Section2.3.InstallingMaven
Section2.4.DeclarativeBuildsandtheMavenProject

ObjectModel
Section2.5.UnderstandingtheMaven2Lifecycle
Section2.6.TheMavenDirectoryStructure
Section2.7.ConfiguringMaventoYourEnvironment
Section2.8.DependencyManagementinMaven2
Section2.9.LookingforDependencieswith
MvnRepository
Section2.10.ProjectInheritanceandAggregation
Section2.11.CreatingaProjectTemplatewith
Archetypes
Section2.12.CompilingCode
Section2.13.TestingYourCode
Section2.14.PackagingandDeployingYourApplication
Section2.15.DeployinganApplicationUsingCargo
Section2.16.UsingMaveninEclipse
Section2.17.UsingMaveninNetBeans
Section2.18.UsingPlug-InstoCustomizetheBuild
Process
Section2.19.SettingUpanEnterpriseRepositorywith
Archiva
Section2.20.SettingUpanEnterpriseRepositoryUsing
Artifactory
Section2.21.UsingAntinMaven
Section2.22.AdvancedArchetypes
Section2.23.UsingAssemblies
Part2:VersionControlTools
Chapter3.SettingUpVersionControlUsingCVS
Section3.1.AnIntroductiontoCVS



Section3.2.SettingUpaCVSRepository
Section3.3.CreatingaNewProjectinCVS
Section3.4.CheckingOutaProject
Section3.5.WorkingwithYourFiles—Updatingand
Committing
Section3.6.ResolvingaLockedRepository
Section3.7.WorkingwithKeywordSubstitution
Section3.8.WorkingwithBinaryFiles
Section3.9.TagsinCVS
Section3.10.CreatingBranchesinCVS
Section3.11.MergingChangesfromaBranch
Section3.12.ViewingChangeHistory
Section3.13.RevertingChanges
Section3.14.UsingCVSinWindows
Chapter4.SettingUpVersionControlUsingSubversion
Section4.1.AnIntroductiontoSubversion
Section4.2.InstallingSubversion
Section4.3.SubversionRepositoryTypes
Section4.4.SettingUpaSubversionRepository
Section4.5.SettingUpaNewSubversionProject
Section4.6.CheckingOutYourWorkingCopy
Section4.7.ImportingExistingFilesintoSubversion
Section4.8.UnderstandingSubversionRepositoryURLs
Section4.9.WorkingwithYourFiles
Section4.10.SeeingWhereYou'reAt:TheStatus
Command
Section4.11.ResolvingConflicts
Section4.12.UsingTags,Branches,andMerges
Section4.13.RollingBacktoaPreviousRevision
Section4.14.UsingFileLockingwithBinaryFiles

Section4.15.BreakingandStealingLocks
Section4.16.MakingLockedFilesRead-Onlywiththe


svn:needs-lockProperty
Section4.17.UsingProperties
Section4.18.ChangeHistoryinSubversion:Loggingand
Blaming
Section4.19.SettingUpaSubversionServerwith
svnserve
Section4.20.SettingUpaSecuresvnserveServer
Section4.21.SettingUpaWebDAV/DeltaVEnabled
SubversionServer
Section4.22.SettingUpaSecureWebDAV/DeltaVServer
Section4.23.CustomizingSubversionwithHookScripts
Section4.24.InstallingSubversionAsaWindowsService
Section4.25.BackingUpandRestoringaSubversion
Repository
Section4.26.UsingSubversioninEclipse
Section4.27.UsingSubversioninNetBeans
Section4.28.UsingSubversioninWindows
Section4.29.DefectTrackingandChangeControl
Section4.30.UsingSubversioninAnt
Section4.31.Conclusion
Part3:ContinuousIntegration
Chapter5.SettingUpaContinuousIntegrationServerwith
Continuum
Section5.1.AnIntroductiontoContinuum
Section5.2.InstallingaContinuumServer
Section5.3.ManuallyStartingandStoppingtheServer

Section5.4.CheckingtheStatusoftheServer
Section5.5.RunningtheContinuumServerinVerbose
Mode
Section5.6.AddingaProjectGroup
Section5.7.AddingaMavenProject
Section5.8.AddinganAntProject


Section5.9.AddingaShellProject
Section5.10.ManagingYourProjectBuilds
Section5.11.ManagingUsers
Section5.12.SettingUpNotifiers
Section5.13.ConfiguringandSchedulingBuilds
Section5.14.DebuggingYourBuilds
Section5.15.ConfiguringtheContinuumMailServer
Section5.16.ConfiguringtheContinuumWebSitePorts
Section5.17.AutomaticallyGeneratingaMavenSitewith
Continuum
Section5.18.ConfiguringaManualBuildTask
Section5.19.Conclusion
Chapter6.SettingUpaContinuousIntegrationServerwith
CruiseControl
Section6.1.AnIntroductiontoCruiseControl
Section6.2.InstallingCruiseControl
Section6.3.ConfiguringanAntProject
Section6.4.KeepingPeopleNotifiedwithPublishers
Section6.5.SettingUpaMaven2Projectin
CruiseControl
Section6.6.TheCruiseControlDashboard
Section6.7.Third-PartyTools

Section6.8.Conclusion
Chapter7.LuntBuild—AWeb-BasedContinuousIntegration
Server
Section7.1.AnIntroductiontoLuntBuild
Section7.2.InstallingLuntBuild
Section7.3.ConfiguringtheLuntBuildServer
Section7.4.AddingaProject
Section7.5.UsingProjectVariablesforVersion
Numbering
Section7.6.BuildResultsDiagnostics
Section7.7.UsingLuntBuildwithEclipse


Section7.8.ReportingonTestCoverageinLuntbuild
UsingCobertura
Section7.9.IntegratingLuntbuildwithMaven
Section7.10.Conclusion
Chapter8.ContinuousIntegrationwithHudson
Section8.1.AnIntroductiontoHudson
Section8.2.InstallingHudson
Section8.3.ManagingtheHudsonHomeDirectory
Section8.4.InstallingUpgrades
Section8.5.ConfiguringHudson
Section8.6.AddingaNewBuildJob
Section8.7.OrganizingYourJobs
Section8.8.MonitoringYourBuilds
Section8.9.ViewingandPromotingaParticularBuild
Section8.10.ManagingUsers
Section8.11.AuthenticationandSecurity
Section8.12.ViewingChanges

Section8.13.HudsonPlug-Ins
Section8.14.KeepingTrackofTestResults
Section8.15.KeepingTrackofCodeMetrics
Section8.16.ReportingonCodeCoverage
Chapter9.SettingUpanInstantMessagingPlatformwith
Openfire
Section9.1.InstantMessaginginaDevelopmentProject
Section9.2.InstallingOpenfire
Section9.3.SettingUpUsersandAccountsonOpenfire
Section9.4.AuthenticatingUsersinanExternalDatabase
Section9.5.AuthenticatingUsersAgainstaPOP3Server
Section9.6.VirtualTeamMeetingswiththeGroupChat
Section9.7.ExtendedFunctionalitywithOpenfirePlugIns


Section9.8.UsingOpenfirewithContinuum
Section9.9.UsingOpenfirewithCruiseControl
Section9.10.UsingOpenfirewithLuntbuild
Section9.11.SendingJabberMessagesfromaJava
ApplicationUsingtheSmackAPI
Section9.12.DetectingPresenceUsingtheSmackAPI
Section9.13.ReceivingMessagesUsingtheSmackAPI
Part4:UnitTesting
Chapter10.TestingYourCodewithJUnit
Section10.1.JUnit3.8andJUnit4
Section10.2.UnitTestingwithJUnit4
Section10.3.SettingUpandOptimizingYourUnitTest
Cases
Section10.4.SimplePerformanceTestingUsingTimeouts
Section10.5.CheckingforExceptionstheEasyWay

Section10.6.UsingParameterizedTests
Section10.7.UsingassertThatandtheHamcrestLibrary
Section10.8.JUnit4Theories
Section10.9.UsingJUnit4withMaven2
Section10.10.UsingJUnit4withAnt
Section10.11.SelectivelyRunningJUnit4TestsinAnt
Section10.12.IntegrationTests
Section10.13.UsingJUnit4inEclipse
Chapter11.Next-GenerationTestingwithTestNG
Section11.1.IntroducingTestNG
Section11.2.CreatingSimpleUnitTestswithTestNG
Section11.3.DefiningTestNGTestSuites
Section11.4.TheTestNGEclipsePlug-In
Section11.5.UsingTestNGinAnt
Section11.6.UsingTestNGwithMaven2
Section11.7.ManagingtheTestLifecycle
Section11.8.UsingTestGroups


Section11.9.ManagingDependencies
Section11.10.ParallelTesting
Section11.11.TestParametersandData-DrivenTesting
Section11.12.CheckingforExceptions
Section11.13.HandlingPartialFailures
Section11.14.RerunningFailedTests
Chapter12.MaximizingTestCoveragewithCobertura
Section12.1.TestCoverage
Section12.2.RunningCoberturafromAnt
Section12.3.CheckingtheCodeCoverageofTestNG
Tests

Section12.4.InterpretingtheCoberturaReport
Section12.5.EnforcingHighCodeCoverage
Section12.6.GeneratingCoberturaReportsinMaven
Section12.7.IntegratingCoverageTestsintotheMaven
BuildProcess
Section12.8.CodeCoverageinEclipse
Section12.9.Conclusion
Part5:Integration,Functional,Load,andPerformanceTesting
Chapter13.TestingaStrutsApplicationwithStrutsTestCase
Section13.1.Introduction
Section13.2.TestingaStrutsApplication
Section13.3.IntroducingStrutsTestCase
Section13.4.MockTestsUsingStrutsTestCase
Section13.5.TestingStrutsErrorHandling
Section13.6.CustomizingtheTestEnvironment
Section13.7.First-LevelPerformanceTesting
Section13.8.Conclusion
Chapter14.IntegrationTestingDatabaseswithDbUnit
Section14.1.Introduction
Section14.2.Overview


Section14.3.DbUnitStructure
Section14.4.ExampleApplication
Section14.5.PrimingtheDatabase
Section14.6.VerifyingtheDatabase
Section14.7.ReplacingValues
Section14.8.AlternativeDatasetFormats
Section14.9.DealingwithCustomDataTypes
Section14.10.OtherApplications

Chapter15.PerformanceTestingwithJUnitPerf
Section15.1.IntroducingJUnitPerf
Section15.2.MeasuringPerformancewithTimedTests
Section15.3.SimulatingLoadwithLoadTests
Section15.4.Load-TestingTestsThatAreNotThreadSafe
Section15.5.SeparatingPerformanceTestsfromUnit
TestsinAnt
Section15.6.SeparatingPerformanceTestsfromUnit
TestsinMaven
Chapter16.LoadandPerformanceTestingwithJMeter
Section16.1.Introduction
Section16.2.InstallingJMeter
Section16.3.TestingaSimpleWebApplication
Section16.4.StructuringYourTestCase
Section16.5.RecordingandDisplayingTestResults
Section16.6.UsingtheJMeterProxytoRecordaTest
Case
Section16.7.TestingUsingVariables
Section16.8.TestingonMultipleMachines
Chapter17.TestingWebServiceswithSoapUI
Section17.1.Introduction
Section17.2.AnIntroductiontoSoapUI
Section17.3.InstallingSoapUI


Section17.4.InstallingaLocalWebService
Section17.5.TestingWebServiceswithSoapUI
Section17.6.Load-TestingwithSoapUI
Section17.7.RunningSoapUIfromtheCommandLine
Section17.8.RunningSoapUIfromAnt

Section17.9.RunningSoapUIfromMaven
Section17.10.ContinuousTesting
Section17.11.Conclusion
Chapter18.ProfilingandMonitoringJavaApplicationsUsing
theSunJDKTools
Section18.1.TheSunJDKProfilingandMonitoringTools
Section18.2.ConnectingToandMonitoringaJava
ApplicationwithjConsole
Section18.3.MonitoringaRemoteTomcatApplication
withjConsole
Section18.4.DetectingandIdentifyingMemoryLeaks
withtheJDKTools
Section18.5.DiagnosingMemoryLeaksUsingHeap
Dumps,jmap,andjhat
Section18.6.DetectingDeadlocks
Chapter19.ProfilingJavaApplicationsinEclipse
Section19.1.ProfilingApplicationsfromWithinanIDE
Section19.2.TheEclipseTest&PerformanceTools
Platform
Section19.3.InstallingTPTP
Section19.4.TPTPandJava6
Section19.5.BasicProfilingwithTPTP
Section19.6.StudyingMemoryUsewiththeBasic
MemoryAnalysisResults
Section19.7.AnalyzingExecutionTime
Section19.8.DisplayingCoverageStatistics
Section19.9.UsingFilterstoRefineYourResults


Section19.10.ProfilingaWebApplication

Section19.11.Conclusion
Chapter20.TestingYourUserInterfaces
Section20.1.Introduction
Section20.2.TestingYourWebApplicationwithSelenium
Section20.3.TestingSwingGUIswithFEST
Section20.4.Conclusion
Part6:QualityMetricsTools
Chapter21.DetectingandEnforcingCodingStandardswith
Checkstyle
Section21.1.UsingCheckstyletoEnforceCoding
Standards
Section21.2.UsingCheckstyleinEclipse
Section21.3.CustomizingCheckstyleRulesinEclipse
Section21.4.CustomizingCheckstyleRulesUsingthe
XMLConfigurationFiles
Section21.5.CustomizingCheckstyle:CommonRules
ThatYouCanDoWithout,andSomeThatYouCouldUse
Section21.6.DefiningRulesforSourceCodeHeaders
withCheckstyle
Section21.7.SuppressingCheckstyleTests
Section21.8.UsingCheckstylewithAnt
Section21.9.UsingCheckstylewithMaven
Chapter22.PreemptiveErrorDetectionwithPMD
Section22.1.PMDandStaticCodeAnalysis
Section22.2.UsingPMDinEclipse
Section22.3.ConfiguringPMDRulesinEclipse
Section22.4.MoreonthePMDRulesets
Section22.5.WritingYourOwnPMDRuleset
Section22.6.GeneratingaPMDReportinEclipse
Section22.7.SuppressingPMDRules

Section22.8.DetectingCut-and-PastewithCPD
Section22.9.UsingPMDinAnt


Section22.10.UsingPMDinMaven
Chapter23.PreemptiveErrorDetectionwithFindBugs
Section23.1.FindBugs:ASpecializedBugKiller
Section23.2.UsingFindBugsinEclipse
Section23.3.SelectivelySuppressingRuleswithFindBug
Filters
Section23.4.UsingFindBugsAnnotations
Section23.5.UsingFindBugsinAnt
Section23.6.UsingFindBugsinMaven
Section23.7.Conclusion
Chapter24.InspectingtheResults—SemiautomatedCode
ReviewwithJupiter
Section24.1.IntroducingJupiter—ACodeReviewToolfor
Eclipse
Section24.2.InstallingJupiterinEclipse
Section24.3.UnderstandingtheJupiterCodeReview
Process
Section24.4.ConductingPersonalCodeReviews
Section24.5.Configuration
Section24.6.SettingUpDefaultConfigurationValues
Section24.7.IndividualReviews
Section24.8.TeamReview
Section24.9.ReworkPhase
Section24.10.JupiterBehindtheScenes
Section24.11.Conclusion
Chapter25.SharpenYourFocuswithMylyn

Section25.1.IntroductiontoMylyn
Section25.2.InstallingMylyn
Section25.3.TrackingTasksandIssues
Section25.4.InteractingwithTaskRepositories
Section25.5.FocusingonaTaskwithContext
Management


Section25.6.UsingtheEclipseChangeSets
Section25.7.SharingContextwithOtherDevelopers
Section25.8.Conclusion
Chapter26.MonitoringBuildStatistics
Section26.1.Introduction
Section26.2.QALab
Section26.3.SourceCodeManagementMetricswith
StatSCM
Section26.4.StatisticsinAntwithStatSVN
Part7:IssueManagementTools
Chapter27.Bugzilla
Section27.1.AnIntroductiontoBugzilla
Section27.2.InstallingBugzilla
Section27.3.SettingUpYourBugzillaEnvironment
Section27.4.ManagingUserAccounts
Section27.5.RestrictingAccessUsingUserGroups
Section27.6.ConfiguringaProduct
Section27.7.TrackingProgresswithMilestones
Section27.8.ManagingGroupsofProductswith
Classifications
Section27.9.SearchingforBugs
Section27.10.CreatingaNewBug

Section27.11.TheLifecycleofaBugzillaBug
Section27.12.SchedulingNotifications(Whining)
Section27.13.CustomizingFieldsinBugzilla
Section27.14.Conclusion
Chapter28.Trac—LightweightProjectManagement
Section28.1.AnIntroductiontoTrac
Section28.2.InstallingTrac
Section28.3.SettingUpaTracProject
Section28.4.RunningTracontheStandaloneServer
Section28.5.SettingUpTracdAsaWindowsService


Section28.6.InstallingTraconanApacheServer
Section28.7.AdministratingtheTracSite
Section28.8.ManagingUserAccounts
Section28.9.TailoringtheTracWebSite:UsingtheWiki
Function
Section28.10.UsingtheTracTicketManagementSystem
Section28.11.UpdatingTracIssuesfromSubversion
Section28.12.CustomizingTracTicketFields
Section28.13.SettingUpEmailNotifications
Section28.14.ReportingUsingTracQueriesandReports
Section28.15.ManagingProgresswithTracRoadmaps
andTimelines
Section28.16.BrowsingtheSourceCodeRepository
Section28.17.UsingRSSandICalendar
Section28.18.CustomizingaWikiPagewithPython
Section28.19.Conclusion
Part8:TechnicalDocumentationTools
Chapter29.TeamCommunicationwiththeMaven2Project

WebSite
Section29.1.TheMaven2ProjectWebSiteAsa
CommunicationTool
Section29.2.SettingUpaMavenSiteProject
Section29.3.IntegratingReportsintoYourSite
Section29.4.CreatingaDedicatedMavenSiteProject
Section29.5.DefiningtheSiteOutline
Section29.6.TheMavenSiteGenerationArchitecture
Section29.7.UsingSnippets
Section29.8.CustomizingtheLookandFeelofYourSite
Section29.9.DistributingYourSite
Chapter30.AutomaticallyGeneratingTechnical
Documentation
Section30.1.Introduction


Section30.2.VisualizingaDatabaseStructurewith
SchemaSpy
Section30.3.GeneratingSourceCodeDocumentation
withDoxygen
Section30.4.EmbeddingUMLDiagramsinYourJavadoc
withUmlGraph
Section30.5.Conclusion
Bibliography
Colophon
Index


Copyright
Copyright©2008,JohnFergusonSmart.Allrightsreserved.

PrintedintheUnitedStatesofAmerica.
PublishedbyO'ReillyMedia,Inc.,1005GravensteinHighway
North,Sebastopol,CA95472.
O'Reillybooksmaybepurchasedforeducational,business,or
salespromotionaluse.Onlineeditionsarealsoavailablefor
mosttitles().Formoreinformation,
contactourcorporate/institutionalsalesdepartment:(800)
998-9938or
Editor:MikeLoukides
ProductionEditor:LoranahDimant
NutshellHandbook,theNutshellHandbooklogo,andthe
O'ReillylogoareregisteredtrademarksofO'ReillyMedia,Inc.
JavaPowerTools,theimageofadrillpress,andrelatedtrade
dressaretrademarksofO'ReillyMedia,Inc.
Manyofthedesignationsusesbymanufacturersandsellersto
distinguishtheirproductsareclaimedastrademarks.Where
thosedesignationsappearinthisbook,andO'ReillyMedia,Inc.
wasawareofatrademarkclaim,thedesignationshavebeen
printedincapsorinitialcaps.
Whileeveryprecautionhasbeentakeninthepreparationofthis
book,thepublisherandauthorassumenoresponsibilityfor
errorsoromissions,orfordamagesresultingfromtheuseof
theinformationcontainedherein.


ThisbookisdedicatedtomywonderfulwifeChantal,andmy
twolovelyboys,JamesandWilliam,whoaremyconstant
sourceofinspiration,wonder,andjoy.



AndrewGlover,President,StelligentIncorporated


Foreword
Designing,coding,anddeployingworkingJavaapplicationsisn't
easy.Doingitinapredictablemannerrapidlywithan
acceptablelevelofqualityisevenharder.Inadditiontohaving
tounderstandwhatstakeholderswantorthevaryingskillsof
teammembersoreventhemyriadweb,dataaccess,andutility
frameworksonecanchoosefrom,you'vegottoactually
managethedevelopmentprocessitself!
Thecodingofrequirementsischallengingenough,butas
anyonewho'severdeliveredaworkingapplicationknows,inthe
grandschemeofthings,that'sonesliverofthedevelopment
process—infact,somemaysaythat'stheeasiestpart.Think
aboutallthetechniquesandprocessesthataggregateupto
produceasoftwareapplication.
First,you'vegottofigureouthowtodelivertheworking
applicationinapredictablemanner.Atahighlevel,thismeans
threethings:trackingchangestosourcecodeassets,keeping
upwithanyuncoveredissues,defects,orfeaturerequests,and
assemblingtheapplicationinareliableandrepeatablemanner.
Next,you'regoingtowanttoactuallyensuretheapplication
underdevelopmentactuallyworks—ideallyduringdevelopment.
Thismeanswritingtestsearly.Ofcourse,thisprocessiseasier
saidthandone.Althougharguablytherearefewstandard
testingframeworksfromwhichtochose,thereisacornucopia
ofassociatedtoolsthatacceleratewritingdevelopertestsby
addressingspecificchallenges.
What'smore,asthecodebasegrows,you'llprobablywantto

understandwhat'sbeingcodedandhowwellit'sbeing
developed.Althoughtestscancertainlyverifycodefunctionality,
youmayalsowantlighter-weighttoolsthatcanreporton
variousmetrics,suchascomplexity,codingstandards,oreven
thecoverageoftests.
Ofcourse,ifyou'vegotamechanismforassemblingyour


applicationinarepeatableandreliablemanner,itmakessense
toaugmentthisprocessbyrunningtestsandevenanalysis
tools.What'smore,giventhatyouwanttoproduceworking
codequickly,itmakessensetoassembletheapplicationoften—
infact,assemblingitcontinuouslyfacilitatesdiscoveringissues
astheyarise.
Finally,you'regoingtowanttoenableeasymaintenanceofthe
codebasesothatfeaturescanbeaddedoften—inthesame
rapidandrepeatablemannerthattheapplicationwasbuilt.
JohnhasassembledwhatIthinkisthe"A"listoftoolsand
techniquesthatwillhelpyoumeeteachandeveryoneofthe
challengesabove.Infact,Johnpresentsmultiplechoicesin
somecases,givingyoutheopportunitytodecidewhichtool
worksbestforyou.WhetheryoudecidetouseAntorMavenfor
deliveringaworkingapplicationinapredictablemanner,TestNG
orJUnitforearlydevelopertesting,PMDorFindBugsforcode
analysis,orCruiseControlorLuntbuildforContinuous
Integration,thisbookaddressesthefundamentaltechniquesfor
effectivelyemployingthesetools(andamultitudeofothersas
well).
RapiddevelopmentofJavaapplications(whichhavean
acceptablelevelofassociatedquality)isstillhardasever;

however,afterreadingJohn'smagnumopusonthetoolsand
techniquesthatultimatelyenablepredictability,confident,and
accelerateddeliveryinasoftwaredevelopmentprocess,you'll
findthatdesigning,coding,anddeployinghigh-qualityJava
applicationsrapidlyjustgotawholeloteasier.


Preface
HereisEdwardBear[1]comingdownstairsnow,bump,
bump,bump,onthebackofhishead,behindChristopher
Robin.Itis,asfarasheknows,theonlywayofcoming
downstairs,butsometimeshefeelsthattherereallyis
anotherway,ifonlyhecouldstopbumpingforamoment
andthinkofit.
—"WeareintroducedtoWinnie-the-Poohandsomebees,
andthestoriesbegin,"WinniethePooh,A.A.Milne
[1]FornonnativeEnglishreaders:EdwardBearisaround-aboutwayof

saying"TeddyBear."Intheoriginalbook,thistextisaccompaniedbya
drawingofChristopherRobin,aboyofaboutfouryearsold,goingdowna
flightofstairsdragginghisteddybearbehindhim.

ThusdoesA.A.Milneintroducethatclassiccharacterof
children'sliterature,WinniethePooh.Asyoucansee,Winnie
thePoohseemstohavesomeissueswiththewayhegoes
downstairs(weprobablywouldn'tbetoofaroffifwewereto
speakof"painpoints").
Softwaredevelopmentsometimesfeelslikethis.Itiseasyto
getsoboggeddowninthedetails,underthepressureoftight
deadlinesandchangingrequirements,thatyouforgetthatthere

mightjustbeabetterway.Ahighnumberofbugs,adifficult
integrationprocess,longandpainfulbuilds,andpoorproject
visibilitybecomeanacceptedpartofthedeveloper'slife.
Thegoodnewsisthatthereareinfactmanyeasywaysto
improveyoursoftwaredevelopmentlifecycle.
Ajudicioususeoftoolscangoalongwayinboostingdeveloper
productivity.Forexample,manydistributeddevelopmentteams
usenothingmoresophisticatedthanaCVSorSubversion
repositoryforstoringapplicationcodeandamailinglistfor
discussion.Imagineasysteminwhich,wheneversomeone
commitsachange,issuesareautomaticallyclosedorupdated


basedonthecommitcomment.Theissuemanagementsystem
thenautomaticallynotifiestheissueownerofthechangeof
status.Meanwhile,adedicatedbuildserverdetectsthecommit,
buildsandteststhesystem,andnotifiesthedeveloperofany
failures.Inafewrelativelysimplesteps,you'vetakenyour
developmentplatformtoanewlevelofreactivityand
responsiveness.
Thisisjustafirststep.Soonyouwillbeintegrating
automaticallyrunningunitandpossiblyintegrationtests,code
coveragetools,stylecheckingtools,andmoretocreatea
highlyreactive,informative,finelytunedprojectinfrastructure.
Toolsarethekeytomakingsuchaninfrastructurework
efficiently.OnceyoustarttoadoptasetofSDLCtoolsthatsuit
yourprojectandyourorganization,youwillseearevolutionary
shiftinagroupsdevelopmentpractices.Agiledevelopment
authorssuchasAlistairCockburnrightlypointtooptimal
communicationasbeingthecornerstoneofproductive

development.Developinginateamwithoutcontinuous
integrationislikerockclimbingwithoutarope.Inaddition,
developinginateamwithoutcollaborationandconnective
developmentinfrastructureislikedevelopinginaboringbeige
officespacewhereeveryonecomestoworkontime,entersa
closedoffice,closesthedoor,andstartsprogrammingwithout
everstoppingtohavemeetings.Inotherwords,programming
withoutagoodsetofSDLCtoolsisverymuchtheequivalentof
fightingamodernwarwithswordsandarmor—theadoptionof
SDLCtoolsisagenerationalshift,theprogrammersjustcoming
intotheworkforcewillneverknowanalternative,butthe
programmerswhohaven'texperiencedthisshiftareindanger
ofmissingthetrendaltogether.
Nowyoushouldn'tgothinkingthatSDLCtoolsareonlyforlarge
teamsorbigorganizations.Theyaren't.Infact,mostSDLC
toolsareeasytosetup,andalmostallorganizationscan
benefit,evenasmalloutfitwithonlytwoorthreedevelopers.
Mostofthesetoolsandtechniquesarenotparticularlydifficult


toputintoplace,buttheydorequireaminimumofeffort,to
stepbackandtakealong,hardlookatyourcurrentpractices.
Chancesare,therearethingsthatcanbeimproved.
ThisbookispartoftheO'ReillyPowerToolsseries,whichbegan
withtheillustriousUnixPowerToolsbackin1993.Ithasno
relationtothe"JavaPowerTools"library
(whichisasoftwareresearch
projectintheJavaGUIfield,conductedbyCollegeofComputer
&InformationScienceattheNortheasternUniversity,Boston,
underthedirectionofRichardRasala.


P2.1.HowThisBookIsOrganized
Oneofthemostcharacteristictraitsoftheopensource
()Javaworldischoice.Itseemsthat,for
anygiventask,therearealwaysatleasttwoopensourcetools
thatcandothejob.Toreflectthis,Ihavetriedtogivea
representativesurveyoftheavailableopensourcetoolsfor
eachareaofsoftwaredevelopmentthatwecover.Thebook
doesnottryto"sell"anyonetool,orevenanyonetoolineach
domain.Onthecontrary,wetrytogivereadersenough
informationsothattheycandecideforthemselveswhichtoolis
themostappropriatefortheirparticularorganization,andgive
enoughpracticalinformationtogetthemupandrunning.
Thisbookisorganizedintosections,witheachsectioncovering
aparticularaspectofthesoftwaredevelopmentlifecycle(or
SDLC).Witheachsection,welookatanumberofavailable
toolsthatcanbeusedtoimprovethisaspectoftheSDLC.

P2.1.1.BuildTools
Inthefirstsection,wecoverpossiblythemostfundamental
toolofall(afterthecompilerandtheIDE,thatis):thebuild
tool.Indeed,whenusedwell,thebuildtoolbecomesthe
cornerstoneofyourSDLCprocess.Itisthistoolthat
coordinates,federates,andbindstheotherSDLCtoolstogether
intoasingle,coherentprocess.Andthebuildtoolhelpsto


×