Deploy a Java application on onesubnet
Deploy Spring Boot / JVM: Maven/Gradle build, run the JAR, port and environment variables.
Deploy a Java application on onesubnet
onesubnet runs your Java applications (Spring Boot, services, API) on an optimized JVM. Deploy via Git.
1. Prepare the project
- A
pom.xml(Maven) orbuild.gradle(Gradle) at the root. - Spring Boot reads the
PORTvariable automatically. For another server, bind the port to$PORT.
2. Deploy
- Connect your Git repository in the panel.
- Build command:
- Maven:
mvn clean package -DskipTests - Gradle:
./gradlew build -x test
- Maven:
- Start command:
java -jar target/app.jar(adjust the JAR name). For Spring Boot, add--server.port=$PORTif needed.
3. Environment variables
DATABASE_URL, Spring secrets (SPRING_DATASOURCE_URL…) in Settings → Environment.
4. JVM memory
To tune the heap to your plan: java -Xmx512m -jar target/app.jar.
References
- Spring Boot: https://docs.spring.io/spring-boot/
- Maven: https://maven.apache.org/guides/