Tải bản đầy đủ (.pdf) (384 trang)

OReilly maven a developers notebook jun 2005 ISBN 0596007507

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 (2.41 MB, 384 trang )

Maven:ADeveloper'sNotebook
ByVincentMassol,TimothyM.O'Brien
...............................................
Publisher:O'Reilly
PubDate:June2005
ISBN:0-596-00750-7
Pages:224

TableofContents|Index

Mavenisanewprojectmanagementandcomprehensiontoolwhichprovidesanelegant
waytosharebuildlogicacrossprojects.Intermsofcapabilities,Mavenisanimprovement
toApacheAnt-thankstonumerousplug-insandbuilt-inintegrationwithunittesting
frameworkssuchasJUnit.Tiredofwritingthesamebuildlogicforeveryproject?Using
Maven,youcanleveragetheexperienceofthecommunitytoavoidthetediousprocessof
creatingyetanotherbuildscriptforeachnewproject.
Maven:ADeveloper'sNotebookbeginsbyintroducingyoutotheconceptofprojectobject
model(POM),andthenoffersfurtherdetailsontheessentialfeaturesofMaven.Likeall
titlesinO'Reilly'sDeveloper'sNotebookseries,thisno-nonsensebookskipstheboring
proseandcutsrighttothechase.It'sanapproachthatforcesyoutogetyourhandsdirty
byworkingthroughaseriesofpoignantlabs-exercisesthatspeaktoyouinsteadofatyou.
Plus,Maven:ADeveloper'sNotebookisthefirstbookonthesubjecttohitthemarket,so
youknowtheinformationisfreshandtimely.Ifyou'reaJavaprogrammer,you'llbearmed
withallthecriticalinformationyouneedtogetuptospeedonthispowerfulnewbuild
tool.You'lldiscoverhowMavencanhelpyou:
manageaproject'sbuild,reporting,anddocumentation,allfromacentralpieceof
information
breakacomplexprojectintoaseriesofsmallersubprojects
reportoncodequality,unittests,codeduplication,andprojectactivity
createacustomremoterepository
buildsimpleandcomplexplug-ins



Intheend,you'llfindyourselfspendinglesstimeworkingonyourproject'sbuildsystem
andmoretimeworkingonyourproject'scode.


Maven:ADeveloper'sNotebook
ByVincentMassol,TimothyM.O'Brien
...............................................
Publisher:O'Reilly
PubDate:June2005
ISBN:0-596-00750-7
Pages:224

TableofContents|Index



















































Copyright
TheDeveloper'sNotebookSeries
NotebooksAre...
NotebooksAren't...
Organization
Preface
TheFuture:Maven2
HowThisBookIsOrganized
HowThisBookWasWritten
AboutThisBook'sWebSite
AboutThisBook'sExamples
AbouttheAuthors
ConventionsUsedinThisBook
UsingCodeExamples
HowtoContactUs
Safari®Enabled
Acknowledgments
Chapter1.MavenJump-Start
Section1.1.InstallingMaven
Section1.2.StartingaNewProject
Section1.3.UsingMavenBehindaProxy
Section1.4.CompilingandTestingaProject
Section1.5.WorkingwiththeProjectObjectModel
Section1.6.ListingAvailableGoals
Section1.7.ProducingDebugInformation


















































































Section1.8.AddingaDependency
Section1.9.DependingonSnapshots
Section1.10.PerforminganOfflineBuild
Section1.11.UsingtheMavenConsole
Section1.12.GeneratinganEclipseProject
Section1.13.UsingtheEclipseMavenPlug-in
Section1.14.GeneratinganAntBuildFile
Section1.15.MigratingaProjectfromAnttoMaven
Section1.16.GeneratingProjectDocumentation
Section1.17.TellingMavenAboutYourTeam
Section1.18.PointingMavenatSourceControl
Section1.19.CreatingaProjectWebSite
Section1.20.CustomizingSiteReports

