More Related Content
Similar to Enhance Maven plugins with Groovy
Similar to Enhance Maven plugins with Groovy (20)
Enhance Maven plugins with Groovy
- 1. © Computas AS 09.09.2010 Enhance your Maven plugins with Groovy (experiences with Groovyfication) Harald Søvik hso @ computas.com
- 2. Speakers Harald Søvik Java Tech Lead, M.Sc. hso@computas.com 2 © Computas AS 09.09.2010 bpmwork support systems knowledgemanagement consultancy services custom software solutions 180 employees w/ M.Sc. or Ph.D. 100% owned by employees
- 3. 3 © Computas AS 09.09.2010 Groovy OO dynamic run onjvm Java-like Java-interoperable scripting / web / jms ++
- 4. 4 © Computas AS 09.09.2010 Pro forma I’m not a Groovyexpert ! I’mfocusingon Java <> Groovy not neccessarilythevery best wayofsolving it alltogether ! Using pure Java librarieswould make a different story
- 5. 5 © Computas AS 09.09.2010 Goal Investigate home-brew enterprise Maven plugins Would Groovyfication™ affect .. Simplicity? Maintainability? Testability?
- 6. 6 © Computas AS 09.09.2010 Recipe for your Maven project add build step with gmaven-plugin add dependency to gmaven-mojo src/java vssrc/groovy .java vs.groovy compile and enjoy !
- 7. 7 © Computas AS 09.09.2010 Example 0: archetype:generate Purpose Write text to file Code generated from archetype:generate type 12 A Maven Java plugin development project Differences Exception handling Controlling flow of execution
- 8. 8 © Computas AS 09.09.2010 Example 1: plugin:goal ”help” Purpose Write text to console Differences Multi line output
- 9. 9 © Computas AS 09.09.2010 Example 2: Enterprise pluginlogic Purpose Execute external program Determine exit value Differences Exception handling Controlling flow of execution
- 10. 10 © Computas AS 09.09.2010 Example 4: Enterprise pluginlogic Purpose Checkif URL has content (~ ping) Differences Exception handling Controlling flow of execution (“debug comments”) Readability
- 11. 11 © Computas AS 09.09.2010 Example 5: DTO Purpose Internal ”entity” class Differences Constructor Constructorcall, readability Accessormethods
- 12. 12 © Computas AS 09.09.2010 Example 6: Testability Purpose Test a method converting a String with windows style path to posix-style path Differences ”Groovy set of mind” Highlight low cohesion Refactoring opportunities
- 13. 13 © Computas AS 09.09.2010 Experiences >> Task-oriented, high-level operations Testability readyness << Complex, procedural code Detailed logging, exception handling Low cohesion
- 14. Questions or comments ? 14 © Computas AS 09.09.2010 Booth B5 jobopenings for experienceddevelopers ! www.computas.com
Editor's Notes
- computasdrivert stort sett med modellering av forretningsprosesser, fagsystemer og integrasjon