Gradle User guide ( Chapter 9:Groovy Quick start )

You can use groovy Plug in to build groovy project . This plug-in inherits java Plug in functions , And it's expanded groovy compile . Your project can contain groovy Code 、java Code or a mixture of the two . In other ways ,groovy Project and java The project is consistent , It's like we're in a chapter 7:java What you see in quick start .

  1. A simple groovy project

    Let's look at an example . Use groovy plug-in unit , You need to add the following code to get your build file .

    Be careful : The sample code is in gradle The path to the published source package samples/groovy/quickstart Next .

    If java The plug-in hasn't been added yet , This command also adds java Plug in to the project .Groovy Plug ins extend compilation compile Mission , Make it at compile time in src/main/groovy Find the source file in the directory . Again , Compile testing compileTest The task will be src/test/groovy Find the test source file in the directory . The compilation task compiles the source files in these directories , This means that the source file can contain java and groovy Mixed code for .

    Use groovy Compilation task , You have to specify which version of groovy And where to find groovy library . You can add a groovy Rely on configuration to achieve the above .Compile Compile configuration inherits this dependency , So before we compile groovy and java Source file groovy Will be added to classpath Next . as follows , We will be in mavan Used in the warehouse groovy2.3.6 .

    Here's the complete build file :

    Use gradle build Command compilation 、 test 、 Pack your projects .

  2. Summary

    This chapter introduces a simple groovy project . Usually , A real project is much more complicated than this . because groovy The project is also a java project , So you can be right java What are the operations of the project , Also can be groovy The project has these operations . You can Chapter 24, The Groovy Plugin understand groovy More details about plugins , You can also be in samples/groovy Find more examples in the directory .

Gradle User guide ( Chapter 9:Groovy Quick start ) More articles about

  1. 【 Reprint 】Gradle Study Chapter nine :Groovy Quick start

    Reprinted address :http://ask.android-studio.org/?/article/17 To build a Groovy project, you use the Groovy plugin ...

  2. Gradle 1.12 translate —— Chapter nine Groovy Quick start

    Due to time , I can't take notes and translate at the same time , About Gradle User guide for , This blog will no longer take notes , Only the untranslated chapters are translated and published here . For other translated chapters, please pay attention to Github Project on :https://githu ...

  3. 《gradle User guide Chinese version 》 Catalog

    gradle User guide copyright 2007-2017 Hans Dockter,Adam Murdoch As long as you don't charge for these copies , And it further stipulates that , Each copy contains this copyright notice , Whether it's printed or electronic ...

  4. 《gradle User guide Chinese version 》 The first 1 Chapter 、 brief introduction

    The first 1 Chapter . brief introduction Catalog 1.1  About this user guide Gradle It's based on Apache Ant and Apache Maven Concept of project automation build tool . Here we will introduce Gradle, We think gradle Give Way java term ...

  5. Gradle User guide

    Download and install gradle 2.1 Download address :http://www.gradle.org/learn Installation prerequisites :gradle Installation needs 1.6 Or later jdk(jre)( have access to java –versio ...

  6. Gradle User guide (1)-Gradle install

    precondition Gradle need Java JDK perhaps JRE, The version is 6 And above .Gradle Will load their own Groovy library , therefore ,Groovy It doesn't need to be installed . Anything that exists Groovy Installation will be ...

  7. 《gradle User guide Chinese version 》 The first part 、 About Gradle

    The first part . About Gradle Catalog 1. Introduce 1.1 About this user guide 2. summary 2.1 characteristic 2.2 Why choose Groovy? The previous page  |   Catalog  |   The next page

  8. 【 Reprint 】Gradle Study Chapter vii. :Java Quick start

    Reprinted address :http://ask.android-studio.org/?/article/22 7.1. The Java plugin(Java plug-in unit ) As we have seen, Gradle ...

  9. Gradle User guide ( Chapter 8: Fundamentals of dependency management )

    Chapter 8: Fundamentals of dependency management This chapter will introduce some of gradle The foundation of dependency management What is dependency management ? In short , Dependency management is made up of two parts . First ,gradle You need to know what projects you want to build or run , In order to find them . We will ...

Random recommendation

  1. IT Young sales job hunting experience in Shenzhen

    This may , Quit a monthly salary 5k , No overtime , Weekends , The welfare is good IT Work , I always feel that this kind of work is too smooth , There's no passion , Although I didn't figure out how to go next , But in the end, I chose to leave naked . I played in my city for half a month , It's the most ...

  2. Delphi The specifications that programming suggests to follow 2--- Naming specification

    1.1. Formal parameter naming suggestion The name of all formal parameters should express its purpose . If appropriate , It's better to use letters for the names of formal parameters a  The prefix , for example : procedure SomeProc(aUserName:string; aUserAg ...

  3. Netease Development Engineer programming problem Compare the weight Java

    Compare the weight Xiao Ming accompanies Xiao Hong to see the diamond , They took two diamonds at random from a pile and compared their weights . These diamonds vary in weight . After they've been comparing for a while , They're after two diamonds g1 and g2. Now, please judge which of these two diamonds is based on the information compared before ...

  4. Easy to use shell Command line : fish Configuration of

    fish Visual configuration commands for : $ fish_config Its configuration folder is ~/.config/fish. 1. To set environment variables , Create a new... In the configuration folder config.fish file , It will serve as fish At startup ...

  5. [ Roof placement ] *p++/*++p difference -linux

    #include <stdio.h> main() { char * s = "123456"; char * p; p = s; printf( "%c\n ...

  6. HDU 1863: open project( Weighted union lookups )

    open project Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total ...

  7. Learn from scratch Vue( 3、 ... and )

    Let's learn about components from an example ,vuejs2.0 actual combat : Imitation bean paste app project , Create custom components tabbar This example uses other components , For beginners , All of a sudden to understand the use of so many components , It's going to get confused . So I rewrote this example ...

  8. c# understand c# object-oriented

    C# It's an object-oriented technology released by Microsoft . To run on .NET Framework High level programming language above . And is scheduled to be in the Microsoft Professional Developer Forum (PDC) To appear on the stage .C# It's a Microsoft researcher Anders Hejlsberg The latest ...

  9. C# Create a mail merge template and merge text 、 picture

    about Word Mail merge function in , Users can save and print the result document after mail merge , It can also be sent by email , You need to use this function in many situations . That's for programmers , We can also do that C# Language environment through the form of code to achieve . According to the need, first ...

  10. Software 151 Wang chubo maven Import of

    One .maven Package import The list is as follows : <!-- Inherit defaults from Spring Boot --> <parent> <groupId>or ...