# JVM Maven This configuration is suitable if the project is built using Maven and runs on a JVM. In this case, the project can be written in languages such as Java or Kotlin. You can write a yaml file yourself using the instructions below, or use our yaml generator by clicking on [link](https://manifest.amverum.ru/), or fill it out in the "Configuration" section of your personal account. ## Section meta The `meta` section of the `amverum.yml` file will look like this: ``` yaml meta: environment: jvm toolchain: name: maven version: 11 ``` The only parameters that can be changed here is `meta.toolchain.version`. Logically, this is the version of the JDK that should be used for the build. Technically, the value of `version` is substituted into the name of the Docker image that will be used. For the build phase, this is `maven:3-openjdk-${meta.toolchain.version}`. Valid values can be found on the [docker hub](https://hub.docker.com/_/maven/tags?page=1&name=3-openjdk) page. For the run phase, this is `bellsoft/liberica-openjre-debian:${meta.toolchain.version}`. Valid values can be found on the [docker hub] page.(https://hub.docker.com/r/bellsoft/liberica-openjre-debian/tags). ```{eval-rst} .. admonition:: Important :class: warning The value of `meta.toolchain.version` must be valid for both the build and run phases. A simple LTS JDK version number is best. ``` ## Section build The following parameters can be specified in the `build` section: - `image` - `args` - `artifacts` The `image` parameter allows you to use a different build image than the one provided by Amverum. The image must meet the following requirements: - the source code for the build is expected in the /app folder (or image, no matter where the source code is located); - the image contains the `mvn` command, which can be called by name (without specifying the absolute path) with the `clean package` parameters. The `args` parameter allows you to specify additional options to the `mvn clean package ${build.args}` command. For example, if your project uses Spring Boot, you might need the following parameter: ``` yaml build: args: spring-boot:repackage ``` In this case, the command `mvn clean package spring-boot:repackage` will be executed for assembly. You can specify several parameters, all of them will be substituted into the command. For example, if you also need to specify the Maven profile: ``` yaml build: args: spring-boot:repackage -Pproduction ``` In this case, the command `mvn clean package spring-boot:repackage` will be executed for assembly. The `artifacts` parameter allows you to specify which files should be included in the final application. By default, all files with the `jar` extension from the `target` folder will be copied to the root of the application folder. The `artifacts` parameter, unlike other parameters, is not a string, but a dictionary. The key in it is the mask of the source files to copy, and the value is the folder to which the files will be copied. So, the default value of `artifacts` is: ``` yaml build: artifacts: "target/*.jar": / ``` We use the following copying rules: - only relative paths (without / at the beginning) are specified as a source; - if a file matches the mask, the file will be copied to the destination folder without the original path; - If a folder is included under the mask, it will be copied entirely to the destination folder along with all its contents. ## Section run The following parameters can be used in the `run` section: - `jarName` - `image` - `persistenceMount` - `containerPort` The `jarName` parameter is mandatory. It specifies the path to a file with the `jar` extension that should be run with the `java -jar ${run.jarName}` command. Example: ``` yaml run: jarName: bin/bag-end.jar ``` The `image` parameter allows you to use a different image for the build than the one provided by Amverum. The image must meet the following requirements: - the build result is expected in the /app folder (or image, it doesn't matter where the build result is located); - The image contains the `java` command, which can be called by name (without specifying an absolute path) with the `-jar filename` parameters. The `persistenceMount` parameter allows you to specify in which directory the folder with [persistent storage](../storage.md#data) will be mounted. The default value is `/data`. The `containerPort` parameter allows you to specify which port the application listens on. The default value is `80`. ## Recipes ### Minimal amverum.yml file ``` yaml meta: environment: jvm toolchain: name: maven version: 11 run: jarName: bag-end.jar ``` ### Spring Boot ``` yaml meta: environment: jvm toolchain: name: maven version: 17 build: args: spring-boot:repackage -Pproduction run: jarName: bag-end-1.0.0.jar containerPort: 8080 ```