Automating Software Development Processes

28
Automating Software Automating Software Development Processes Development Processes dott. michele bianchi dott. michele bianchi [email protected] [email protected]

description

Automating Software Development Processes with support of build tools and continuous integration. A brief presentation of maven2, hudson and archiva

Transcript of Automating Software Development Processes

Page 1: Automating Software Development Processes

Automating Software Automating Software Development ProcessesDevelopment Processes

dott. michele bianchidott. michele [email protected]@openinnovation.it

Page 2: Automating Software Development Processes

automating software development processes - michele bianchiautomating software development processes - michele bianchi

Goal Goal

Deliver tangible, working software Deliver tangible, working software repeatedly in a timely mannerrepeatedly in a timely manner

Report Report accurate informationaccurate information

to the key roles of the project:to the key roles of the project:

clients, managers, developers, sponsorsclients, managers, developers, sponsors

Page 3: Automating Software Development Processes

automating software development processes - michele bianchiautomating software development processes - michele bianchi

Software BuildSoftware Build

● Make the build a repeatable processMake the build a repeatable process● Machine independentMachine independent● Temporal changesTemporal changes● Software versionsSoftware versions

● Build processesBuild processes● Build:Build: compile, package, link, parse, ... generate compile, package, link, parse, ... generate

the the artifactartifact● Test:Test: unit, system, integration, functional, UAT unit, system, integration, functional, UAT● Deploy:Deploy: testbed, stage, production testbed, stage, production

Page 4: Automating Software Development Processes

automating software development processes - michele bianchiautomating software development processes - michele bianchi

Part I: toolsPart I: tools

Page 5: Automating Software Development Processes

automating software development processes - michele bianchiautomating software development processes - michele bianchi

Maven2Maven2

ReferencesReferences

http://maven.apache.orghttp://maven.apache.org

http://www.mergere.comhttp://www.mergere.com

Free Maven2 Book: "Better Builds with Maven"Free Maven2 Book: "Better Builds with Maven"

Page 6: Automating Software Development Processes

automating software development processes - michele bianchiautomating software development processes - michele bianchi

POM & ArtifactPOM & Artifact

● Fundamental unit of workFundamental unit of work● Declarative project configuration: Declarative project configuration: pom.xmlpom.xml

– name, desc, scm, devels, deps, build reqs...name, desc, scm, devels, deps, build reqs...

● Resulting file is called an Resulting file is called an artifactartifact● Types: jar, war, ejb, pom, ...Types: jar, war, ejb, pom, ...

<project><project> <modelVersion>4.0.0</modelVersion><modelVersion>4.0.0</modelVersion> <groupId>openinnovation.it</groupId><groupId>openinnovation.it</groupId> <artifactId>poc-server</artifactId><artifactId>poc-server</artifactId> <version>1.0-SNAPSHOT</version><version>1.0-SNAPSHOT</version> <name>My POC webapplication</name><name>My POC webapplication</name> <packaging>war</packaging><packaging>war</packaging></project></project>

Page 7: Automating Software Development Processes

automating software development processes - michele bianchiautomating software development processes - michele bianchi

Conventions vs ConfigurationConventions vs Configuration

Application/Library sourcesApplication/Library sources

Application/Library resourcesApplication/Library resources

Resource filter filesResource filter files

Assembly descriptorsAssembly descriptors

Configuration filesConfiguration files

Web application sourcesWeb application sources

Test sourcesTest sources

Test resourcesTest resources

Test resource filter filesTest resource filter files

SiteSite

src/main/javasrc/main/java

src/main/resourcessrc/main/resources

src/main/filterssrc/main/filters

src/main/assemblysrc/main/assembly

src/main/configsrc/main/config

src/main/webappsrc/main/webapp

src/test/javasrc/test/java

src/test/resourcessrc/test/resources

src/test/filterssrc/test/filters

src/sitesrc/site

Page 8: Automating Software Development Processes

automating software development processes - michele bianchiautomating software development processes - michele bianchi

DependenciesDependencies

● Transitive dependenciesTransitive dependencies● Don't need to declare dependencies of depsDon't need to declare dependencies of deps● Version conflictsVersion conflicts

● ScopeScope● compile, runtime, test, system, providedcompile, runtime, test, system, provided

● Snapshot handlingSnapshot handling● Updates daily, without the need to update and Updates daily, without the need to update and

buildbuild

Page 9: Automating Software Development Processes

automating software development processes - michele bianchiautomating software development processes - michele bianchi

Simple dependencies graphSimple dependencies graph

