编译并打包 jar 文件,但不会执行单元测试。一些其他插件可能会增强这个任务的功能。例如,如果采用了 War 插件,这个任务便会为你的项目打出 War 包。
build = assemble + test
gradle build –refresh-dependencies 刷新依赖缓存
Build tasks
-———-
assemble - Assembles the outputs of this project.
build - Assembles and tests this project.
buildDependents - Assembles and tests this project and all projects that depend on it.
buildNeeded - Assembles and tests this project and all projects it depends on.
classes - Assembles main classes.
clean - Deletes the build directory.
jar - Assembles a jar archive containing the main classes.
testClasses - Assembles test classes.
Documentation tasks
-——————
javadoc - Generates Javadoc API documentation for the main source code.
Help tasks
-———
buildEnvironment - Displays all buildscript dependencies declared in project ‘:client’.
components - Displays the components produced by project ‘:client’. [incubating]
dependencies - Displays all dependencies declared in project ‘:client’.
dependencyInsight - Displays the insight into a specific dependency in project ‘:client’.
dependentComponents - Displays the dependent components of components in project ‘:client’. [incubating]
help - Displays a help message.
model - Displays the configuration model of project ‘:client’. [incubating]
projects - Displays the sub-projects of project ‘:client’.
properties - Displays the properties of project ‘:client’.
tasks - Displays the tasks runnable from project ‘:client’.
Publishing tasks
-—————
generatePomFileForMavenJavaPublication - Generates the Maven POM file for publication ‘mavenJava’.
publish - Publishes all publications produced by this project.
publishMavenJavaPublicationToMavenLocal - Publishes Maven publication ‘mavenJava’ to the local Maven repository.
publishMavenJavaPublicationToMeituan-nexus-snapshotsRepository - Publishes Maven publication ‘mavenJava’ to Maven repository ‘meituan-nexus-snapshots’.
publishToMavenLocal - Publishes all Maven publications produced by this project to the local Maven cache.
Verification tasks
-—————–
check - Runs all checks.
test - Runs the unit tests.
原文 https://techwei.cn/2018/05/18/gradle/gradle/