Recently in the development of the company to contact the Gradle build tools, on the network, but also as the next generation of building tools. I can not help but sprout a great interest.
For Gradle, if developers have used maven and Ant before, it shouldn't be difficult to start fast.
The core concepts are inherited from Maven and Ant.
Say so much first install it. Download on the official web. Extract, configure environment variable Gradle_home
Then add the \ Bin directory to the PATH environment variable. The installation is complete.
Run Gradle-v View version
First of all, when we were learning maven, we had a concept of a local warehouse.
Because Gradle inherits a lot of Maven's stuff, if Maven has a local repository. Gradle can also be used directly. Gradle will look at the local MAVEN warehouse address in ~\.m2\settings.xml. If you have a jar package that you can use directly inside, you can specify repositories {in Build.gradle
Mavenlocal ()
}
You can directly use the resources in the MAVEN local repository. Some people may ask Build.gradle what is the file? The Build.gradle file is a pom.xml file similar to maven. Used to build the entire Gradle project.
Here I briefly introduce the Build.gradle file. (In fact, do not need to introduce, the things inside are very easy to understand) the contents of the document are written on the note.
Description We are building Java code
Apply plugin: ' java '
//specify its own warehouse address, local and remote warehouse
repositories {
maven {URL ' https:// Repo.spring.io/libs-release "}
mavenlocal ()
}
//Output directory
builddir="./hellogradle "
//version of the resulting software
version= ' 2.5 '
//dependent management
dependencies {
compile ' org.slf4j:slf4j-api:1.7.21
' testcompile ' junit:junit:4.12 '
compile ' com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:2.6.3 '
compile ' com.sun.mail:javax.mail:1.5.2 '
}
dependencies {
compile ("Org.springframework.boot: Spring-boot-starter-data-gemfire ")
runtime (" Org.springframework.shell:spring-shell:1.0.0.release ")
}
When there is no MAVEN warehouse locally, Gradle also has its own warehouse. However, the downloaded remote repository is still downloaded from the remote Maven repository. If you do not specify a local Gradle warehouse address.
The default location is in ~/.gradle/caches.
We can also specify the location manually. Because the warehouse in the C disk always feel not very good.
We add such an environment variable
You can specify your own warehouse location.
Write so much first, later have a new experience, will continue to update