Building Groovy projects

Let's first implement the QotdService interface in Groovy. Also, we will write some unit tests to make sure that the functionality works as expected. To start the project, let's create the directory structure as follows:

qotd-groovy
├── build.gradle
└── src
    ├── main
    │   ├── groovy
    │   │   └── com
    │   │       └── packtpub
    │   │           └── ge
    │   │               └── qotd
    │   │                   └── GroovyQotdService.groovy
    │   └── java
    │       └── com
    │           └── packtpub
    │               └── ge
    │                   └── qotd
    │                       └── QotdService.java
    └── test
        └── groovy
            └── com
                └── packtpub
                    └── ge
                        └── qotd
                            └── GroovyQotdServiceTest.groovy

The src/main/java directory is the default directory for Java sources. Similarly, src/main/groovy is used by default to compile Groovy source files. Again, it is just a convention, ...

Get Gradle Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.