Page 10: Automating Software Development Processes

automating software development processes - michele bianchiautomating software development processes - michele bianchi

RepositoryRepository

● Where all the artifacts are storedWhere all the artifacts are stored● Local repository refers to a cache of artifacts used Local repository refers to a cache of artifacts used

on local machineon local machine● Remote repository refers to a source of Remote repository refers to a source of

artifacts, available over file:, http:, etc.artifacts, available over file:, http:, etc.

● Central repositoryCentral repository● contains popular redistributable artifactscontains popular redistributable artifacts

● Local repositoryLocal repository● mirror or proxy to centralmirror or proxy to central● to deploy your own artifacts internallyto deploy your own artifacts internally

● http://www.mvnrepository.comhttp://www.mvnrepository.com

Page 11: Automating Software Development Processes

automating software development processes - michele bianchiautomating software development processes - michele bianchi

Phases: build life cyclePhases: build life cycle

● The standard goals for building:The standard goals for building:● compile & testcompile & test - compile and test the code - compile and test the code● packagepackage – build and test the artifact – build and test the artifact● installinstall – package the artifact and install to local – package the artifact and install to local

repositoryrepository● deploydeploy – package the artifact and copy to the – package the artifact and copy to the

remote repository (release time)remote repository (release time)

● Release ManagementRelease Management

Page 12: Automating Software Development Processes

automating software development processes - michele bianchiautomating software development processes - michele bianchi

Modules & ProfilesModules & Profiles

● ModulesModules– api, spi, webapp, ejb, ...api, spi, webapp, ejb, ...

● ProfilesProfiles– Change the build depending on the Change the build depending on the

environmentenvironment– Per user or per projectPer user or per project– Used to set up standard environments: Used to set up standard environments:

Development, Test, QA and ProductionDevelopment, Test, QA and Production

Page 13: Automating Software Development Processes

automating software development processes - michele bianchiautomating software development processes - michele bianchi

Maven PluginsMaven Plugins

● Plugins augments the build life cyclePlugins augments the build life cycle● Seamless integration via repositorySeamless integration via repository● Integrate with many tools: Integrate with many tools:

– cargo, jaxme, castor, crap4j, sql, hibernate, cargo, jaxme, castor, crap4j, sql, hibernate, webstart, jasper, jruby, batik, argo, j2me, webstart, jasper, jruby, batik, argo, j2me, weblogic, emma, selenium, rmic, jira, trac, weblogic, emma, selenium, rmic, jira, trac, wiki...wiki...

– http://mojo.codehaus.orghttp://mojo.codehaus.org, ..., ...

Page 14: Automating Software Development Processes

automating software development processes - michele bianchiautomating software development processes - michele bianchi

ReportsReports

● Centralise your project information and Centralise your project information and documentation for developers and their documentation for developers and their managersmanagers

● Integrate project information such as Integrate project information such as source code, inspection reports, etc.source code, inspection reports, etc.

● Reports are used to show the state of the projectReports are used to show the state of the project● Can be integrated with little to no configuration on Can be integrated with little to no configuration on

an existing projectan existing project● Test coverage (eg. Clover), test results, code style Test coverage (eg. Clover), test results, code style

(eg Checkstyle, PMD), and many more(eg Checkstyle, PMD), and many more

Page 15: Automating Software Development Processes

automating software development processes - michele bianchiautomating software development processes - michele bianchi

IDE integrationIDE integration

● Maven plugins: generate and update IDE Maven plugins: generate and update IDE configurationconfiguration– Eclipse, Netbeans, IdeaEclipse, Netbeans, Idea

● IDE plugins:IDE plugins:– Eclipse: m2eclipse, m4eclipseEclipse: m2eclipse, m4eclipse– Netbeans: mevenideNetbeans: mevenide

Page 16: Automating Software Development Processes

automating software development processes - michele bianchiautomating software development processes - michele bianchi

HudsonHudson

References:References:

https://hudson.dev.java.net/https://hudson.dev.java.net/

http://juggenova.net/2007/10/19/continuous-integration-http://juggenova.net/2007/10/19/continuous-integration-with-hudson/with-hudson/

Page 17: Automating Software Development Processes

automating software development processes - michele bianchiautomating software development processes - michele bianchi

Hudson FeaturesHudson Features

● Continuous Integration serverContinuous Integration server● ØØ installation time: installation time: java -jar hudson.warjava -jar hudson.war● Distributed env via JWSDistributed env via JWS● Security: disabled, internal, externalSecurity: disabled, internal, external● Supported build: Maven, Ant, Shell, MS, ...Supported build: Maven, Ant, Shell, MS, ...● Publishing of artifacts and reportsPublishing of artifacts and reports

