One can use these properties given by gradle project api, within build.gradle file.
------------------------------Start of the File--------------------------
build.gradle
//project api properties
logger.info("Name of the project: ${project.name}")
logger.info("absolute path of the project: ${project.path}")
logger.info("description for the project: ${project.description}")
logger.info("directory containing the build script: ${project.projectDir}")
logger.info("build directory: ${project.buildDir}")
logger.info("${project.group}")
logger.info("${project.version}")
//The above properties - print same as below
//project api properties without project. prefix - implied by default
logger.info("Name of the project: ${name}")
logger.info("absolute path of the project: ${path}")
logger.info("description for the project: ${description}")
logger.info("directory containing the build script: ${projectDir}")
logger.info("build directory: ${buildDir}")
logger.info("${group}")
logger.info("${version}")
------------------------------End of the File--------------------------
Execution:
gradle -i build -i for enabling logging for info level.
Output:
Name of the project: gradle-demo
absolute path of the project: :
description for the project: null
directory containing the build script: /Users/dinesh/IdeaProjects/gradle-demo
build directory: /Users/dinesh/IdeaProjects/gradle-demo/build
unspecifiedName of the project: gradle-demo
absolute path of the project: :
description for the project: null
directory containing the build script: /Users/dinesh/IdeaProjects/gradle-demo
build directory: /Users/dinesh/IdeaProjects/gradle-demo/build
unspecified
No comments:
Post a Comment