Git Product home page Git Product logo

gradleconcepts's Introduction

GradleConcepts

gradle compileJava
gradle run
gradle --rerun-tasks build
gradle clean build --refresh-dependencies -x test                                                                                                                                                    ─╯
Test Reports
gradle test

Runs the tests and creates the report in build/reports/tests/test/index.html

Project Object & Task Object

Gradle Task

Project is the root class under which task can be considered as a method.

# project.task firstTask
task firstTask{
    println "Gradle First Task!!"
}

Check first task and run in two ways

gradle tasks --all
gradle firstTask
# Same as 
gradle fT

Prioritize the tasks

task deployToStage{
    doLast(){
        println "Deployed to Stage"
    }
}

task deployToProd{
    doLast(){
        println "Deployed to Prod"
    }
}

task cleanUpFiles{
    doLast(){
        println "Clean Up Files"
    }
}

deployToProd.dependsOn deployToStage
deployToProd.finalizedBy cleanUpFiles
#defaultTasks "deployToStage"

Outputs the following

❯ gradle deployToProd

> Configure project :
123
Gradle First Task!!
task X

> Task :deployToStage
Deployed to Stage

> Task :deployToProd
Deployed to Prod

> Task :cleanUpFiles
Clean Up Files

BUILD SUCCESSFUL in 566ms
3 actionable tasks: 3 executed

External Properties
project.ext.xyz="abc"
ext{
  test="external properties"
}

Retrieve the properties

println project.ext.xyz
println project.ext.test

Configurations

compileOnly : Dependancy will be available only during the compile time of your source code. Example : Lombok or Dozer

runtimeOnly : example Logging. No need at compiletime but required at runtime.

gradleconcepts's People

Contributors

nitinkc avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.