Linux command
gradle-build 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Build project
gradle build
Build without tests
gradle build -x test
Build specific module
gradle :module:build
Build with info logging
gradle build --info
Build with parallel execution
gradle build --parallel
Dry run
gradle build --dry-run
说明
gradle build compiles source code, runs tests, and produces output artifacts. It is the main build lifecycle task combining compile, test, and assemble phases. The command executes the complete build process including dependency resolution, compilation, testing, and packaging. It can be customized per project through build scripts. The build task is provided by the Java plugin and follows Gradle's three-phase lifecycle: initialization, configuration, and execution.
参数
- -x _TASK_, --exclude-task _TASK_
- Exclude a task from execution.
- --info
- Set log level to info.
- --debug
- Set log level to debug.
- --stacktrace
- Print full stacktrace for exceptions.
- --parallel
- Build projects in parallel.
- --offline
- Execute the build without accessing network resources.
- --build-cache
- Enable the Gradle build cache.
- --no-daemon
- Run the build without the Gradle daemon.
- --continue
- Continue task execution after a task failure.
- --dry-run
- Show which tasks would be executed without running them.
- -P _PROP_, --project-prop _PROP_
- Set a project property.
- --help
- Display help information.
FAQ
What is the gradle-build command used for?
gradle build compiles source code, runs tests, and produces output artifacts. It is the main build lifecycle task combining compile, test, and assemble phases. The command executes the complete build process including dependency resolution, compilation, testing, and packaging. It can be customized per project through build scripts. The build task is provided by the Java plugin and follows Gradle's three-phase lifecycle: initialization, configuration, and execution.
How do I run a basic gradle-build example?
Run `gradle build` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -x _TASK_, --exclude-task _TASK_ do in gradle-build?
Exclude a task from execution.