JAVA EXAMPLE PROGRAMS

JAVA EXAMPLE PROGRAMS

Publish Your Article Here

What is build.gradle file?


You run a Gradle build using the gradle command. The gradle command looks for a file called build.gradle in the current directory. You can call this build.gradle file a build script, although strictly speaking it is a build configuration script. The build script defines a project and its tasks.

To try this out, create the following build script named build.gradle.

task hello {
        doLast {
                println 'Hello Java2Novice...'
        }
}

Move to the folder where build.gradle file placed and run command "gradle hello"

java2novice$ gradle hello
:hello
Hello Java2Novice...

BUILD SUCCESSFUL

Total time: 3.348 secs

This build script defines a single task, called hello, and adds an action to it. When you run gradle hello, Gradle executes the hello task, which in turn executes the action you've provided.

Reference: Gradle Documentation

<< Previous Program | Next Program >>

Gradle configuration examples

  1. Gradle Installation Steps
  2. What is gradle project and task
  3. What is build.gradle file?
  4. How to avoid gradle log messages?
  5. How to define default tasks in Gradle?
  6. How to list all gradle tasks?
  7. How to list gradle project properties?
  8. How to declare a task that depends on other task?
  9. How to create dynamic tasks in Gradle?
  10. How to exclude a task in gradle?
  11. How to create java project in gradle?
Knowledge Centre
Transient and Volatile Modifiers
Transient: The transient modifier applies to variables only and it is not stored as part of its object's Persistent state. Transient variables are not serialized.

Volatile: Volatile modifier applies to variables only and it tells the compiler that the variable modified by volatile can be changed unexpectedly by other parts of the program.
Famous Quotations
When I do good, I feel good; when I do bad, I feel bad, and that is my religion.
-- Abraham Lincoln

About Author

Most Visited Pages

Other Interesting Sites

Reference: Java™ Platform Standard Ed. 7 - API Specification | Java is registered trademark of Oracle.
Privacy Policy | Copyright © 2017 by Nataraja Gootooru. All Rights Reserved.