Page 18: Automating Software Development Processes

automating software development processes - michele bianchiautomating software development processes - michele bianchi

Hudson Plugins (>100)Hudson Plugins (>100)

● Reports:Reports:– Task scanner, PMD, FindBugs, Violations, Task scanner, PMD, FindBugs, Violations,

cobertura, emma, japex..cobertura, emma, japex..

● Release:Release:– SCP, Deploy, Promoted, Subversion, SCP, Deploy, Promoted, Subversion,

StarTeam, Vmware, StarTeam, Vmware,

● Varia (and more)Varia (and more)– ViewVC, gant, jira, email, jabber, plot, trac, ViewVC, gant, jira, email, jabber, plot, trac,

Google calendar, CI gameGoogle calendar, CI game

Page 19: Automating Software Development Processes

automating software development processes - michele bianchiautomating software development processes - michele bianchi

Hudson BenefitsHudson Benefits

● Build on a clean machine and minimize Build on a clean machine and minimize integration effortintegration effort

● Every commit triggers a buildEvery commit triggers a build● Cron buildsCron builds● Dev, Nightly, Milestone buildsDev, Nightly, Milestone builds

● Monitor trends and QA:Monitor trends and QA:– Unit test, coverageUnit test, coverage– Metrics: checkstyle, PMD, CPD, crapMetrics: checkstyle, PMD, CPD, crap

Page 20: Automating Software Development Processes

automating software development processes - michele bianchiautomating software development processes - michele bianchi

Continuous IntegrationContinuous Integration

Page 21: Automating Software Development Processes

automating software development processes - michele bianchiautomating software development processes - michele bianchi

ArchivaArchiva

References:References:

http://archiva.apache.orghttp://archiva.apache.org

Page 22: Automating Software Development Processes

automating software development processes - michele bianchiautomating software development processes - michele bianchi

Artifact Repository ManagerArtifact Repository Manager

– Artifact SearchArtifact Search– Remote Proxying CacheRemote Proxying Cache– Artifact UploadArtifact Upload– Graphical AdministrationGraphical Administration– Virtual RepositoriesVirtual Repositories– RSS FeedsRSS Feeds– Role-based SecurityRole-based Security– Integrity ReportsIntegrity Reports– MaintenanceMaintenance

Page 23: Automating Software Development Processes

automating software development processes - michele bianchiautomating software development processes - michele bianchi

Conclusion: Conclusion: which tools?which tools?

A process or a tool is not A process or a tool is not a substitute of your brain.a substitute of your brain.

Smart and skilled people Smart and skilled people with the right toolswith the right tools

make the differencemake the difference

Page 24: Automating Software Development Processes

automating software development processes - michele bianchiautomating software development processes - michele bianchi

Part II: excercisePart II: excercise

Page 25: Automating Software Development Processes

automating software development processes - michele bianchiautomating software development processes - michele bianchi

Mavenize your projectMavenize your project

● Identify components: jar, war, (ejb, ...)Identify components: jar, war, (ejb, ...)● Move to structure conventionsMove to structure conventions● Create parent/module pomCreate parent/module pom● Test, Install and Site generationTest, Install and Site generation● Run in-place containerRun in-place container● Import IDEImport IDE● Assembly (or exec)Assembly (or exec)● ReleaseRelease

Page 26: Automating Software Development Processes

automating software development processes - michele bianchiautomating software development processes - michele bianchi

Look at POMsLook at POMs

● Parent:Parent:– SCM, CI, Issue-tracking, DevelopersSCM, CI, Issue-tracking, Developers– dependencies-managementdependencies-management– plugins-repositoriesplugins-repositories

● ModuleModule– Inherit parentInherit parent– Plugins: surefire, jetty, assembly, ...Plugins: surefire, jetty, assembly, ...– Dependencies (no version/exclusions)Dependencies (no version/exclusions)

Page 27: Automating Software Development Processes

automating software development processes - michele bianchiautomating software development processes - michele bianchi

HintsHints

● Follow conventionsFollow conventions● Split modules laterSplit modules later● Tune dependenciesTune dependencies● Write tests and enforce CIWrite tests and enforce CI● Focus on deliverablesFocus on deliverables

Page 28: Automating Software Development Processes

automating software development processes - michele bianchiautomating software development processes - michele bianchi

Q&AQ&A

dott. michele bianchidott. michele [email protected]@openinnovation.it