Java Applications

Deploy production-ready Java APIs and backend services with automatic Maven or Gradle builds and scaling.

Overview

RunxBuild automatically builds Java projects using Maven or Gradle. Your application must listen on the port provided via the PORT environment variable.

Files RunxBuild Looks For

Ensure one of the following build systems is present in your repository root.

pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/xsd/maven-4.0.0
         http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <groupId>com.runxbuild</groupId>
    <artifactId>service</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>3.2.5</version>
    </parent>

    <properties>
        <java.version>17</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
    </dependencies>
</project>

Basic Spring Boot Template

Application.java:

package com.runxbuild.service;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@SpringBootApplication
@RestController
public class Application {

    public static void main(String[] args) {
        String port = System.getenv().getOrDefault("PORT", "8080");
        System.setProperty("server.port", port);
        System.setProperty("server.address", "0.0.0.0");

        SpringApplication.run(Application.class, args);
    }

    @GetMapping("/")
    public Map<String, String> home() {
        return Map.of("message", "RunxBuild Java service running");
    }
}

Deployment Settings

RunxBuild builds and starts your Java application automatically. In most cases, you do not need to provide custom build or start commands.