enhance your maven plugins with groovy
DESCRIPTION
TRANSCRIPT
![Page 1: Enhance your Maven plugins with Groovy](https://reader033.vdocument.in/reader033/viewer/2022061110/545408c4b1af9f8c228b48f1/html5/thumbnails/1.jpg)
© Computas AS 08.04.2023
Enhance your Maven plugins with Groovy
(experiences with Groovyfication)
Harald Søvikhso @ computas.com
![Page 2: Enhance your Maven plugins with Groovy](https://reader033.vdocument.in/reader033/viewer/2022061110/545408c4b1af9f8c228b48f1/html5/thumbnails/2.jpg)
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
![Page 3: Enhance your Maven plugins with Groovy](https://reader033.vdocument.in/reader033/viewer/2022061110/545408c4b1af9f8c228b48f1/html5/thumbnails/3.jpg)
3 © Computas AS 08.04.2023
Groovy
OO
dynamic
run on jvm
Java-like
Java-interoperable
scripting / web / jms ++
![Page 4: Enhance your Maven plugins with Groovy](https://reader033.vdocument.in/reader033/viewer/2022061110/545408c4b1af9f8c228b48f1/html5/thumbnails/4.jpg)
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
![Page 5: Enhance your Maven plugins with Groovy](https://reader033.vdocument.in/reader033/viewer/2022061110/545408c4b1af9f8c228b48f1/html5/thumbnails/5.jpg)
5 © Computas AS 08.04.2023
Goal
Investigate home-brew enterprise Maven plugins
Would Groovyfication™ affect ..
Simplicity?
Maintainability?
Testability?
![Page 6: Enhance your Maven plugins with Groovy](https://reader033.vdocument.in/reader033/viewer/2022061110/545408c4b1af9f8c228b48f1/html5/thumbnails/6.jpg)
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 !
![Page 7: Enhance your Maven plugins with Groovy](https://reader033.vdocument.in/reader033/viewer/2022061110/545408c4b1af9f8c228b48f1/html5/thumbnails/7.jpg)
9 © Computas AS 08.04.2023
Example 2: Enterprise plugin logic
PurposeExecute external program
Determine exit value
DifferencesException handling
Controlling flow of execution
![Page 8: Enhance your Maven plugins with Groovy](https://reader033.vdocument.in/reader033/viewer/2022061110/545408c4b1af9f8c228b48f1/html5/thumbnails/8.jpg)
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
![Page 9: Enhance your Maven plugins with Groovy](https://reader033.vdocument.in/reader033/viewer/2022061110/545408c4b1af9f8c228b48f1/html5/thumbnails/9.jpg)
11 © Computas AS 08.04.2023
Example 5: DTO
PurposeInternal ”entity” class
DifferencesConstructor
Constructor call, readability
Accessor methods
![Page 10: Enhance your Maven plugins with Groovy](https://reader033.vdocument.in/reader033/viewer/2022061110/545408c4b1af9f8c228b48f1/html5/thumbnails/10.jpg)
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
![Page 11: Enhance your Maven plugins with Groovy](https://reader033.vdocument.in/reader033/viewer/2022061110/545408c4b1af9f8c228b48f1/html5/thumbnails/11.jpg)
13 © Computas AS 08.04.2023
Experiences
>>
Task-oriented, high-level operations
Testability readyness
<<
Complex, procedural code
Detailed logging, exception handling
Low cohesion
![Page 12: Enhance your Maven plugins with Groovy](https://reader033.vdocument.in/reader033/viewer/2022061110/545408c4b1af9f8c228b48f1/html5/thumbnails/12.jpg)
Questions or comments ?
14 © Computas AS 08.04.2023
www.computas.com
job openings for experienced developers !
Booth B5