enhance your maven plugins with groovy
DESCRIPTION
TRANSCRIPT
© Computas AS 08.04.2023
Enhance your Maven plugins with Groovy
(experiences with Groovyfication)
Harald Søvikhso @ computas.com
Speakers
Harald Søvik
Java Tech Lead, M.Sc.
2 © Computas AS 08.04.2023
bpm work support systems
knowledge management
consultancy services
custom software solutions
180 employees w/ M.Sc. or Ph.D.
100% owned by employees
3 © Computas AS 08.04.2023
Groovy
OO
dynamic
run on jvm
Java-like
Java-interoperable
scripting / web / jms ++
4 © Computas AS 08.04.2023
Pro forma
I’m not a Groovy expert !
I’m focusing on Java <> Groovy
not neccessarily the very best way of solving it alltogether !
Using pure Java libraries would make a different story
5 © Computas AS 08.04.2023
Goal
Investigate home-brew enterprise Maven plugins
Would Groovyfication™ affect ..
Simplicity?
Maintainability?
Testability?
6 © Computas AS 08.04.2023
Recipe for your Maven project
add build step with gmaven-plugin
add dependency to gmaven-mojo
src/java vs src/groovy
.java vs .groovy
compile and enjoy !
9 © Computas AS 08.04.2023
Example 2: Enterprise plugin logic
PurposeExecute external program
Determine exit value
DifferencesException handling
Controlling flow of execution
10 © Computas AS 08.04.2023
Example 4: Enterprise plugin logic
PurposeCheck if URL has content (~ ping)
DifferencesException handling
Controlling flow of execution (“debug comments”)
Readability
11 © Computas AS 08.04.2023
Example 5: DTO
PurposeInternal ”entity” class
DifferencesConstructor
Constructor call, readability
Accessor methods
12 © Computas AS 08.04.2023
Example 6: Testability
PurposeTest a method converting a String with windows style path to posix-style path
Differences”Groovy set of mind”
Highlight low cohesion
Refactoring opportunities
13 © Computas AS 08.04.2023
Experiences
>>
Task-oriented, high-level operations
Testability readyness
<<
Complex, procedural code
Detailed logging, exception handling
Low cohesion
Questions or comments ?
14 © Computas AS 08.04.2023
www.computas.com
job openings for experienced developers !
Booth B5