Continuous Integration: Java Spring Boot project with Travis
Compile and test your code on every change you commit is a good start point to develop high quality software. Iterate over stable software, write good tests and fix the bugs. This is the way.
Continuous integration can help you in this path looking to minimize headaches and maximizing quality code.
In this example we’ll setup the minimal configuration of a Java Spring Boot with Maven and Travis CI. I’ll use a sample repository from my github: bank-api.
- Go to https://travis-ci.com/ and login with GitHub/GitLab account.
2. In your Git repository add the travis configuration file .travis.yml
Explanation of the file:
- language: java
- jdk: we’re using oraclejdk11
- script: the command we want to run
- before_install: the maven wrapper must be executed in the Travis environment, so we need to update the permissions before the script runs
3. Git commit and push the file to the repository.
Important: the Maven wrapper folder .mvn must be included in the repository (check if it’s excluded from .gitignore file).
4. We can go to the Travis CI dashboard and check the build execution results
Now you can add the Travis CI badge to the readme, isn’t it cool? :P
- Click on the badge next to the project in https://www.travis-ci.com/
- Select the branch, “Markdown” format, copy the result and paste on the Readme.md
If you want to contact: firstname.lastname@example.org