communicode / communikey-backend

A simple centralized, cross-platform credential manager using GPG encryption.
https://communicode.github.io/communikey-docs
GNU General Public License v3.0
11 stars 0 forks source link

Migrate to Gradle #14

Closed svengreb closed 6 years ago

svengreb commented 6 years ago

Closes #12

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:

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:

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:

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:

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.