gradle clean build -P deploy.profile=pro
gradle clean build -P deploy.profile=test
gradle clean build -x test
gradle -q dependencies >d:\out.txt
gradle -q dependencies --configuration compileClasspath >d:\out.txt
gradle -q dependencies --configuration runtimeClasspath >d:\out.txt
gradle -q dependencies --configuration testCompileClasspath >d:\out.txt
cd /data/servers/Publishingtools/taskserver
/data/servers/gradle-2.13/bin/gradle clean build
任务列表
执行 gradle tasks 会列出项目中所有任务
gradle -q tasks --all
获取依赖列表
执行 gradle dependencies 会列出项目的依赖列表,所有依赖会根据任务区分,以树型结构展示出来
gradle -q dependencies
过滤依赖信息
gradle -q dependencies --configuration testCompile 指定具体的api gradle -q api:dependencies --configuration testCompile
dependencies buildDependents
============================================================================================================
使用 Gradle 图形用户界面
除了支持传统的命令行界面,Gradle 也提供了一个图形用户界面(GUI)。这是一个独立的用户界面,可以通过加上 --gui 参数来启动。
gradle --gui
============================================================================================================
查看依赖
查看指定阶段的依赖关系。使用gradle dependencies 可以查看项目中包的依赖关系。不过是列出了所有阶段的依赖,如果项目中依赖复杂的话看起来有点头痛。那么可以使用--configuration来查看指定阶段的依赖情况。
1、使用gradle -q dependencies --configuration testCompile可以只查看testComiple的依赖。
例: $ gradle -q dependencies --configuration testCompile
2、查看指定dependency的依赖情况。 假如我想查看项目中有没有引入junit,那些阶段引入了junit,那么可以使用dependecyInsight来查看。
例: $ gradle dependencyInsight --dependency junit --configuration testCompile
============================================================================================================
装配所有输出并运行所有检查
运行所有任务
验证任务,包括测试和初始化
清理所有输出
项目报告,包括子项目
所有的tasks列表
展示指定任务的详细信息
展示构建环境依赖关系报告
展示依赖关系报告
展示模型关系报告
展示項目依賴。
============================================================================================================
$ gradle -h USAGE: gradle [option...] [task...] -?, -h, --help Shows this help message. -a, --no-rebuild Do not rebuild project dependencies. -b, --build-file Specify the build file. --build-cache Enables the Gradle build cache. Gradle will try to reuse outputs from previous builds. -c, --settings-file Specify the settings file. --configuration-cache Enables the configuration cache. Gradle will try to reuse the build configuration from previous builds. [incubating] --configuration-cache-problems Configures how the configuration cache handles problems (fail or warn). Defaults to fail. [incubating] --configure-on-demand Configure necessary projects only. Gradle will attempt to reduce configuration time for large multi-project builds. [incubating] --console Specifies which type of console output to generate. Values are 'plain', 'auto' (default), 'rich' or 'verbose'. --continue Continue task execution after a task failure. -D, --system-prop Set system property of the JVM (e.g. -Dmyprop=myvalue). -d, --debug Log in debug mode (includes normal stacktrace). --daemon Uses the Gradle Daemon to run the build. Starts the Daemon if not running. --export-keys Exports the public keys used for dependency verification. [incubating] -F, --dependency-verification Configures the dependency verification mode (strict, lenient or off) [incubating] --foreground Starts the Gradle Daemon in the foreground. -g, --gradle-user-home Specifies the gradle user home directory. -I, --init-script Specify an initialization script. -i, --info Set log level to info. --include-build Include the specified build in the composite. -M, --write-verification-metadata Generates checksums for dependencies used in the project (comma-separated list) [incubating] -m, --dry-run Run the builds with all task actions disabled. --max-workers Configure the number of concurrent workers Gradle is allowed to use. --no-build-cache Disables the Gradle build cache. --no-configuration-cache Disables the configuration cache. [incubating] --no-configure-on-demand Disables the use of configuration on demand. [incubating] --no-daemon Do not use the Gradle daemon to run the build. Useful occasionally if you have configured Gradle to always run with the daemon by default. --no-parallel Disables parallel execution to build projects. --no-scan Disables the creation of a build scan. For more information about build scans, please visit https://gradle.com/build-scans. --no-watch-fs Disables watching the file system. [incubating] --offline Execute the build without accessing network resources. -P, --project-prop Set project property for the build script (e.g. -Pmyprop=myvalue). -p, --project-dir Specifies the start directory for Gradle. Defaults to current directory. --parallel Build projects in parallel. Gradle will attempt to determine the optimal number of executor threads to use. --priority Specifies the scheduling priority for the Gradle daemon and all processes launched by it. Values are 'normal' (default) or 'low' [incubating] --profile Profile build execution time and generates a report in the <build_dir>/reports/profile directory. --project-cache-dir Specify the project-specific cache directory. Defaults to .gradle in the root project directory. -q, --quiet Log errors only. --refresh-dependencies Refresh the state of dependencies. --refresh-keys Refresh the public keys used for dependency verification. [incubating] --rerun-tasks Ignore previously cached task results. -S, --full-stacktrace Print out the full (very verbose) stacktrace for all exceptions. -s, --stacktrace Print out the stacktrace for all exceptions. --scan Creates a build scan. Gradle will emit a warning if the build scan plugin has not been applied. (https://gradle.com/build-scans) --status Shows status of running and recently stopped Gradle Daemon(s). --stop Stops the Gradle Daemon if it is running. -t, --continuous Enables continuous build. Gradle does not exit and will re-execute tasks when task file inputs change. --update-locks Perform a partial update of the dependency lock, letting passed in module notations change version. [incubating] -v, --version Print version info. -w, --warn Set log level to warn. --warning-mode Specifies which mode of warnings to generate. Values are 'all', 'fail', 'summary'(default) or 'none' --watch-fs Enables watching the file system for changes, allowing data about the file system to be re-used for the next build. [incubating] --write-locks Persists dependency resolution for locked configurations, ignoring existing locking information if it exists [incubating] -x, --exclude-task Specify a task to be excluded from execution.
$ gradle ======================================= Elasticsearch Build Hamster says Hello! Gradle Version : 6.6.1 OS Info : Mac OS X 10.14.5 (x86_64) JDK Version : 11 (Oracle JDK) JAVA_HOME : /Library/Java/JavaVirtualMachines/jdk-11.0.8.jdk/Contents/Home Random Testing Seed : 81391CAF341C3379 In FIPS 140 mode : false ======================================= > Task :help Welcome to Gradle 6.6.1. To run a build, run gradle <task> ... To see a list of available tasks, run gradle tasks To see a list of command-line options, run gradle --help To see more detail about a task, run gradle help --task <task> For troubleshooting, visit https://help.gradle.org BUILD SUCCESSFUL in 4s 1 actionable task: 1 executed