Chapter2.CustomizingMaven
Section2.1.InstallingaPlug-infromaRemoteRepository
Section2.2.CustomizingPlug-inBehavior
Section2.3.WritingaCustomGoal
Section2.4.DefiningapreGoal
Section2.5.DefiningCustomProperties
Section2.6.RunningtheProgramfromaCustomGoal
Section2.7.DefiningtheDefaultGoal
Section2.8.OverridingProperties
Section2.9.EnumeratingDependencies
Section2.10.CustomizingSiteLookandFeel
Section2.11.UsingtheFAQPlug-in
Chapter3.MultiprojectMaven
Section3.1.DividingandConquering
Section3.2.UsingPOMInheritance
Section3.3.WritingtheQuoteGenerator
Section3.4.SharingArtifactsThroughtheLocalMavenRepository
Section3.5.UsingtheWARPlug-in
Section3.6.UsingtheJettyPlug-intoStartaWebApplication
Section3.7.ExecutingHtmlUnitTests
Section3.8.BuildingAllSubprojectsSimultaneously
Section3.9.CreatingCustomTop-LevelGoals
Section3.10.GeneratingaMultiprojectWebSite
Chapter4.ProjectReportingandPublishing
Section4.1.ReportingonProjectContent
Section4.2.ReportingTestingStatus






































































Section4.3.ReportingonCodeBestPractices
Section4.4.ReportingonDuplicateCode
Section4.5.GeneratingaQualityDashboard
Section4.6.TrackingProjectActivity
Section4.7.TrackingProjectChanges
Section4.8.PublishingMavenArtifacts
Section4.9.AnnouncingaProjectRelease
Section4.10.ReportingProjectReleases
Section4.11.PublishingaProjectWebSite
Chapter5.TeamCollaborationwithMaven
Section5.1.SharingaMavenInstallation
Section5.2.CreatingYourOwnRemoteMavenRepository
Section5.3.SettingUpaContinuousIntegrationBuild
Section5.4.UsingBinaryDependencies
Chapter6.WritingMavenPlug-ins
Section6.1.WritingaSimpleJARExecutionPlug-in
Section6.2.InstallingaPlug-infromItsSources
Section6.3.TestingaPlug-in
Section6.4.WritingaComplexPlug-in:TheLogifier
Section6.5.WritingaLoggingAspectUsingAspectJ
Section6.6.UsingPlug-inResources
Section6.7.ImplementingtheLogifierBuildLogic
Section6.8.ExecutingtheLogifierPlug-in
Section6.9.AddingDynamicDependencies
Section6.10.WritingaPlug-inThatGeneratesReports
Section6.11.CreatinganXDocFileUsingJSL
Section6.12.PublishingaPlug-intoaRemoteRepository

AppendixA.MavenPlug-ins
SectionA.1.Plug-insReference
SectionA.2.Auto-DownloadingaPlug-in
SectionA.3.InstallingaPlug-inManually
SectionA.4.DependingonaPlug-in
Colophon
Index


Copyright©2005O'ReillyMedia,Inc.Allrightsreserved.
PrintedintheUnitedStatesofAmerica.
PublishedbyO'ReillyMedia,Inc.,1005GravensteinHighway
North,Sebastopol,CA95472.
O'Reillybooksmaybepurchasedforeducational,business,or
salespromotionaluse.Onlineeditionsarealsoavailablefor
mosttitles().Formoreinformation,
contactourcorporate/institutionalsalesdepartment:(800)
998-9938or
NutshellHandbook,theNutshellHandbooklogo,andthe
O'ReillylogoareregisteredtrademarksofO'ReillyMedia,Inc.
TheDeveloper'sNotebookseriesdesignations,Maven:A
Developer'sNotebook,thelookofalaboratorynotebook,and
relatedtradedressaretrademarksofO'ReillyMedia,Inc.
Java?andallJava-basedtrademarksandlogosaretrademarks
orregisteredtrademarksofSunMicrosystems,Inc.,inthe
UnitedStatesandothercountries.Manyofthedesignations
usedbymanufacturersandsellerstodistinguishtheirproducts
areclaimedastrademarks.Wherethosedesignationsappearin
thisbook,andO'ReillyMedia,Inc.wasawareofatrademark
claim,thedesignationshavebeenprintedincapsorinitialcaps.

