You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/doc/applications/scala.md
+14-28Lines changed: 14 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,9 +28,7 @@ aliases:
28
28
29
29
## Overview
30
30
31
-
Clever Cloud allows you to deploy Scala (and Java) applications built with SBT. This document will explain you how to set up your app to run it on our service.
32
-
33
-
If you're looking to deploy a [Play Framework](https://www.playframework.com) application, you can have a look at our dedicated [deployment guide for play framework applications](/guides/play-framework-2)
31
+
Clever Cloud allows you to deploy Scala (and Java) applications built with SBT. This document will explain you how to set up your app to run it on our service. If you're looking to deploy a [Play Framework](https://www.playframework.com) application, you can have a look at our dedicated [deployment guide](/guides/play-framework-2).
34
32
35
33
{{% content "create-application" %}}
36
34
@@ -41,56 +39,44 @@ If you're looking to deploy a [Play Framework](https://www.playframework.com) ap
41
39
### Mandatory configuration
42
40
43
41
Your application has to listen on port `8080` for worldwide connections (`0.0.0.0`). We set the system variable `http.port` to `8080` for you so in many cases (like for play applications) you don't have anything to do.
44
-
You need to use the [sbt-native-packager](#the-sbt-native-packager) in your project.
45
-
46
-
### The sbt-native-packager
47
42
48
-
We rely on `sbt-native-packager` to run applications. This plugin provides a `stage` task which is run during deployment.
43
+
### sbt Native Packager
49
44
50
-
If your project doesn't already use [sbt-native-packager](https://github.com/sbt/sbt-native-packager), you need to add it to `project/plugins.sbt`. Please make sure you use an up-to-date version.
51
-
52
-
In `project/plugins.sbt`:
45
+
We rely on [sbt-native-packager](https://github.com/sbt/sbt-native-packager) to run applications. This tool automates project build and provides a `stage` task which is run during deployment. To use it, add this line to `project/plugins.sbt` (with an up-to-date version):
Then you need to enable the package in `build.sbt`:
61
52
62
53
```scala
63
54
enablePlugins(JavaAppPackaging)
64
55
65
-
#Disable javadoc packaging
66
-
mappings in (Compile, packageDoc):=Seq()
56
+
// Disable javadoc packaging to speed up the build
57
+
Compile/packageDoc/ mappings:=Seq()
67
58
```
68
59
69
-
For more information, please have a look at the [documentation for sbt-native-packager](https://www.scala-sbt.org/sbt-native-packager/index.html)
60
+
For more information, please have a look at the [sbt-native-packager documentation](https://www.scala-sbt.org/sbt-native-packager/index.html)
70
61
71
-
#### Custom sbt goal
62
+
#### sbt custom goal
72
63
73
-
By default, the deployment system execute`sbt stage` and runs the first binary found into `/target/universal/stage/bin`. If you want to run another goal, you can specify it with the `SBT_DEPLOY_GOAL`[environment variable](#setting-up-environment-variables-on-clever-cloud).
64
+
By default, the deployment system executes`sbt stage` and runs the first binary found into `/target/universal/stage/bin`. If you want to run another goal, you can specify it with the `SBT_DEPLOY_GOAL`[environment variable](#setting-up-environment-variables-on-clever-cloud).
74
65
75
66
#### Multi-module build
76
67
77
-
If you have a single repository with multiple modules or want to build a specific module in a monorepo (and no top-level `stage` task), then you can specify the sbt task with `SBT_DEPLOY_GOAL`.
78
-
79
-
`CC_SBT_TARGET_DIR` must be set to the relative path of the module and `CC_SBT_TARGET_BIN` to the name of the binary to run.
80
-
81
-
For instance, if you want to deploy a module named `service1` that produce a binary named "my-binary", you have to define the following variables:
68
+
If you have a single repository with multiple modules or if you want to build a specific module in a monorepo (with no top-level `stage` task), you must set `SBT_DEPLOY_GOAL`, `CC_SBT_TARGET_DIR`, and `CC_SBT_TARGET_BIN`. For instance, if you want to deploy a module named `service1` that produces a binary named "my-binary", configuration should be:
82
69
83
70
```shell
84
71
SBT_DEPLOY_GOAL=service1/stage
85
72
CC_SBT_TARGET_DIR=service1
86
73
CC_SBT_TARGET_BIN=my-binary
87
74
```
88
75
89
-
Check details on [environment variables](#setting-up-environment-variables-on-clever-cloud).
90
-
91
-
Our engine will execute the `sbt service1/stage` and will run `service1/target/universal/stage/bin/my-binary`
76
+
The build command is `sbt service1/stage` and the application is started with `service1/target/universal/stage/bin/my-binary`.
92
77
93
-
**Note:** even when `CC_RUN_COMMAND` is configured `CC_SBT_TARGET_DIR` and `CC_SBT_TARGET_BIN` should be set to the correct values.
78
+
> [!NOTE]
79
+
> Even when `CC_RUN_COMMAND` is configured, `CC_SBT_TARGET_DIR` and `CC_SBT_TARGET_BIN` should be set to the correct values.
0 commit comments