Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gradle入门 #49

Open
waltcow opened this issue Oct 15, 2020 · 0 comments
Open

Gradle入门 #49

waltcow opened this issue Oct 15, 2020 · 0 comments

Comments

@waltcow
Copy link
Owner

waltcow commented Oct 15, 2020

Installing Gradle

  1. java development kit
java -version
java version "1.8.0_151"
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)
  1. install via homebrew
brew install gradle
  1. verifying installation
> gradle -v

------------------------------------------------------------
Gradle 6.6.1
------------------------------------------------------------

Build time:   2020-08-25 16:29:12 UTC
Revision:     f2d1fb54a951d8b11d25748e4711bec8d128d7e3

Kotlin:       1.3.72
Groovy:       2.5.12
Ant:          Apache Ant(TM) version 1.10.8 compiled on May 10 2020
JVM:          14.0.1 (Oracle Corporation 14.0.1+14)
OS:           Mac OS X 10.14.6 x86_64

Building Java Applications Sample

  1. Create a project folder
create a folder for the new project and change directory into it.

$ mkdir demo
$ cd demo
  1. Run the init task
$ 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

Select build script DSL:
  1: Groovy
  2: Kotlin
Enter selection (default: Groovy) [1..2] 1

Select test framework:
  1: JUnit 4
  2: TestNG
  3: Spock
  4: JUnit Jupiter
Enter selection (default: JUnit 4) [1..4]

Project name (default: demo):
Source package (default: demo):


BUILD SUCCESSFUL
2 actionable tasks: 2 executed

project structure

├── gradle // Generated folder for wrapper files
│   └── wrapper
│       ├── gradle-wrapper.jar
│       └── gradle-wrapper.properties
├── gradlew  // Gradle wrapper start scripts
├── gradlew.bat 
├── settings.gradle // Settings file to define build name and subprojects
└── app
    ├── build.gradle // Build script of app project
    └── src
        ├── main
        │   └── java // Default Java source folder
        │       └── demo
        │           └── App.java
        └── test // Default Java test source folder
            └── java 
                └── demo
                    └── AppTest.java

Creating New Gradle Builds

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant