The Simple Java Build with Travis CI and Spring Boot

MicrosoftTeams-image (1)

In this post, I’ll show you how simple it can be to build a Java project on Travis CI whilst using Spring Boot, it’s quick, easy, and efficient. Let’s get into it.

Getting started

To get started, we will use JSP and JSTL to render a simple “Hello world” view. So, we must import these dependencies to the project. Open the pom.xml file, and add the following lines:


Let’s create a class that declares that our application is a Spring Boot application. We’ll use the @SpringBootApplication annotation:

public class BootApplication {

    public static void main(String[] args) {, args);

Let’s create a configuration to resolve the view:

public class ViewConfig {

    public InternalResourceViewResolver internalResourceViewResolver() {
        InternalResourceViewResolver resolver = new InternalResourceViewResolver();

        return resolver;

Finally let’s code out the view:

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>

<%@ taglib prefix="templates" tagdir="/WEB-INF/tags/templates" %>

        hello world

The .travis.yml file

So this is what my .travis.yml file looks like:

language: java
 - oraclejdk8
 provider: heroku
  secure: $HEROKU_API_KEY
 app: lippep-spring-boot-test

In this case I’ve deployed it to Heroku, if you’re using Heroku, set your environment variables in Travis, then run the build, and there you have it.


You’ve just deployed a simple app using Heroku with Travis CI. This is a very basic Spring Boot project but a great way to practice. If you have any questions please email me at

Happy building.