# Java

A Maven or Gradle project deploys from its repository with no `Dockerfile`. Nimbus Land recognises `pom.xml`, `build.gradle` and `build.gradle.kts`, builds the project and starts it. Spring Boot is recognised too.

## Quick start

In the console, create an app from your repository with the deploy wizard. From the CLI, run this in the project directory:

```sh
nimbus deploy
```

Make your server listen on `PORT`. See [what every app needs](apps.md#what-every-app-needs).

## Spring Boot

Set the port in `application.properties`:

```properties
server.port=${PORT:8080}
```

## When the plan can't tell what will run

If [the deploy plan](apps.md#the-deploy-plan) can't tell what will run, add a `Procfile` with a `web:` line that starts your server on `$PORT`.

## Scala

Scala projects (`build.sbt`) are built too. As with Java, make the server listen on `PORT`, and add a `Procfile` if the plan can't tell what will run.

## Troubleshooting

For problems that aren't specific to Java, such as an app that never answers, see [Apps troubleshooting](apps.md#troubleshooting).

### The app builds but never answers

The server is listening on a fixed port. Read `PORT`, as shown under [Spring Boot](#spring-boot), or add a `Procfile` with a `web:` line that passes it.

### Database certificate errors

Attaching Postgres sets `DATABASE_CA_CERT`. JDBC connects in `prefer` mode by default, which works as is. To verify the certificate, write `DATABASE_CA_CERT` to a file at start-up and use `sslmode=verify-full sslrootcert=<path>`.
