Your SlideShare is downloading. ×
0
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Maven Plugins
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Maven Plugins

5,036

Published on

Overview of Evgeny Goldin Maven plugins, available at http://evgeny-goldin.com/wiki/Main_Page

Overview of Evgeny Goldin Maven plugins, available at http://evgeny-goldin.com/wiki/Main_Page

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
5,036
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
32
Comments
0
Likes
2
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Maven Plugins<br />EvgenyGoldin<br />
  • 2. evgeny-goldin.com/wiki/Maven-plugins<br />evgeny-goldin.org/artifactory/plugins-releases<br />evgeny-goldin.org/artifactory/libs-releases<br />&lt;groupId&gt;com.goldin.plugins&lt;/groupId&gt;<br />&lt;artifactId&gt;maven-xyz-plugin&lt;/artifactId&gt;<br />&lt;version&gt;0.2.1&lt;/version&gt;<br />
  • 3. maven-copy-plugin<br />Copies, packs, unpacks, downloads, uploads ..<br /> .. files, archives, Maven &lt;dependencies&gt;<br />maven-properties-plugin<br />Creates new Maven properties at run-time ..<br />.. evaluating Groovy expressions! <br />maven-hudson-plugin<br />Generates Hudson jobs<br />Organizes them hierarchically in a single POM <br />
  • 4. maven-assert-plugin<br />Verifies files exist, properties defined, etc.<br />Verifies any Groovy expression!<br />maven-mail-plugin<br />Sends e-mails with attachments from Maven<br />Works great for build-time reports<br />maven-spring-batch-plugin<br />Invokes Spring Batch job as part of Maven build<br />
  • 5. maven-copy-plugin<br />
  • 6. Copies, packs, unpacks, downloads, uploads ..<br /> .. files, archives, Maven &lt;dependencies&gt;<br />Filters and replaces content<br />Updates archives<br />Unpacks Zip entries<br />Downloads and uploadsfrom/to HTTP, SCP, FTP<br />Built-in Groovy support<br />
  • 7. &lt;groupId&gt;com.goldin.plugins&lt;/groupId&gt;<br />&lt;artifactId&gt;maven-copy-plugin&lt;/artifactId&gt;<br />&lt;version&gt;0.2.1&lt;/version&gt;<br />
  • 8. &lt;configuration&gt;:<br />&lt;configuration&gt;<br />&lt;resources&gt;<br /> &lt;resource&gt;..&lt;/resource&gt;<br /> &lt;resource&gt;..&lt;/resource&gt;<br />&lt;/resources&gt;<br />&lt;configuration&gt;<br />
  • 9. Copy files:<br />&lt;resource&gt;<br />&lt;targetPath&gt;target directory&lt;/targetPath&gt;<br />&lt;directory&gt;base directory&lt;/directory&gt;<br />&lt;include&gt;**/*.xml, *.txt, **/lib/*.jar&lt;/include&gt;<br />&lt;exclude&gt;**/*-template.xml&lt;/exclude&gt;<br />&lt;/resource&gt;<br />
  • 10. Copy file:<br />&lt;resource&gt;<br /> &lt;targetPath&gt;target directory&lt;/targetPath&gt;<br />&lt;file&gt;file to copy&lt;/file&gt;<br />&lt;/resource&gt;<br />
  • 11. Filter files:<br />&lt;resource&gt;<br /> &lt;targetPath&gt;..&lt;/targetPath&gt;<br /> &lt;directory&gt;..&lt;/directory&gt;<br /> &lt;include&gt;..&lt;/include&gt;<br />&lt;filtering&gt;true&lt;/filtering&gt;<br />&lt;/resource&gt;<br />
  • 12. Replace content – single &lt;replace&gt;:<br />&lt;resource&gt;<br /> &lt;targetPath&gt;..&lt;/targetPath&gt;<br /> &lt;file&gt;..&lt;/file&gt;<br />&lt;replace&gt;<br /> &lt;from&gt;regular expression&lt;/from&gt;<br /> &lt;to&gt;replacement content&lt;/to&gt;<br /> &lt;/replace&gt;<br />&lt;/resource&gt;<br />
  • 13. Replace content - multiple &lt;replaces&gt;:<br />&lt;resource&gt;<br /> &lt;targetPath&gt;..&lt;/targetPath&gt;<br /> &lt;file&gt;..&lt;/file&gt;<br />&lt;replaces&gt;<br /> &lt;replace&gt;..&lt;/replace&gt;<br /> &lt;replace&gt;..&lt;/replace&gt;<br /> &lt;/replaces&gt;<br />&lt;/resource&gt;<br />
  • 14. &lt;filter&gt; + &lt;replace&gt;:<br />&lt;resource&gt;<br /> &lt;targetPath&gt;..&lt;/targetPath&gt;<br /> &lt;file&gt;..&lt;/file&gt;<br />&lt;filtering&gt;true&lt;/filtering&gt;<br />&lt;replace&gt;..&lt;/replaces&gt;<br />&lt;/resource&gt;<br />
  • 15. Copy &lt;dependency&gt;:<br />&lt;resource&gt;<br /> &lt;targetPath&gt;..&lt;/targetPath&gt;<br />&lt;dependency&gt;<br /> &lt;groupId&gt;..&lt;/groupId&gt;<br /> &lt;artifactId&gt;..&lt;/artifactId&gt;<br />&lt;/dependency&gt;<br />&lt;/resource&gt;<br />
  • 16. Copy &lt;dependencies&gt;:<br />&lt;resource&gt;<br /> &lt;targetPath&gt;..&lt;/targetPath&gt;<br />&lt;dependencies&gt;<br /> &lt;dependency&gt;..&lt;/dependency&gt;<br /> &lt;dependency&gt;..&lt;/dependency&gt;<br />&lt;/dependencies&gt;<br />&lt;/resource&gt;<br />
  • 17. Pack archive:<br />&lt;resource&gt;<br /> &lt;targetPath&gt;path/file.zip&lt;/targetPath&gt;<br /> &lt;directory&gt;..&lt;/directory&gt;<br /> &lt;include&gt;..&lt;/include&gt;<br />&lt;pack&gt;true&lt;/pack&gt;<br />&lt;/resource&gt;<br />
  • 18. Formats supported:<br />Zip, jar, war, ear, hpi<br />Tar, tar.gz, tgz<br />Tar.bz2, tzp, tbz2<br />Ant + TrueZip<br />
  • 19. Update archive:<br />&lt;resource&gt;<br /> &lt;targetPath&gt;path/file.zip&lt;/targetPath&gt;<br /> &lt;directory&gt;..&lt;/directory&gt;<br /> &lt;include&gt;..&lt;/include&gt;<br /> &lt;pack&gt;true&lt;/pack&gt;<br /> &lt;update&gt;true&lt;/update&gt;<br />&lt;/resource&gt;<br />
  • 20. Attachartifact:<br />&lt;resource&gt;<br /> &lt;targetPath&gt;path/file.zip&lt;/targetPath&gt;<br /> &lt;directory&gt;..&lt;/directory&gt;<br /> &lt;include&gt;..&lt;/include&gt;<br /> &lt;pack&gt;true&lt;/pack&gt;<br /> &lt;attachArtifact&gt;true&lt;/attachArtifact&gt;<br />&lt;/resource&gt;<br />
  • 21. Deployartifact:<br />&lt;resource&gt;<br /> &lt;targetPath&gt;path/file.zip&lt;/targetPath&gt;<br /> &lt;directory&gt;..&lt;/directory&gt;<br /> &lt;include&gt;..&lt;/include&gt;<br /> &lt;pack&gt;true&lt;/pack&gt;<br />&lt;deploy&gt;repoUrl|groupId|artifactId|version&lt;/deploy&gt;<br />&lt;/resource&gt;<br />
  • 22. Unpack archive:<br />&lt;resource&gt;<br /> &lt;targetPath&gt;..&lt;/targetPath&gt;<br /> &lt;file&gt;some/file.zip&lt;/directory&gt;<br /> &lt;unpack&gt;true&lt;/unpack&gt;<br />&lt;/resource&gt;<br />
  • 23. Formats supported:<br />Zip, jar, war, ear, hpi<br />Tar, tar.gz, tgz<br />Tar.bz2, tzp, tbz2<br />Ant + TrueZip<br />
  • 24. Unpack archives:<br />&lt;resource&gt;<br /> &lt;targetPath&gt;..&lt;/targetPath&gt;<br /> &lt;directory&gt;..&lt;/directory&gt;<br /> &lt;include&gt;*.jar, *.zip, *.tar.gz&lt;/include&gt;<br /> &lt;unpack&gt;true&lt;/unpack&gt;<br />&lt;/resource&gt;<br />
  • 25. Unpack &lt;dependency&gt;:<br />&lt;resource&gt;<br /> &lt;targetPath&gt;..&lt;/targetPath&gt;<br />&lt;dependency&gt;<br /> &lt;groupId&gt;..&lt;/groupId&gt;<br /> &lt;artifactId&gt;..&lt;/artifactId&gt;<br />&lt;/dependency&gt;<br /> &lt;unpack&gt;true&lt;/unpack&gt;<br />&lt;/resource&gt;<br />
  • 26. Unpack &lt;dependencies&gt;:<br />&lt;resource&gt;<br /> &lt;targetPath&gt;..&lt;/targetPath&gt;<br />&lt;dependencies&gt;<br /> &lt;dependency&gt;..&lt;/dependency&gt;<br /> &lt;dependency&gt;..&lt;/dependency&gt;<br />&lt;/dependencies&gt;<br /> &lt;unpack&gt;true&lt;/unpack&gt;<br />&lt;/resource&gt;<br />
  • 27. Unpack Zip entry:<br />&lt;resource&gt;<br /> &lt;targetPath&gt;..&lt;/targetPath&gt;<br /> &lt;file&gt;path/file.zip&lt;/file&gt;<br />&lt;zipEntry&gt;entry/path/file.txt&lt;/zipEntry&gt;<br /> &lt;unpack&gt;true&lt;/unpack&gt;<br />&lt;/resource&gt;<br />
  • 28. Unpack Zip entries (1):<br />&lt;resource&gt;<br /> &lt;targetPath&gt;..&lt;/targetPath&gt;<br /> &lt;file&gt;path/file.zip&lt;/file&gt;<br />&lt;zipEntry&gt;entry/**/*.txt&lt;/zipEntry&gt;<br /> &lt;unpack&gt;true&lt;/unpack&gt;<br />&lt;/resource&gt;<br />
  • 29. Unpack Zip entries (2):<br />&lt;resource&gt;<br /> &lt;zipEntries&gt;<br />&lt;zipEntry&gt;..&lt;/zipEntry&gt;<br />&lt;zipEntry&gt;..&lt;/zipEntry&gt;<br />&lt;/zipEntries&gt;<br /> &lt;unpack&gt;true&lt;/unpack&gt;<br />&lt;/resource&gt;<br />
  • 30. Download files – network drive:<br />&lt;resource&gt;<br /> &lt;targetPath&gt;..&lt;/targetPath&gt;<br />&lt;directory&gt;networkdrive&lt;/directory&gt;<br /> &lt;include&gt;..&lt;/include&gt;<br /> &lt;exclude&gt;..&lt;/exclude&gt;<br />&lt;/resource&gt;<br />
  • 31. Download file – HTTP:<br />&lt;resource&gt;<br /> &lt;targetPath&gt;..&lt;/targetPath&gt;<br />&lt;file&gt;http://host/file&lt;/file&gt;<br />&lt;/resource&gt;<br />
  • 32. Download file – SCP:<br />&lt;resource&gt;<br /> &lt;targetPath&gt;..&lt;/targetPath&gt;<br /> &lt;directory&gt;scp://user:pass@host:/file&lt;/directory&gt;<br />&lt;/resource&gt;<br />
  • 33. Download files – FTP:<br />&lt;resource&gt;<br /> &lt;targetPath&gt;..&lt;/targetPath&gt;<br /> &lt;directory&gt;ftp://user:pass@host:/path&lt;/directory&gt;<br />&lt;include&gt;..&lt;/include&gt;<br />&lt;exclude&gt;..&lt;/exclude&gt;<br />&lt;/resource&gt;<br />
  • 34. Download files – FTP + wget:<br />&lt;resource&gt;<br /> &lt;targetPath&gt;..&lt;/targetPath&gt;<br /> &lt;directory&gt;ftp://user:pass@host:/path&lt;/directory&gt;<br />&lt;include&gt;..&lt;/include&gt;<br />&lt;wget&gt;wget.exe&lt;/wget&gt;<br />&lt;/resource&gt;<br />
  • 35. Download + unpack:<br />&lt;resource&gt;<br /> &lt;targetPath&gt;..&lt;/targetPath&gt;<br /> http / scp / ftp<br />&lt;unpack&gt;true&lt;/unpack&gt;<br />&lt;/resource&gt;<br />
  • 36. Upload files – network drive:<br />&lt;resource&gt;<br /> &lt;targetPath&gt;networkdrive&lt;/targetPath&gt;<br /> &lt;directory&gt;..&lt;/directory&gt;<br /> &lt;include&gt;..&lt;/include&gt;<br />&lt;/resource&gt;<br />
  • 37. Upload files – SCP:<br />&lt;resource&gt;<br /> &lt;targetPath&gt;scp://user:pass@host:/dir&lt;/targetPath&gt;<br /> &lt;directory&gt;..&lt;/directory&gt;<br /> &lt;include&gt;..&lt;/include&gt;<br />&lt;/resource&gt;<br />
  • 38. Upload files – FTP:<br />&lt;resource&gt;<br /> &lt;targetPath&gt;ftp://user:pass@host:/dir&lt;/targetPath&gt;<br /> &lt;directory&gt;..&lt;/directory&gt;<br /> &lt;include&gt;..&lt;/include&gt;<br />&lt;/resource&gt;<br />
  • 39. Delete files:<br />&lt;resource&gt;<br /> &lt;directory&gt;..&lt;/directory&gt;<br /> &lt;include&gt;..&lt;/include&gt;<br />&lt;clean&gt;true&lt;/clean&gt;<br /> &lt;cleanEmptyDirectories&gt;true&lt;/cleanEmptyDirectories&gt;<br />&lt;/resource&gt;<br />
  • 40. Create file (= copy other file + &lt;replace&gt;):<br />&lt;resource&gt;<br /> &lt;targetPath&gt;..&lt;/targetPath&gt;<br /> &lt;file&gt;${project.basedir}/pom.xml&lt;/file&gt;<br />&lt;replace&gt;&lt;to&gt;new content&lt;/to&gt;&lt;/replace&gt;<br /> &lt;destFileName&gt;newName.txt&lt;/destFileName&gt;<br />&lt;/resource&gt;<br />
  • 41. Create directory:<br />&lt;resource&gt;<br /> &lt;targetPath&gt;..&lt;/targetPath&gt;<br />&lt;mkdir&gt;true&lt;/mkdir&gt;<br />&lt;/resource&gt;<br />
  • 42. Groovy support - &lt;runIf&gt;:<br />&lt;configuration&gt;<br />&lt;runIf&gt;{{ Groovy Expression }}&lt;/runIf&gt;<br /> &lt;resource&gt;<br />&lt;runIf&gt;{{ Groovy Expression }}&lt;/runIf&gt;<br /> // Boolean.valueOf( String.valueOf( returnValue ))<br /> &lt;/resource&gt;<br />&lt;/configuration&gt;<br />
  • 43. Groovy support - &lt;description&gt;:<br />&lt;resource&gt;<br /> &lt;description&gt;Time: {{ new Date() }}&lt;/description&gt;<br /> … <br />&lt;/resource&gt;<br />Logs &lt;resource&gt; start, end, and execution time in ms<br />
  • 44. Groovy support - &lt;replace&gt;:<br />&lt;resource&gt;<br /> …<br /> &lt;replace&gt;<br />&lt;to&gt;File updated at: {{ new Date() }}&lt;/to&gt;<br /> &lt;groovy&gt;true&lt;/groovy&gt;<br /> &lt;/replace&gt;<br />&lt;/resource&gt;<br />
  • 45. Groovy support – FTP download + &lt;listFilter&gt;:<br />&lt;resource&gt;<br /> FTP download<br /> &lt;wget&gt;wget.exe&lt;/wget&gt;<br />&lt;listFilter&gt;{{ files.keySet().findAll{ .. } }}&lt;/listFilter&gt;<br />&lt;/resource&gt;<br />Filters files to download.<br />
  • 46. Groovy support - &lt;filter&gt;:<br />&lt;resource&gt;<br /> &lt;targetPath&gt;..&lt;/targetPath&gt;<br /> …<br />&lt;filter&gt;{{ files.findAll{ .. } }}&lt;/filter&gt;<br />&lt;/resource&gt;<br />Filters files to copy, pack, unpack, etc.<br />
  • 47. Groovy support - &lt;process&gt;:<br />&lt;resource&gt;<br /> &lt;targetPath&gt;..&lt;/targetPath&gt;<br /> …<br />&lt;process&gt;{{ println “Files: $files” }}&lt;/process&gt;<br />&lt;/resource&gt;<br />Processes files after they are copied, packed, etc.<br />
  • 48. Groovy support - context:<br />“project” - org.apache.maven.project.MavenProject<br />“session” - org.apache.maven.execution.MavenSession<br />“mavenVersion”<br />All Maven and System properties<br />&lt;this-property&gt; =&gt; “thisProperty”<br />“os.name” =&gt; “osName”<br />{{ new File( project.basedir, “pom.xml” ) }}<br />
  • 49. maven-properties-plugin<br />
  • 50. Creates new Mavenpropertiesatrun time ..<br /> .. evaluatingGroovy expressions!<br />Works best in combinationwith &lt;runIf&gt;<br />Allowscreatingdynamic content for the mail plugin<br />
  • 51. &lt;groupId&gt;com.goldin.plugins&lt;/groupId&gt;<br />&lt;artifactId&gt;maven-properties-plugin&lt;/artifactId&gt;<br />&lt;version&gt;0.2.1&lt;/version&gt;<br />
  • 52. &lt;configuration&gt;:<br />&lt;configuration&gt;<br /> &lt;properties&gt;<br />&lt;property&gt;..&lt;/property&gt;<br />&lt;property&gt;..&lt;/property&gt;<br /> &lt;/properties&gt;<br />&lt;/configuration&gt;<br />
  • 53. &lt;property&gt;:<br />&lt;property&gt;<br /> &lt;name&gt;propertyTrue&lt;/name&gt;<br />&lt;value&gt;{{ &apos;t&apos; + &apos;r&apos; + &apos;u&apos; + &apos;e&apos; }}&lt;/value&gt;<br />&lt;/property&gt;<br />…<br />&lt;runIf&gt;{{ propertyTrue }}&lt;/runIf&gt;<br />&lt;runIf&gt;{{ ! Boolean.valueOf( propertyTrue ) }}&lt;/runIf&gt;<br />
  • 54. Groovycontext:<br />“project” - org.apache.maven.project.MavenProject<br />“session” - org.apache.maven.execution.MavenSession<br />“mavenVersion”<br />All Maven and System properties<br />&lt;this-property&gt; =&gt; “thisProperty”<br />“os.name” =&gt; “osName”<br />{{ project.basedir.canonicalPath }}<br />
  • 55. maven-hudson-plugin<br />
  • 56. Generates Hudson jobs<br />Definesthem in a single POM<br />Jobs canformhierarchicall groups (reuse!)<br />Supports jobs invocation<br />Supports Artifactory deployment<br />
  • 57. &lt;groupId&gt;com.goldin.plugins&lt;/groupId&gt;<br />&lt;artifactId&gt;maven-hudson-plugin&lt;/artifactId&gt;<br />&lt;version&gt;0.2.1&lt;/version&gt;<br />
  • 58. &lt;configuration&gt; :<br />&lt;configuration&gt;<br /> &lt;outputDirectory&gt;.hudson/jobs&lt;/outputDirectory&gt;<br /> &lt;jobs&gt;<br />&lt;job&gt;..&lt;/job&gt;<br />&lt;job&gt;..&lt;/job&gt;<br /> &lt;/jobs&gt;<br />&lt;/configuration&gt;<br />
  • 59. &lt;job&gt; :<br />&lt;job&gt;<br />&lt;id&gt;jobName&lt;/id&gt;<br /> &lt;mavenName&gt;apache-maven-2.2.1&lt;/mavenName&gt; &lt;mavenOpts&gt;-Xmx256m&lt;/mavenOpts&gt;<br /> &lt;mavenGoals&gt;–e –B –U clean install&lt;/mavenGoals&gt;<br /> …<br />&lt;/job&gt;<br />
  • 60. &lt;job&gt; :<br />&lt;jdkName&gt;<br />&lt;pom&gt;<br />&lt;repositories&gt;<br />&lt;privateRepository&gt;<br />&lt;mail&gt;<br />…<br />All standard job configuration options.<br />
  • 61. Extending &lt;job&gt; (1):<br />&lt;job&gt;<br />&lt;id&gt;baseJob&lt;/id&gt;<br />&lt;abstract&gt;true&lt;/abstract&gt;<br /> &lt;jdkName&gt;..&lt;/jdkName&gt; <br /> &lt;mavenName&gt;..&lt;/mavenName&gt;<br /> &lt;mavenGoals&gt;..&lt;/mavenGoals&gt;<br />&lt;/job&gt;<br />
  • 62. Extending &lt;job&gt; (2):<br />&lt;job&gt;<br /> &lt;id&gt;jobName&lt;/id&gt;<br />&lt;parent&gt;baseJob&lt;/parent&gt;<br /> &lt;repository&gt;..&lt;/repository&gt;<br />&lt;/job&gt;<br />Only job-specific values are specified.<br />
  • 63. Description Table:<br />
  • 64. Invoking jobs:<br />&lt;job&gt;<br /> &lt;id&gt;jobName&lt;/id&gt;…<br />&lt;invoke&gt;<br /> &lt;jobs&gt;jobA, jobB, jobC&lt;/jobs&gt;<br /> &lt;/invoke&gt;<br />&lt;/job&gt;<br />
  • 65. Invoking jobs - conditions:<br />&lt;invoke&gt;<br /> &lt;jobs&gt;jobA, jobB, jobC&lt;/jobs&gt;<br /> &lt;always&gt;false&lt;/always&gt;<br />&lt;stable&gt;true&lt;/stable&gt;<br />&lt;unstable&gt;false&lt;/unstable&gt;<br />&lt;failed&gt;false&lt;/failed&gt;<br />&lt;/invoke&gt;<br />
  • 66. Artifactory deployment:<br />&lt;job&gt;<br />&lt;artifactory&gt;<br /> &lt;name&gt;http://host/artifactory&lt;/name&gt;<br /> &lt;user&gt;deployer&lt;/user&gt;<br /> &lt;scrambledPassword&gt;..&lt;/scrambledPassword&gt;<br />&lt;/artifactory&gt;<br />&lt;/job&gt;<br />
  • 67. Environments supported:<br />SCM: Subversion, Git, CVS, NullSCM (none)<br />Maven jobs<br />Free-style jobs<br />Plugins required:<br />“Parameterized Trigger Plugin” v2.4 or higher<br />“ArtifactoryPlugin” v1.3.4 or higher<br />
  • 68. maven-assert-plugin<br />
  • 69. Buildassertions!<br />Propertiesdefined<br />Files exist<br />Directories identical<br />Groovy expressions evaluate to true<br />Wasdriven by plugins tests<br />
  • 70. &lt;groupId&gt;com.goldin.plugins&lt;/groupId&gt;<br />&lt;artifactId&gt;maven-assert-plugin&lt;/artifactId&gt;<br />&lt;version&gt;0.2.1&lt;/version&gt;<br />
  • 71. &lt;configuration&gt; :<br />&lt;configuration&gt;<br /> &lt;assertProperties&gt;..&lt;/assertProperties&gt;<br /> &lt;assertFiles&gt;..&lt;/assertFiles&gt;<br /> &lt;assertEqual&gt;..&lt;/assertEqual&gt;<br /> &lt;assertGroovy&gt;..&lt;/assertGroovy&gt;<br />&lt;/configuration&gt;<br />
  • 72. &lt;assertProperties&gt; :<br />&lt;assertProperties&gt;<br /> job-parameter<br /> BUILD_NUMBER<br /> HUDSON_URL<br />&lt;/assertProperties&gt;<br />Makes sure all job parameters are specified.<br />
  • 73. &lt;assertFiles&gt; :<br />&lt;assertFiles&gt;<br /> ${data-files}/*.xml<br /> ${project.build.directory}/setup.tar.gz<br /> ${project.build.directory}/ini<br />&lt;/assertFiles&gt;<br />Makes sure all files and directories are created.<br />
  • 74. &lt;assertEqual&gt; :<br />&lt;assertEqual&gt; <br /> ${dir}/expected|${outputDir}/result<br /> ${dir}/expected|${outputDir}/result|**/*.xml<br />&lt;/assertEqual&gt;<br />Makes sure directories are identical (+/- pattern).<br />
  • 75. &lt;assertGroovy&gt; :<br />&lt;assertGroovy&gt; <br />project.basedir.directorySize() &gt; 0<br /> timestamp ==~ /^d{2} w+ d{4}, d{2}:d{2}:d{2}$/<br />&lt;/assertGroovy&gt;<br />Evaluates «assertline» for each line (power assert!)<br />
  • 76. Groovycontext:<br />File.directorySize()<br />Object.splitWith() – see GCommons<br />“project” - org.apache.maven.project.MavenProject<br />“session” - org.apache.maven.execution.MavenSession<br />“mavenVersion”<br />All Maven and System properties<br />
  • 77. maven-mail-plugin<br />
  • 78. Sends e-mails with attachments from Maven<br />Works great for build-time reports<br />Properties plugin allows for dynamic content<br />
  • 79. &lt;groupId&gt;com.goldin.plugins&lt;/groupId&gt;<br />&lt;artifactId&gt;maven-mail-plugin&lt;/artifactId&gt;<br />&lt;version&gt;0.2.1&lt;/version&gt;<br />
  • 80. &lt;configuration&gt;:<br />&lt;configuration&gt;<br />&lt;smtp&gt;..&lt;/smtp&gt;<br /> &lt;from&gt;..&lt;/from&gt;<br /> &lt;mails&gt;&lt;to&gt;..&lt;/to&gt;&lt;/mails&gt;<br /> &lt;subject&gt;..&lt;/subject&gt;<br /> &lt;text&gt;..&lt;/text&gt;<br />&lt;/configuration&gt;<br />
  • 81. &lt;mails&gt;:<br />&lt;mails&gt;<br />&lt;to&gt;user@mail; user2@mail&lt;/to&gt;<br />&lt;cc&gt;User Name &amp;lt;user@mail&amp;gt;;&lt;/cc&gt;<br />&lt;bcc&gt;..&lt;/bcc&gt;<br />&lt;/mails&gt;<br />Use &amp;lt;user@mail&amp;gt; or CDATA<br />Addresses are «;»-separated to allowspaces in names<br />
  • 82. Attaching files:<br />&lt;configuration&gt;<br />&lt;textFile&gt;..&lt;/textFile&gt;<br />&lt;files&gt;<br /> &lt;file&gt;..&lt;/file&gt;<br /> &lt;file&gt;..&lt;/file&gt;<br />&lt;/files&gt;<br />&lt;/configuration&gt;<br />
  • 83. maven-spring-batch-plugin<br />
  • 84. Invokes SpringBatch job as part of Maven build<br />Maven is a good platform for batch processes!<br />
  • 85. &lt;groupId&gt;com.goldin.plugins&lt;/groupId&gt;<br />&lt;artifactId&gt;maven-spring-batch-plugin&lt;/artifactId&gt;<br />&lt;version&gt;0.2.1&lt;/version&gt;<br />
  • 86. &lt;configuration&gt;:<br />&lt;configuration&gt;<br />&lt;jobId&gt;jobId&lt;/jobId&gt;<br /> &lt;configLocations&gt;<br />classpath:/springbatch/infra/job-launcher.xml<br />file:/job/context.xml<br /> &lt;/configLocations&gt;<br />&lt;/configuration&gt;<br />
  • 87. Properties:<br />&lt;configuration&gt;<br />&lt;props&gt;<br /> name = value<br />classpath:/springbatch/infra/job-runner.properties<br />file:/job/context.properties<br />&lt;/props&gt;<br />&lt;/configuration&gt;<br />
  • 88. evgeny-goldin.com/wiki/Maven-plugins<br />maven-plugins.994461.n3.nabble.com<br />evgeny-goldin.org/artifactory/plugins-releases<br />evgeny-goldin.org/artifactory/libs-releases<br />evgeny-goldin.org/youtrack/issues/pl<br />@evgeny_goldin<br />evgenyg@gmail.com<br />

×