JAVA EXAMPLE PROGRAMS

JAVA EXAMPLE PROGRAMS

Publish Your Article Here

How to list gradle project properties?


You can use gradle properties command to list the properties of a gradle project. Here is a simple build.gradle file for an example:

defaultTasks 'clean', 'run'
						
task clean << {
        println 'Default Task - Cleaning!'
}
task run << {
        println 'Default Task - Running!'
}
task mySpecTask << {
        println "I'm not a default task!"
}

Run "gradle properties"

java2novice$ gradle properties
:properties

------------------------------------------------------------
Root project
------------------------------------------------------------

allprojects: [root project 'gradle_tests']
ant: org.gradle.api.internal.project.DefaultAntBuilder@4d97507c
antBuilderFactory: org.gradle.api.internal.project.DefaultAntBuilderFactory@92524b0
artifacts: org.gradle.api.internal.artifacts.dsl.DefaultArtifactHandler@658ba380
asDynamicObject: org.gradle.api.internal.ExtensibleDynamicObject@329b5c95
buildDir: /Users/java2novice/gradle_tests/build
buildFile: /Users/java2novice/gradle_tests/build.gradle
buildScriptSource: org.gradle.groovy.scripts.UriScriptSource@646326e5
buildscript: org.gradle.api.internal.initialization.DefaultScriptHandler@298eb7e0
childProjects: {}
class: class org.gradle.api.internal.project.DefaultProject_Decorated
classLoaderScope: org.gradle.api.internal.initialization.DefaultClassLoaderScope@58c9e870
clean: task ':clean'
components: []
configurations: []
convention: org.gradle.api.internal.plugins.DefaultConvention@2e0b08f1
defaultTasks: [clean, run]
depth: 0
description: null
ext: org.gradle.api.internal.plugins.DefaultExtraPropertiesExtension@67ee75a5
extensions: org.gradle.api.internal.plugins.DefaultConvention@2e0b08f1
fileOperations: org.gradle.api.internal.file.DefaultFileOperations@586dd8f1
fileResolver: org.gradle.api.internal.file.BaseDirFileResolver@13bde392
gradle: build 'gradle_tests'
group: 
logger: org.gradle.api.logging.Logging$LoggerImpl@79f71773
logging: org.gradle.logging.internal.DefaultLoggingManager@4d24bd93
modelRegistry: org.gradle.model.internal.registry.DefaultModelRegistry@271a2576
module: org.gradle.api.internal.artifacts.ProjectBackedModule@1b0fb9bd
mySpecTask: task ':mySpecTask'
name: gradle_tests
parent: null
parentIdentifier: null
path: :
plugins: [org.gradle.api.plugins.HelpTasksPlugin@24fe9ad1]
processOperations: org.gradle.api.internal.file.DefaultFileOperations@586dd8f1
project: root project 'gradle_tests'
projectDir: /Users/java2novice/gradle_tests
projectEvaluationBroadcaster: ProjectEvaluationListener broadcast
projectEvaluator: org.gradle.configuration.project.LifecycleProjectEvaluator@25917a08
projectRegistry: org.gradle.api.internal.project.DefaultProjectRegistry@71e2b67c
properties: {...}
repositories: []
resources: org.gradle.api.internal.resources.DefaultResourceHandler@5b3ac14d
rootDir: /Users/java2novice/gradle_tests
rootProject: root project 'gradle_tests'
run: task ':run'
scriptPluginFactory: org.gradle.configuration.DefaultScriptPluginFactory@247973e4
serviceRegistryFactory: org.gradle.internal.service.scopes.ProjectScopeServices$5@21a79071
services: ProjectScopeServices
standardOutputCapture: org.gradle.logging.internal.DefaultLoggingManager@4d24bd93
state: project state 'EXECUTED'
status: release
subprojects: []
tasks: [task ':clean', task ':mySpecTask', task ':properties', task ':run']
version: unspecified

BUILD SUCCESSFUL

Total time: 1.831 secs

Reference: Gradle Documentation

<< Previous Program | Next Program >>
blog comments powered by Disqus

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
Pass by value Vs Pass by reference
Pass by value: Passing a copy of the value, not the original reference.

Pass by reference: Passsing the address of the object, so that you can access the original object.
Famous Quotations
You can never get enough of what you don’t really need.
-- Eric Hoffer

About Author

I'm Nataraja Gootooru, programmer by profession and passionate about technologies. All examples given here are as simple as possible to help beginners. The source code is compiled and tested in my dev environment.

If you come across any mistakes or bugs, please email me to java2novice@gmail.com or you can comment on the page.

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.