HOWTO
GitHub repo
Initialize project
[dave@dave git]$ cd gradle-demo/
[dave@dave gradle-demo]$ gradle init
Select type of project to generate:
1: basic
2: application
3: library
4: Gradle plugin
Enter selection (default: basic) [1..4] 2
Select implementation language:
1: C++
2: Groovy
3: Java
4: Kotlin
5: Scala
6: Swift
Enter selection (default: Java) [1..6] 3
Split functionality across multiple subprojects?:
1: no - only one application project
2: yes - application and library projects
Enter selection (default: no - only one application project) [1..2] 2
Select build script DSL:
1: Groovy
2: Kotlin
Enter selection (default: Groovy) [1..2] 1
Project name (default: gradle-demo):
Source package (default: gradle.demo):
> Task :init
Get more help with your project: https://docs.gradle.org/7.0/samples/sample_building_java_applications_multi_project.html
BUILD SUCCESSFUL in 41s
2 actionable tasks: 2 executed
Project structure
[dave@dave gradle-demo]$ find
.
./gradle
./gradle/wrapper
./gradle/wrapper/gradle-wrapper.jar
./gradle/wrapper/gradle-wrapper.properties
./settings.gradle
./.gradle
./.gradle/configuration-cache
./.gradle/configuration-cache/gc.properties
./.gradle/7.0
./.gradle/7.0/fileChanges
./.gradle/7.0/fileChanges/last-build.bin
./.gradle/7.0/gc.properties
./.gradle/7.0/dependencies-accessors
./.gradle/7.0/dependencies-accessors/gc.properties
./.gradle/7.0/dependencies-accessors/dependencies-accessors.lock
./.gradle/7.0/vcsMetadata-1
./.gradle/7.0/executionHistory
./.gradle/7.0/executionHistory/executionHistory.lock
./.gradle/7.0/executionHistory/executionHistory.bin
./.gradle/7.0/fileHashes
./.gradle/7.0/fileHashes/fileHashes.lock
./.gradle/7.0/fileHashes/fileHashes.bin
./.gradle/buildOutputCleanup
./.gradle/buildOutputCleanup/buildOutputCleanup.lock
./.gradle/buildOutputCleanup/outputFiles.bin
./.gradle/buildOutputCleanup/cache.properties
./.gradle/checksums
./.gradle/checksums/checksums.lock
./.gradle/vcs-1
./.gradle/vcs-1/gc.properties
./gradlew.bat
./buildSrc
./buildSrc/build.gradle
./buildSrc/src
./buildSrc/src/main
./buildSrc/src/main/groovy
./buildSrc/src/main/groovy/gradle.demo.java-common-conventions.gradle
./buildSrc/src/main/groovy/gradle.demo.java-library-conventions.gradle
./buildSrc/src/main/groovy/gradle.demo.java-application-conventions.gradle
./app
./app/build.gradle
./app/src
./app/src/main
./app/src/main/java
./app/src/main/java/gradle
./app/src/main/java/gradle/demo
./app/src/main/java/gradle/demo/app
./app/src/main/java/gradle/demo/app/MessageUtils.java
./app/src/main/java/gradle/demo/app/App.java
./app/src/main/resources
./app/src/test
./app/src/test/java
./app/src/test/java/gradle
./app/src/test/java/gradle/demo
./app/src/test/java/gradle/demo/app
./app/src/test/java/gradle/demo/app/MessageUtilsTest.java
./app/src/test/resources
./.gitattributes
./utilities
./utilities/build.gradle
./utilities/src
./utilities/src/main
./utilities/src/main/java
./utilities/src/main/java/gradle
./utilities/src/main/java/gradle/demo
./utilities/src/main/java/gradle/demo/utilities
./utilities/src/main/java/gradle/demo/utilities/SplitUtils.java
./utilities/src/main/java/gradle/demo/utilities/StringUtils.java
./utilities/src/main/java/gradle/demo/utilities/JoinUtils.java
./utilities/src/main/resources
./utilities/src/test
./utilities/src/test/resources
./gradlew
./README.md
./list
./list/build.gradle
./list/src
./list/src/main
./list/src/main/java
./list/src/main/java/gradle
./list/src/main/java/gradle/demo
./list/src/main/java/gradle/demo/list
./list/src/main/java/gradle/demo/list/LinkedList.java
./list/src/main/resources
./list/src/test
./list/src/test/java
./list/src/test/java/gradle
./list/src/test/java/gradle/demo
./list/src/test/java/gradle/demo/list
./list/src/test/java/gradle/demo/list/LinkedListTest.java
./list/src/test/resources
./.gitignore
Main
[dave@dave gradle-demo]$ more settings.gradle
/*
* This file was generated by the Gradle 'init' task.
*
* The settings file is used to specify which projects to include in your build.
*
* Detailed information about configuring a multi-project build in Gradle can be found
* in the user manual at https://docs.gradle.org/7.0/userguide/multi_project_builds.html
*/
rootProject.name = 'gradle-demo'
include('app', 'list', 'utilities')
Run tests
[dave@dave gradle-demo]$ ./gradlew check
Downloading https://services.gradle.org/distributions/gradle-7.0-bin.zip
..........10%...........20%...........30%..........40%...........50%...........60%...........70%..........80%...........90%...........100%
BUILD SUCCESSFUL in 32s
9 actionable tasks: 9 executed
Run application
[dave@dave gradle-demo]$ ./gradlew run
> Task :app:run
Hello World!
BUILD SUCCESSFUL in 989ms
6 actionable tasks: 1 executed, 5 up-to-date
Build
[dave@dave gradle-demo]$ ./gradlew build
BUILD SUCCESSFUL in 970ms
13 actionable tasks: 4 executed, 9 up-to-date
Publish
[dave@dave gradle-demo]$ ./gradlew build --scan
BUILD SUCCESSFUL in 4s
13 actionable tasks: 13 up-to-date
Publishing a build scan to scans.gradle.com requires accepting the Gradle Terms of Service defined at https://gradle.com/terms-of-service. Do you accept these terms? [yes, no] yes
Gradle Terms of Service accepted.
Publishing build scan...
https://gradle.com/s/v7pfqpbcuendg
No comments:
Post a Comment