Whileeveryprecautionhasbeentakeninthepreparationofthis
book,thepublisherandauthorsassumenoresponsibilityfor
errorsoromissions,orfordamagesresultingfromtheuseof
theinformationcontainedherein.


TheDeveloper'sNotebookSeries
So,you'vemanagedtopickthisbookup.Cool.Really,I'm
excitedaboutthat!Ofcourse,youmaybewonderingwhythese
bookshavetheodd-looking,collegenotebooksortofcover.I
mean,thisisO'Reilly,right?Wherearetheanimals?And,really,
doyouneedanotherseries?Couldn'tthisjustbeacookbook?
Howaboutanutshell,oroneofthosecoolhacksbooksthat
seemtobeeverywhere?Theshortansweristhatadeveloper's
notebookisnoneofthosethingsinfact,it'ssuchanimportant
ideathatwecameupwithanentirelynewlookandfeel,
completewithcover,fonts,andevensomenotesinthemargin.
Thisisallaresultoftryingtogetsomethingintoyourhands
youcanactuallyuse.
It'smystrongbeliefthatwhiletheninetieswerecharacterized
byeveryonewantingtolearneverything(Whynot?Weallhad
six-figureincomesfromdot-comcompanies),thenew
millenniumisaboutinformationpain.Peopledon'thavetime
(ortheincome)toreadthrough600-pagebooks,oftenlearning
200things,ofwhichonlyabout4applytotheircurrentjob.It
wouldbemuchnicertojustsitnearoneoftheuber-codersand
lookoverhisshoulder,wouldn'tit?Toasktheguysthatare
neck-deepinthisstuffwhytheychoseaparticularmethod,how
theyperformedthisonetrickytask,orhowtheyavoidedthat
threadingissuewhenworkingwithpipedstreams.Thethinking

hasalwaysbeenthatbookscan'tservethatparticularneedthey
caninform,andletyoudecide,butultimatelyacoder'smind
wassomethingthatcouldn'treallybecapturedonapieceof
paper.
Thisseriessaysthatassumptionispatentlywrongandweaim
toproveit.
ADeveloper'sNotebookisjustwhatitclaimstobe:theoftenfranticscribblingandnotesthatatrue-bluealphageekmentally


makeswhenworkingwithanewlanguage,API,orproject.It's
theno-nonsensecodethatsolvesproblems,strippedofpagefillingcommentarythatoftenservesmoreasapaperweight
thananepiphany.It'shackery,focusednotonwhatisniftyor
mightbefuntodowhenyou'vegotsomefreetime(when'sthe
lasttimethathappened?),butonwhatyouneedtosimply
"makeitwork."Thisisn'talecture,folksit'salab.Ifyouwanta
lotofconcept,architecture,andUMLdiagrams,I'llhappilyand
proudlypointyoutoouranimalandnutshellbooks.Ifyouwant
everyanswertoeveryproblemunderthesun,ouromnibus
cookbooksarekiller.Andifyouareintoarcaneandoftenquirky
usesoftechnology,hacksbookssimplyrock.Butifyou'rea
coder,downtoyourcore,andyoujustwanttogetonwithit,
thenyouwantaDeveloper'sNotebook.Coffeestainsandall,
thisisfromthemindofadevelopertoyours,barelyeven
cleanedupenoughforprint.Ihopeyouenjoyit...wesurehada
goodtimewritingthem.


NotebooksAre...

Example-drivenguides

Asyou'llseeintheOrganizationsection,developer's
notebooksarebuiltentirelyaroundexamplecode.You'llsee
codeonnearlyeverypage,andit'scodethatdoes
somethingnottrivial"HelloWorld!"programsthataren't
worthmorethanthepaperthey'reprintedon.

Aimedatdevelopers
Everreadabookthatseemstobeaimedatpointy-haired
bosses,filledwithbuzzwords,andfeelsmorelikea
marketingmanifestothanaprogrammingtext?Wehave
tooandthesebooksaretheantithesisofthat.Infact,a
goodnotebookisincomprehensibletosomeonewhocan't
program(don'tsaywedidn'twarnyou!),andthat'sjustthe
wayit'ssupposedtobe.Butfordevelopers...it'sasgoodas
itgets.

