Enhance your Maven plugins with Groovy

681 views
621 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
681
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • computasdrivert stort sett med modellering av forretningsprosesser, fagsystemer og integrasjon
  • Enhance your Maven plugins with Groovy

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

    ×