This PR migrates the project from Maven to Gradle for a simplified workflow and setup following large projects like Android. This improves the development in various aspects as described in the documented
Gradle vs. Maven comparision. For details see the extensive and very well written Gradle docs.
The Gradle wrapper hasn't been included on purpose to keep the repository clean. It is a anti-pattern to add binaries to a repository. Next to this, it is not necessary to include the wrapper because the project documentation provides details for developers on how to setup a development environment for the project and most developers have such build tools installed globally. If it should be necessary to use the wrapper a wrapper task has been implemented which includes the supported Gradle version for the project and downloads all necessary files into the project root (see chapter Custom Tasks).
Migration Changes
The following chapters describe the changes that have been made in order to migrate the project.
Integration Test SourceSet
A base concept of Gradle are SourceSet's which are logical group of the source code (java, Kotlin, Scala, C/C++ ...) and resources. The default source sets main and test are known from Maven.
All communikey integration tests have been moved into a new integration-test source set. This automatically generates the following Gradle tasks:
integrationTestClasses - Assembles all integration test classes.
checkstyleIntegrationTest - Run Checkstyle on all integration test sources.
compileIntegrationTestJava - Compiles all integration test sources.
processIntegrationTestResource - Process all integration test resources.
These tasks are included in the default Gradle task lifecycles (e.g. check)
Spring Boot
The org.springframework.boot plugin provides all necessary tasks to work with Spring Boot. The io.spring.dependency-management plugin is applied to handle the dependency management (separated as of Spring Boot 2.0). This automatically generates the following Gradle tasks:
bootRun - Run the Spring Boot application.
bootJar - Assembles the executable fat JAR of the application.
dependencyManagement - Display information about dependencies of all project modules.
Checkstyle
The checkstyle plugin allows to run Checkstyle. A configuration has been added which reflects the communicode Code Style Guide 1.1. The following Gradle tasks are available:
checkstyleIntegrationTest - Run Checkstyle analysis for all integration test sources.
checkstyleMain - Run Checkstyle analysis for all main sources.
checkstyleTest - Run Checkstyle analysis for all test sources.
These tasks are included in the default Gradle task lifecycles (e.g. check).
Test Coverage with Jacoco
The test coverage tool Jacoco has been ported via the jacoco plugin and provides the following Gradle tasks:
jacocoTestCoverageVerification - Verifies code coverage metrics for tests.
jacocoTestReport - Generates a code coverage report.
These tasks are included in the default Gradle task lifecycles (e.g. check, test).
IntelliJ IDEA Support
The idea plugin adds support for IntelliJ IDEA and has been configured to advise the IDE to use the same output directories as Gradle builds.
Apache Maven Support
The maven plugin adds support for deploying artifacts to Maven repositories (e.g. the local repository by using the install task)
Custom Tasks
Some custom Gradle tasks have been implemented to run the integration tests, build JavaDoc, download the Gradle wrapper and generate JavaDoc and source JARs.
This PR migrates the project from Maven to Gradle for a simplified workflow and setup following large projects like Android. This improves the development in various aspects as described in the documented Gradle vs. Maven comparision. For details see the extensive and very well written Gradle docs.
The Gradle wrapper hasn't been included on purpose to keep the repository clean. It is a anti-pattern to add binaries to a repository. Next to this, it is not necessary to include the wrapper because the project documentation provides details for developers on how to setup a development environment for the project and most developers have such build tools installed globally. If it should be necessary to use the wrapper a
wrapper
task has been implemented which includes the supported Gradle version for the project and downloads all necessary files into the project root (see chapter Custom Tasks).Migration Changes
The following chapters describe the changes that have been made in order to migrate the project.
Integration Test SourceSet
A base concept of Gradle are
SourceSet
's which are logical group of the source code (java, Kotlin, Scala, C/C++ ...) and resources. The default source setsmain
andtest
are known from Maven.All communikey integration tests have been moved into a new
integration-test
source set. This automatically generates the following Gradle tasks:integrationTestClasses
- Assembles all integration test classes.checkstyleIntegrationTest
- Run Checkstyle on all integration test sources.compileIntegrationTestJava
- Compiles all integration test sources.processIntegrationTestResource
- Process all integration test resources.These tasks are included in the default Gradle task lifecycles (e.g.
check
)Spring Boot
The
org.springframework.boot
plugin provides all necessary tasks to work with Spring Boot. Theio.spring.dependency-management
plugin is applied to handle the dependency management (separated as of Spring Boot 2.0). This automatically generates the following Gradle tasks:bootRun
- Run the Spring Boot application.bootJar
- Assembles the executable fat JAR of the application.dependencyManagement
- Display information about dependencies of all project modules.Checkstyle
The
checkstyle
plugin allows to run Checkstyle. A configuration has been added which reflects the communicode Code Style Guide 1.1. The following Gradle tasks are available:checkstyleIntegrationTest
- Run Checkstyle analysis for all integration test sources.checkstyleMain
- Run Checkstyle analysis for all main sources.checkstyleTest
- Run Checkstyle analysis for all test sources.These tasks are included in the default Gradle task lifecycles (e.g.
check
).Test Coverage with Jacoco
The test coverage tool Jacoco has been ported via the
jacoco
plugin and provides the following Gradle tasks:jacocoTestCoverageVerification
- Verifies code coverage metrics for tests.jacocoTestReport
- Generates a code coverage report.These tasks are included in the default Gradle task lifecycles (e.g.
check
,test
).IntelliJ IDEA Support
The idea plugin adds support for IntelliJ IDEA and has been configured to advise the IDE to use the same output directories as Gradle builds.
Apache Maven Support
The maven plugin adds support for deploying artifacts to Maven repositories (e.g. the local repository by using the
install
task)Custom Tasks
Some custom Gradle tasks have been implemented to run the integration tests, build JavaDoc, download the Gradle wrapper and generate JavaDoc and source JARs.
integrationTest
- Run the API integration tests.javadocJar
- Generate a JavaDoc JAR.sourcesJar
- Generate a sources JAR.wrapper
- Download the Gradle wrapper.