Actuallyenjoyabletoworkthrough
Doyoureallyhavetimetositaroundreadingsomething
thatisn'tanyfun?Ifyoudo,thenmaybeyou'reinto
thousand-pagelanguagereferencesbutifyou'relikethe
restofus,notebooksareamuchbetterfit.Practicalcode
samples,tersedialoguecenteredaroundpractical
examples,andevensomehumorhereandtheretheseare
theingredientsofagooddeveloper'snotebook.


Aboutdoing,nottalkingaboutdoing
Ifyouwanttoreadabooklateatnightwithoutacomputer
nearby,thesebooksmightnotbethatuseful.Theintentis
thatyou'recodingasyougoalong,kneedeepinbytecode.

Forthatreason,notebookstalkcode,code,code.Fireup
youreditorbeforediggingin.


NotebooksAren't...

Lectures
Wedon'tletjustanyonewriteadeveloper'snotebookyou've
gottobeabonafideprogrammer,andpreferablyonewho
staysupalittletoolatecoding.Whilefull-timewriters,
academics,andtheoristsaregreatinsomeareas,these
booksareaboutprogramminginthetrenches,andarefilled
withinstruction,notlecture.

Filledwithconceptualdrawingsandclasshierarchies
Thisisn'tanutshell(there,wesaidit).Youwon'tfind100pageindiceswitheverymethodlisted,andyouwon'tsee
full-pageUMLdiagramswithmethods,inheritancetrees,
andflowcharts.Whatyouwillfindispageafterpageof
sourcecode.Areyoustartingtosensearecurringtheme?

Longonexplanation,lightonapplication
Itseemsthatmanyprogrammingbooksthesedayshave
three,four,ormorechaptersbeforeyouevenseeany
workingcode.I'mnotsurewhohasauthorsconvincedthat
it'sgoodtokeepareaderwaitingthislong,butit'snot
anybodyworkingonthisseries.Webelievethatifyou're
notcodingwithin10pages,something'swrong.These
booksarealsochock-fullofpracticalapplication,takingyou
fromanexampleinabooktoputtingthingstoworkon
yourjob,asquicklyaspossible.



Organization
Developer'sNotebookstrytocommunicatedifferentinformation
thanmostbooks,andasaresult,areorganizeddifferently.
Theydoindeedhavechapters,butthat'saboutasfarasthe
similaritybetweenanotebookandatraditionalprogramming
bookgoes.First,you'llfindthatalltheheadingsineachchapter
areorganizedaroundaspecifictask.You'llnotethatwesaid
task,notconcept.That'soneoftheimportantthingstoget
aboutthesebookstheyarefirstandforemostaboutdoing
something.Eachoftheseheadingsrepresentsasinglelab.A
labisjustwhatitsoundslikestepstoaccomplishaspecificgoal.
Infact,that'sthefirstheadingyou'llseeundereachlab:"How
doIdothat?"Thisisthecentralquestionofeachlab,andyou'll
findlotsofdown-and-dirtycodeanddetailinthesesections.
Somelabshavesomethingsnottodo(everplayedaroundwith
potassiuminhighschoolchemistry?),helpingyouavoid
commonpitfalls.Somelabsgiveyouagoodreasonforcaring
aboutthetopicinthefirstplace;wecallthisthe"WhydoI
care?"section,forobviousreasons.Forthosetimeswhencode
samplesdon'tclearlycommunicatewhat'sgoingon,you'llfind
a"Whatjusthappened"section.It'sinthesesectionsthatyou'll
findconceptsandtheorybuteventhen,theyaretightlyfocused
onthetaskathand,notexplanationforthesakeofpagecount.
Finally,manylabsofferalternatives,andaddresscommon
questionsaboutdifferentapproachestosimilarproblems.These
arethe"Whatabout..."sections,whichwillhelpgiveeachtask
somecontextwithintheprogrammingbigpicture.
Andonelastthingonmanypages,you'llfindnotesscrawledin

