????Gradle??????Щ?????
????Gradle?????????????????????????????????????????????build.gradle?????????????????????Gradle??????Щ?????????Tasks????
????gradle tasks
??????????????????????Tasks?????б???????????Gradle??????????build.gradle??????????????Щ????????????????????
????:tasks
????== All tasks runnable from root project
????== Build Setup tasks
????setupBuild - Initializes a new Gradle build. [incubating]
????wrapper - Generates Gradle wrapper files. [incubating]
????== Help tasks
????dependencies - Displays all dependencies declared in root project 'gs-gradle'.
????dependencyInsight - Displays the insight into a specific dependency in root project 'gs-gradle'.
????help - Displays a help message
????projects - Displays the sub-projects of root project 'gs-gradle'.
????properties - Displays the properties of root project 'gs-gradle'.
????tasks - Displays the tasks runnable from root project 'gs-gradle'.
????To see all tasks and more detail?? run with --all.
????BUILD SUCCESSFUL
????Total time: 3.077 secs
??????????????г??????????????????????????????????????????????????????????????????build.gradle???Щ??????÷?????á?
?????????build.gradle??????????(plugins)??????????б????????????????ò???????gradle task??????Щ???????????
????????????ò??????????????????????????????????Java?????????
????????Java????
??????????????????????????????е?build.gradle?????
????apply plugin: 'java'
?????????????????????????????????????????????gradle task?????????????????б??????????Щ????????磺????????java?????????????????JavaDoc????????????е???????????
?????????????????????gradle build???????????????2???????????е??????????Jar?????
????gradle build
?????????????????”BUILD SUCCESSFUL”?????????????????????
?????????”build”???в????????????????????????????????????????????????????????????
????classes: ???汻??????.class???
????reports: ???????棨?磺??????棩
????lib: ???????????????????.jar????.war?????
????classes???????????????????.class?????????????????????????????????”HelloWorld.class”??”Greeter.class”??
?????????????????????????????κ???????????”debendency_cache”???????
????“reports”???????????????????????棬?????????????δ??д?κε????????????????????
????“lib”????????????jar??war???????????????????????????ζ???JAR???????汾???
????????????
?????????Hello World??????????????????κε?????????????????ó????????????????????????????????
???????磺?????????????????”Hello World!”???????????ó??????????????????????????????????Java???????????????????????????????”Joda Time”???????????????
???????????HelloWorld.jara????????????????
????package hello;
????import org.joda.time.LocalTime;
????public class HelloWorld {
????public static void main(String[] args) {
????LocalTime currentTime = new LocalTime();
????System.out.println("The current local time is: " + currentTime);
????Greeter greeter = new Greeter();
????System.out.println(greeter.sayHello());
????}
????}
?????????????HelloWorld???”Joda Time”??LocalTime??????????????????
??????????????????gradle build??????????????????????????????????δ??”Joda Time”??????????????????
????????????????????Щ???????????????????????
????repositories {
????mavenLocal()
????mavenCentral()
????}
?????????repositories???壬????????????Maven???????????????????????????Gradle????????????Maven????????????????????????????????Maven?????????????????????
??????????????????????????????????????壺
????dependencies {
????compile "joda-time:joda-time:2.2"
????}
???????dependencies?飬????????????Joda Time????????????????????joda-time?????汾?2.2??joda-time??
?????????????????????????????????????????????compile??Χ??????????????????????????????????????????????WAR???????????????/WEB-INF/libs???£???????????????????????????
????providedCompile?????????????????????????????????????????????????????????磺Java Servlet API??
????testCompile???????????????????в???????????????????????????????????
??????????????????????????Jar??????????
????jar {
????baseName = 'gs-gradle'
????version =  '0.1.0'
????}
????jar?鶨?????????JAR?????????????????У??????JAR????????????gs-gradle-0.1.0.jar??
???????????????????gradle build??Gradle???Щ????Maven?????????Joda Time?????????????????????????????
???????Gradle Wrapper?????????
????Gradle Wrapper???????Gradle??????????????????windows?????????OS X??Linux??Shell???????Щ???????????????а??Gradle?????????Gradle????????????????????????????????build.gradle????????????′???
????task wrapper(type: Wrapper) {
????gradleVersion = '1.11'
????}
?????????????????????????wrapper???:
????gradle wrapper
???????????????????????????????Щ??????????????????????£?wapper??jar?????properties???????????gradle/wrapper?????
?????????? initial
?????????? gradlew
?????????? gradlew.bat
?????????? gradle
?????????? wrapper
?????????? gradle-wrapper.jar
?????????? gradle-wrapper.properties
????????Gradle Wrapper????????????????????????Щ?????????汾???????У???????κ?????κε?????????Щ?????????????????????????? Wrapper??Gradle?汾??£?????????????wrapper???????????????????????????????
????./gradlew build