• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
GR8Conf 2011: Groovy Maven Builds
 

GR8Conf 2011: Groovy Maven Builds

on

  • 1,247 views

 

Statistics

Views

Total Views
1,247
Views on SlideShare
1,247
Embed Views
0

Actions

Likes
0
Downloads
0
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    GR8Conf 2011: Groovy Maven Builds GR8Conf 2011: Groovy Maven Builds Presentation Transcript

    • Groovy Maven BuildsEvgeny Goldin Thomson Reuters @evgeny_goldin 11
    • Evgeny GoldinSoftware Developer – 11 yearsDev : C++ => Perl => Java => Groovy / ScalaCM : Ant => Maven => GradleOS : Artifactory, TeamCity, JenkinsWrite for GroovyMag and Methods & ToolsMaven plugins, GCommons library 22
    • OpenCalais by Thomson Reuters http://www.opencalais.com/ http://viewer.opencalais.com/ 33
    • Maven state of affairs:Maven is rarely used to its fullest potential“maven-antrun-plugin” is terribly overusedPlugins development is limited http://maven.apache.org/plugins http://mojo.codehaus.org/plugins.html 44
    • About this session:Maven can be made better! .. especially when you use GroovyWe’ll see how: GMaven Polyglot Maven Groovy MOJOs + Demo 55
    • Groovy is a new Perl. 66
    • Maven and Gradle 77
    • Gradle - dynamic build applications.Maven - repeatable build processes. 88
    • Maven makes it awkward to ..“if” a model composition / plugin executionSpecify dynamic value when configuring a pluginPut your own logic in POMModify existing plugins behaviorPass in-memory information between plugins 99
    • Is the game over?Or can builds become applications? 1010
    • Use case – Build Metadata 1111
    • Ant: ~60 LOC(100 total) 3 files 1212 http://goo.gl/i0ldH
    • Groovy: ~10 LOC(30 total) 1313 http://goo.gl/GdS6y
    • Compiles Groovy codeExecutes Groovy codeGenerates Java Stubs (required for MOJOs)http://delicious.com/evgenyg/gmaven 1414
    • <goal>execute</goal>Runs Groovy codeRuns Groovy scriptRuns Groovy class 1515
    • Get IDEsupport back! 1616 http://goo.gl/8DOe2
    • <goal>execute</goal>Runs Groovy codeRuns Groovy scriptRuns Groovy classMavenProjectMavenSessionMaven’s “ServletContext” 1717
    • MavenProject – Static Infohttp://goo.gl/3Ve31CoordinatesPropertiesArtifactsDependenciesBasedirRemote repositories 1818
    • MavenSession – Runtime Infohttp://goo.gl/Kh8iLCurrent MavenProjectBuild start timeUser propertiesSystem propertiesGoalsLocal repository 1919
    • GMaven“if” a model composition / plugin executionSpecify dynamic value when configuring a pluginPut your own logic in POMModify existing plugins behaviorPass in-memory information between plugins 2020
    • Use case – Build Metadata 2121
    • http://evgeny-goldin.com/wiki/Maven-about-plugin<plugin> <groupId>com.goldin.plugins</groupId> <artifactId>maven-about-plugin</artifactId> <version>0.2.3</version></plugin> 2222
    • something.jar/META-INF/about.txt 2323
    • 2424
    • 2525
    • Polyglot Mavenhttps://docs.sonatype.org/display/PMAVEN/https://github.com/sonatype/polyglot-mavengit clone + mvn clean installtranslate pom.xml pom.groovy 2626
    • 2727http://goo.gl/U5eqr
    • 2828http://goo.gl/av0Dx
    • Polyglot MavenGroovy syntactic sugar to Maven POMCouldn’t find a way to Attach a code to a lifecycle Locate MavenProject and MavenSession 2929
    • Polyglot Maven“if” a model composition / plugin executionSpecify dynamic value when configuring a pluginPut your own logic in POM“validate” phase 3030
    • Groovy MOJOsReusableMore exposure to Maven runtime environmenthttp://delicious.com/evgenyg/mojo 3131
    • Use case – Duplicates 3232 http://goo.gl/ZFRvp
    • https://github.com/evgeny-goldin/gmaven-samples  Duplicates Finderhttp://www.flickr.com/photos/rohdesign/3534506648/ (rohdesign.com) 3333
    • http://evgeny-goldin.com/wiki/Duplicates-finder-plugin <plugin> <groupId>com.goldin.plugins</groupId> <artifactId>duplicates-finder-plugin</artifactId> <version>0.2.3</version> </plugin> 3434
    • Maven PluginsDuplicates found in:-=-= [org.codehaus.plexus:plexus-classworlds:jar:2.2.2:compile, classworlds:classworlds:jar:1.1:compile] =-=--=-= [commons-logging:commons-logging-api:jar:1.1:compile, commons-logging:commons-logging:jar:1.1.1:compile] =-=--=-= [nekohtml:xercesMinimal:jar:1.9.6.2:compile, xerces:xercesImpl:jar:2.8.1:compile] =-=--=-= [nekohtml:nekohtml:jar:1.9.6.2:compile, net.sourceforge.nekohtml:nekohtml:jar:1.9.9:compile] =-=--=-= [commons-beanutils:commons-beanutils:jar:1.8.0:compile, commons-collections:commons-collections:jar:3.2.1:compile] =-=- Google GuiceDuplicates found in:-=-= [com.google.inject:guice:jar:3.0-SNAPSHOT:compile, com.google.inject:guice:jar:no_deps:3.0-SNAPSHOT:compile] =-=- 3535
    • Groovy MOJOsA Groovy class + @AnnoMojo 3636
    • Groovy MOJOsA Groovy class + @AnnoMojoDynamic properties 3737 http://goo.gl/UqBqn
    • Groovy MOJOsA Groovy class + @AnnoMojoDynamic properties 3838 http://goo.gl/UqBqn
    • Groovy MOJOsA Groovy class + @AnnoMojoDynamic properties 3939 http://goo.gl/xV73v
    • Groovy MOJOsA Groovy class + @AnnoMojoDynamic propertiesNew Maven properties 4040 http://goo.gl/tEgQa
    • Groovy MOJOsOther plugins can be extended or invokedTheir initialization though, may not work wellhttp://github.com/TimMoore/mojo-executor 4141 http://goo.gl/tEgQa
    • mojo-executor 4242 http://goo.gl/CT6AQ
    • Groovy MOJOsA Groovy class + @AnnoMojoDynamic propertiesNew Maven propertiesOther plugins can be extended or invokedThat’s how you deal with Maven! 4343
    • Maven 3 vs. Maven 2IE9 vs. IE6Maven 3: Aether, mojo-executor, better Mojo supportMaven 3 Mojos will not run on Maven 2Maven 2 support will seriously hold you back 4444
    • Groovy MOJOs“if” a model composition / plugin executionSpecify dynamic value when configuring a pluginPut your own logic in POMModify existing plugins behaviorPass in-memory information between plugins 4545
    • So .. 4646
    • So ..GMaven - custom build behavior on any phasePolyglot Maven is a Groovy syntactic sugarGroovy Mojos is the way to make it your way 4747
    • So ..GMaven - custom build behavior on any phasePolyglot Maven is a Groovy syntactic sugarGroovy Mojos is the way to make it your wayCreating build applications with Maven – doable! Maven is not a solution, but a platform 4848
    • So ..GMaven - custom build behavior on any phasePolyglot Maven is a Groovy syntactic sugarGroovy Mojos is the way to make it your wayCreating build applications with Maven – doable! Maven is not a solution, but a platform We don’t have to be limited by existing plugins Perl, IDEA, Jenkins, jQuery, Grails, Gradle .. 4949
    • Maven Pluginshttp://evgeny-goldin.com/wiki/Maven-pluginsmaven-copy-pluginmaven-jenkins-pluginmaven-assert-pluginmaven-mail-pluginmaven-about-pluginduplicates-finder-plugin 5050
    • Links@evgeny_goldinhttp://evgeny-goldin.comhttp://evgeny-goldin.orghttp://github.com/evgeny-goldin/ 5151
    • 5252