Fight your technical debt with Jenkins, Jacoco and Sonar

21
Get ready to fight your technical debt! Tycho, Sonar and Jacoco

description

EclipseCon 2012 slides from Xavier Seignard ( http://twitter.com/xavier_seignard ) and Mickael Istriahttp://www.eclipsecon.org/2012/sessions/get-ready-fight-your-technical-debt-tycho-sonar-and-jacoco

Transcript of Fight your technical debt with Jenkins, Jacoco and Sonar

Page 1: Fight your technical debt with Jenkins, Jacoco and Sonar

Get ready to fightyour technical debt!

Tycho, Sonar and Jacoco

Page 2: Fight your technical debt with Jenkins, Jacoco and Sonar

Xavier Seignardwww.podbox.com@xavier_seignard

Mickael IstriaJboss, by Redhat

@mickaelistria

Page 3: Fight your technical debt with Jenkins, Jacoco and Sonar

Code quality!The goal:

…StandardsCode CoverageComplexityDesignCommentsDuplicationsTests...

Page 4: Fight your technical debt with Jenkins, Jacoco and Sonar

Maintain. Use. Rely.Why is it important?

Understand. Test. Change.Learn. Adapt. Replace.

And so on.

Page 5: Fight your technical debt with Jenkins, Jacoco and Sonar

How to analyze it?Problem?

With so many bundles

Page 6: Fight your technical debt with Jenkins, Jacoco and Sonar

… reports are scatteredTools are there, but...

checkstyle, pmd, findbugs, etc.

Page 7: Fight your technical debt with Jenkins, Jacoco and Sonar

Sonar!

Solution?Unify and aggregate these reports

The last step towards code quality analysis

Page 8: Fight your technical debt with Jenkins, Jacoco and Sonar

Hands-on!From a successful Tycho build

Page 9: Fight your technical debt with Jenkins, Jacoco and Sonar

Hands-on!Put this build on Jenkins/Hudson

Page 10: Fight your technical debt with Jenkins, Jacoco and Sonar

Achievement #1 unlocked!You have a reproducible build!

Page 11: Fight your technical debt with Jenkins, Jacoco and Sonar

Hands-on!Put Sonar at work

Install Sonar plugin on Jenkins/Hudon.Configure it. Configure your build.

Page 12: Fight your technical debt with Jenkins, Jacoco and Sonar

Hands-on (ad)!Or use Dev@cloud from Cloudbees

Pain free Jenkins and Sonar.No maintenance. Ready to use.And more!

Page 13: Fight your technical debt with Jenkins, Jacoco and Sonar

Achievement #2 unlocked!Your tech debt is under control!

Page 14: Fight your technical debt with Jenkins, Jacoco and Sonar

The missing piece

Code coverageIs that part of code tested or not?

Page 15: Fight your technical debt with Jenkins, Jacoco and Sonar

Jacoco!

So what?On the fly instrumentation

The beloved jacoco agent

Page 16: Fight your technical debt with Jenkins, Jacoco and Sonar

Jacoco?As easy as setting an arg to the JVM

-Djavaagent=jacoco.jar=[option1=value1[,optionN=valueN]*]

Maven pluginSets ${tycho.testArgLine} to -Djavaagent=jacoco.jar...Pro tip: Use <appArgLine> to set other JVM args in Tycho Surefire plugin.

Page 17: Fight your technical debt with Jenkins, Jacoco and Sonar

Hands-on...

... top level pom

Page 18: Fight your technical debt with Jenkins, Jacoco and Sonar

Achievement #3 unlocked!You're ready to fight your tech debt!

Page 19: Fight your technical debt with Jenkins, Jacoco and Sonar

ThanksTo Nicolas De loof (@ndeloof) and Cloudbees for providing us a 1st class Dev@cloud instance for this demo.

Page 20: Fight your technical debt with Jenkins, Jacoco and Sonar

Resources- The base project we used: http://www.eclipse.org/recommenders/- Jenkins: https://eclipsecon2012.ci.cloudbees.com/- Sonar: https://eclipsecon2012.sonar.cloudbees.com/- The maven profile: https://gist.github.com/2212435

Some bugs you should follow- [email protected]: http://bugs.eclipse.org/360935- Jacoco@jenkins: https://issues.jenkins-ci.org/browse/JENKINS-10835

Page 21: Fight your technical debt with Jenkins, Jacoco and Sonar

Questions?

Don't forget to give your feedback:

http://www.eclipsecon.org/2012/sessions/get-ready-fight-your-technical-debt-tycho-sonar-and-jacoco