themarginsofthepage.Thesearen'tfordecoration;they
containtips,tricks,insightsfromthedevelopersofaproduct,
andsometimesevenalittlehumor,justtokeepyougoing.
Thesenotesrepresentpartoftheoverallcommunication
flowgettingyouasclosetoreadingthemindofthedeveloper-


authoraswecan.Hopefullythey'llgetyouthatmuchcloserto
feelinglikeyouareindeedlearningfromamaster.
Andmostofall,rememberthesebooksare...
AllLab,NoLecture
BrettMcLaughlin,SeriesCreator


Preface
WhatisMaven?TheMavenwebsite()
statesthefollowing:
Mavenisasoftwareprojectmanagementand
comprehensiontool.BasedontheconceptofaProject
ObjectModel(POM),Mavencanmanageaproject'sbuild,
reporting,anddocumentationfromacentralpieceof
information.
WhilethiscapturestheideaofMaven,itdoesn'treallyexplain
whatMavenisabout.Here'sanotherattempt:Mavenprovidesa
richdevelopmentinfrastructure(compilation,testing,reporting,
collaboration,anddocumentation)fromasimpledescriptionof
anyJavaproject.Itisaneasywaytobuildaprojectwithout
havingtobuildabuildsystem.
Mavenstartedasanattempttosimplifyandstandardizethe
complex,Ant-basedbuildprocessusedforJakartaTurbine.As

thebuildsystembecamemorebaroqueandtheTurbineproject
splitintosmaller,morefocusedcomponents,aneedemerged
foratooltodescribeeachsubprojectandmanage
dependencies.ThecomplexityofthismultiprojectAntbuild
createdanidealenvironmentforanewprojectmanagement
system,andMaven1istheproductofthisnaturalevolution.
Mavenisfrequentlycomparedtothecurrentbuildtoolof
choiceApacheAnt.And,whileMavenistheclearsuccessorto
buildsystemsbuiltaroundApacheAnt,suchastatementtends
tocausesomecontroversy...Maven1reusesanumberofAnt
tasks,andwhenyoucustomizeaMaven1build,youwillendup
usingthetoolsthatAntprovides.Mavenisonahigher
conceptuallevelthanAnt;whereAntprovidestoolssuchas
mkdirandcopy,Mavenisabuildcontainerwhichprovidesa
commonbuildprocessadevelopmentinfrastructure.


Mavencapturesbestpracticesandcodifiesacommonbuild
processinawaythatcanbesharedacrossallprojects.When
you"mavenize"aproject,youcreateaprojectdescriptorwhich
describesthecontentandformofaproject.Thisdescriptionis
thenusedbycommonplug-inswhichcompile,test,package,
anddeployprojectartifacts.Inotherwords,youpointMavenat
yourproblem,andittakescareofthesolution;youtellMaven
whereyoursourcecoderesides,andittakescareofthe
compilationwithlittleinterferencefromyou.YoutellMavento
createaWARfileorcreateaJUnitreport,anditretrievesthe
necessarylibrariesautomatically.Mavenispartautomation,
partbuildprocess,andpartprojectdescription.Ifyouareusing
Mavenproperly,you'llfindyourselfspendinglesstimeworking

