Download - 4F Migrating to Gradle Project
Agenda● Why are we migrating?● Migration Plan● How to setup development environment
○ Gradle wrapper○ Gradle lifecycle○ Importing projects into Eclipse / Idea○ How to do basic tasks ( compile, test, build)○ How to compile, test and run apps
● Continuous Integration○ Build triggers○ Deploying on Test/Stage environments○ Regression Tests○ Semantic Versioning○ Sonar Integration
● Production deployment○ Release management○ Liquibase ○ Deploying specific CMS version○ Rundeck (DeployAll job)
Project structure
“/loans/build.gradle” - root build file “/loans/settings.gradle” - multi mod. proj. set.“/loans/gradle.properties” - properties “/loans/gradlew.[bat, sh]” - wrapper “/loans/modules/build.gradle” - submodules“/loans/gradle/*.gradle” - common gradle tasks
Importing Gradle project in Eclipse1. Clean Eclipse project definitions using “gradlew cleanEclipse” command2. Generate Eclipse projects using “gradlew eclipse” command
Gradle basic tasks : compile
“gradle modules:util:compileJava” - will compile java files to class’es
Gradle basic tasks : test“gradle test” -> will test ALL modules (not recommended)
“gradle modules-es:web-vivus-es:test” -> will test web module and dependent modules
-> “:modules-es:web-es:test”-> “:modules:loans-api-impl:test” -> “: x : x : ...”
Gradle basic tasks : build
“gradle modules-es:web-vivus-es:build” -> compile classes + check + create jar + run tests for all dependent modules
Gradle basic tasks : build and store“gradle modules-es:web-vivus-es:uploadAchives” - build [war / jar] and store in Nexus
Gradle basic tasks : run local
“gardle modules-es:web-vivus-es:run” or “gradle modules-es:web-vivus-es:jettyRunWar”
Gradle basic tasks : short naming
“gradle testEs” - test all spain modules“gradle buildEs” - build/test all spain modules“gradle deployEs” - store [cola/ web] artifacts [war/ uber-jar] on nexus
“gradle accpetUk” - run all acceptance tests
Essential gradle commands
* “gradle --help”* “gradlew“* “gradle tasks“* “gradle projects“ * “gradle dependencies“* “gradle [any module name]:[build , test]“
Essential gradle commands (2)* “gradle clean”* “gradle modules-es:web-vivus-es:run“ * “gradle modules-es:web-vivus-es:uploadArchives“
Semantic versioning “MAJOR.MINOR”
1. MAJOR version when you make incompatible API changes,
2. MINOR version when you add functionality in a backwards-compatible
manner
For example : “1.61.01 - 131216063543”
* http://semver.org/