2. ABOUT ME
• 34 Years old
• Married and have 3 kids
• 7 years work at SoftServe
• Work with Gradle since version 2.9
3. THERE IS NOTHING
MORE DIFFICULT TO TAKE IN HAND,
MORE PERILOUS TO CONDUCT,
OR MORE UNCERTAIN IN ITS SUCCESS,
THAN TO REPLACE ANY EXISTING BUILD
SYSTEM WITH GRADLE.
NICCOLO MACHIAVELLI*
9. CONFIGURATION OF ECLIPSE PROJECT
FROM BUILD
1. Applying some Eclipse specific settings
2. Understanding configuration tweaking in .project
3. Work with .classpath
22. GRADLE-JENKINS PLUGIN USED OLD
DSL
dsl {
configure { project ->
permission("hudson.model.Run.Delete:${user_id}")
23.
24.
25.
26.
27. HOW TO PUBLISH PLUGIN ON
PLUGINS.GRADLE.COM
• Register and get API key
• Store it in %USER_HOME%/.gradle/gradle.properties
• Publish and wait for approval of gradle team
gradle.publish.key=****
gradle.publish.secret=****
28. PITFALL DURING PUBLISH TO
PLUGINS.GRADLE.ORG
There was a bug in the plugin-publish plugin in versions prior to 0.9.7
(https://discuss.gradle.org/t/plugin-authors-please-use-the-latest-plugin-
publish-plugin-others-may-result-in-a-broken-upload/23573 ), where
artifacts would silently not be pushed into the repo, which means the
latest version of your plugin will not work properly when people apply it to
their build.
Upgrading to the latest version of the plugin-publish-plugin will fix this, but
this will require pushing a new version of your plugin.
29. HOW TO PUBLISH PLUGIN ON
PLUGINS.GRADLE.COM IMPROVED
• Register and get API key
• Store it in %USER_HOME%/.gradle/gradle.properties
• For old plugin, check publisher version
'com.gradle.publish:plugin-publish-plugin:0.9.9'
• Publish and wait for approval of gradle team
• Contact support if something went wrong !!!
30. LESSONS LEARNED
Source code you may find here:
https://github.com/crc83/gradle-jenkins-
plugin
1) Be ready to maintain any plugin you’re
using in your build
2) Ask for support as soon as possible
35. RELEASE IN PIPELINE JOB
1) Store dependency versions in gradle.properties
2) Create a task that updates gradle.properties to values
passed as parameter
project _a
version 0.0.1-SNAPSHOT
project_b
version 0.0.2-SNAPSHOT
dependency
project _a :0.0.1-SNAPSHOT
project_c
version 0.0.3-SNAPSHOT
dependency
project_b:0.0.2-SNAPSHOT
40. RELEASE IN PIPELINE JOB
Project A
version A.0.1
Project B
version B.0.2-SNAPSHOT
dependency A:A.0.1-SNAPSHOT
Project C
version C.0.3-SNAPSHOT
dependency B:0.2-SNAPSHOT
gradle.properties
dependency A:A.0.1
41. RELEASE IN PIPELINE JOB
Two steps approach
1)Update dependency versions and check them
into SCM
2)Do a release
42. UNSORTED
1. How to store credentials and other secured information not in
the script (locally and on Jenkins)
2. Common rules how we moved build logic to plugin
3. How to apply plugin for itself
49. COMMON RULES HOW WE MOVED
BUILD LOGIC TO PLUGIN
1) Use project object
2) Separate task definition and definition of task logic
3) Define your extension with default values
4) Access values on 3rd party extensions in afterEvaluate phase
5) Use --include-build=path/to/project/with/plugin to
test your plugin on real project
56. OVERALL LESSONS LEARNED
1) Whatever you’re going to do with Gradle is tricky
2) Whatever you’re going to do with Gradle is possible
3) Make your script as much declarative as possible