onyourproject'sbuildsystemandmoretimeworkingonyour
project'scode.
JustasMavenwasinspiredbytheneedsoftheJakartaTurbine
project,JakartaAntwasinitiallycreatedasapartoftheJakarta
Tomcatproject.Antspreadlikewildfireoncepeoplerealizedit
hadthepotentialtosimplifyprojectbuilds.Here'saquotefrom
theApacheAntFAQ(aboutthe
spreadofAntin1999-2000:
Soonthereafter,severalopensourceJavaprojects
realizedthatAntcouldsolvetheproblemstheyhadwith
Makefiles.StartingwiththeprojectshostedatJakartaand
theoldJavaApacheproject,Antspreadlikeavirusandis
nowthebuildtoolofchoiceforalotofprojects.
WhenAntwasintroduced,itrevolutionizedthecommunity;Ant
wentfromanoveltytoanindispensableutilityinthecourseof
ayear.Mavenisexperiencingasimilartransitionpointas
developersstarttoseehowmucheasieritistodevelopwitha
projectmanagementtool.

Note:PeopleusedtouseMakefilesforJava?!Yes,andit


wasn'tpretty.


TheFuture:Maven2
Atthetimeofthiswriting,theinitialtechnologypreviewfor
Maven2isavailablefromtheMavenwebsite
().AlthoughMaven2shareslotsof
conceptswithMaven1,itisacompleterewrite,andbuilds

createdforMaven1willnotbecompatiblewithMaven2.Maven
1plug-inswillnotbedirectlycompatiblewithMaven2plug-ins,
andJellyhasbeenabandonedasacorescriptinglanguage.
Therewillbemigrationpaths,though.Thisbookispeppered
withreferencestoMaven2andhowMaven2differsfrom
Maven1.NewfeaturesinMaven2include:
Performance

Fewerdependencies
Maven'scoredropsthedependencyonJellyandAnt.

Embeddable
Maven2isdesignedtobeembeddedinothertools.

LessJelly,moreJava
WritingmorelogicinJavawillmeanfasterexecution.
Lifecyclemechanismanddefinition


Definedlifecycle
Maven2definesaproject'slifecycle,andplug-inshook
ontoaparticularpartofthatlifecycle.Insteadof
definingpreGoals,postGoals,orprereqs,plug-instell
Mavenwheretheyfitintothedefinedlifecycle.

Multiprojectaware
Mavenwillworkwithmultipleprojectsbydefault,andit
willbeeasiertocreatemultiprojectbuilds.
Dependencymanagement


Repositoryimprovements
Maven2willsupportanew,more-scaleablerepository
layout(explainedinSection1.1).

Snapshots
ThemechanismforobtainingSNAPSHOTdependencies
willbemoreconfigurable.Youwillbeabletoconfigure
howoftenMavenchecksforanewsnapshot.

Transitivedependencies
Maven2willallowyoutodependonadependency's
dependencies...confusing?IfprojectAdependson
artifactB,whichinturndependsonartifactC,Maven
2'stransitivedependencymanagementwill


automaticallyretrieveandincludeartifactCinproject
A'sdependencies.
Customizationandplug-ins

Nopropertiesfilesormaven.xmlfiles
BehaviorisnowcustomizedinthePOM,whichwillbe
storedinpom.xml.

NoJellyscript
Jellyscriptwillnolongerbethecorescriptinglanguage
forgoalsandplug-ins.Forperformancereasons,plug-in
developerswillbeencouragedtowriteplug-insinJava.
SupportforscriptinglanguagessuchasGroovyand
Marmaladewillbeavailable.AJellybridgewillbe

availableinMarmaladetoeasilyportexistingMaven1
buildstoMaven2.
Manydevelopersandbusinessestendtowaitanywherefroma
fewmonthstoafewyearstoadoptanewproject,andMaven1
willremaininuseforalongtimeasthefeaturesetofMaven2
issolidifiedandMaven2hastimetoproveitself.Afinalrelease
ofMaven2shouldbeavailableinAugustorSeptemberof2005,
andplug-inswillbeportedtoMaven2asdevelopersmoveto
the2.0release.Pleasenotethattheprevioussentencewasan
estimate;providingasoliddateforthereleaseofasoftware
projectisanimpossiblefeat,butbasedonprogressatthetime
ofthiswriting,Maven2iswellwithinreach.


HowThisBookIsOrganized
Thisbookisahybridofstyles.Itisbothalinearprogressionof
ideaswhichwillaccelerateyourintroductiontoMaven,anda
collectionofindependentchaptersandlabstobeusedasa
reference.IfyouarealreadyfamiliarwithMaven,youmaywant
toskimChapters1and2beforereadingtherestofthisbook,
asChapters1and2introduceMaven1inthecontextofthe
upcomingMaven2release.IfyouarenewtoMaven,readthe
firstchapter,beforeyoumoveontothemore-advancedMaven
topicsinChapters3through6.
Thecontentofthisbookisorganizedintochapterswhich
consistofaseriesoflabsorexercises.Withinachapter,each
exercisebuildsuponthepreviousexercises.Thebookcontains
thefollowingchapters:

Chapter1

GetsyouupandrunningwithMaveninlessthananhour.If
youarenewtoMaven,readthischapterfirst,asitlaysthe
foundationforthefollowingchapters.

Chapter2
WhileMavenprovidesdefaultbehaviorsufficientforalmost
anyproject,therewillbeasituationthatcallsfor
customizationofthebuildprocess.Thischapter
demonstratesthecreationofcustomgoals,preGoalsand
postGoals,andtheuseofJellyscriptandpropertiesfilesto
customizethebehaviorofMaven.


Chapter3
Thisseriesoflabswillteachyouhowtobreakacomplex
projectintoaseriesofsmaller,relatedsubprojects.Maven
canbeusedtomanagethedependenciesbetweenasetof
projects,andyouwillseehowMavencanbeusedto
separateawebapplicationintomultipleprojects.

Chapter4
Mavenplug-insprovideaseriesofreportswhichprovidea
usefulsetofmetricsforanyproject.Thischapter
demonstratestheuseofreportstoreportoncodequality,
unittests,codeduplication,andprojectactivity.This
chapteralsodemonstrateshowyoucanuseMavento
publishanddeployprojectartifacts.

Chapter5
IntroducesaprocessforsharingaMaveninstallationand

creatingacustomremoterepositoryforyourteam.The
bulkofthischaptershowsyouhowtouseMaventosetup
acontinuousintegrationenvironmentusingCruiseControl.

Chapter6
ShowsyouhowtobuildbothsimpleandcomplexMaven
plug-ins.AsimpleJARexecutionplug-inisdeveloped,anda
plug-ininvolvingAspect-orientedprogrammingis
introduced.


AppendixA
ListsalloftheMavenplug-insusedinthisbook,andit
providesinstructionsforinstallingplug-insnotbundledwith
Maven1.0.2.


HowThisBookWasWritten
ThisbookisaresultofcollaborationbetweenVincentMassol
andTimO'Brien.VincentdrovetheadvancedMavencontent,
suchasthechaptersdealingwithmultiprojectbuildsand
customplug-ins,andTimwrotetheintroductorymaterialfound
inChapters1and2.
BookcontentwasdevelopedusingMicrosoftWordfilesstoredin
aSubversionrepository.Apreliminaryoutlinewasdeveloped
usingAtlassian'sConfluencewiki,andsimpletasklistswere
maintainedusingAtlassian'sJIRAissuetracker.


AboutThisBook'sWebSite

Thisbookissupplementedbyaweb
sitewhichcontainsupdatesand
informationaboutthisbookandaboutMaven.Thewebsitewill
haveadditionalsampleapplicationsandanaggregationof
Maven-relatedblogswhichyouwillfindhelpfulasyoufollow
thisbookandwanttolearnmoreaboutMaven.
Youmaycheckouterrata,viewrelatedresourcesandonline
articles,andseethelatestonthisbook,at
and
Checkthesesites
often;lotsofnewcontentmaybeavailableastimegoesbyand
weupdatetheexamples.


AboutThisBook'sExamples
YoucancheckoutthesampleMavenprojectsforthisbookfrom
aSubversionrepositorymaintainedat
Todownload
Subversionandcheckoutthecodefromtherepository,follow
theseinstructionsfromthec:\dev\mavenbookdirectoryon
Windows,orthe~/dev/mavenbookdirectoryonUnix:
1. DownloadSubversionfrom
/>2. InstallSubversionandaddsvntoyourPATH.
3. Checkoutthecodeexamplesbyexecutingthefollowing
command:

svncheckoutmavenbook

Onceyoucheckoutthisproject,youshouldhavefive
subdirectories,eachcontainingprojectsandsubprojects

relatingtoeachchapter:
/mavenbook/code
/genapp
/plugins
/qotd
/reporting
/weather

IfyoudonothaveaccesstoSubversionorwanttodownloadan
archiveofthesampleMavenprojectsfromthisbook,visitthe


MavenDeveloperNotebookpageattheO'Reillywebsiteat
oryoucanvisit
todownloadanarchive.


×