-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdependencies.html.md.erb
75 lines (56 loc) · 1.9 KB
/
dependencies.html.md.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
---
title: Declare App Dependencies
owner: Daniel Freitag
---
<strong><%= modified_date %></strong>
<%= vars.product_short %> uses the Java buildpack to execute the uploaded JAR file as application package. The Java buildpack will run your application using the `main()` method of the `Main` class declared in the `build.gradle` file.
The dependencies needed for the application are also declared in the `build.gradle` file and are therefore included in the standalone JAR.
The `build.gradle` file of your deployed sample app looks something like this:
```groovy
apply plugin: 'java'
sourceCompatibility = 1.8
version = '1.0'
jar {
manifest {
attributes 'Implementation-Title': 'CF Java Sample App',
'Implementation-Version': version,
'Main-Class': 'com.swisscom.cloud.cloudfoundry.sampleapp.java.ProductService'
}
from {
(configurations.runtime).collect {
it.isDirectory() ? it : zipTree(it)
}
}
exclude 'META-INF/*.RSA', 'META-INF/*.SF','META-INF/*.DSA'
}
repositories {
mavenCentral()
}
dependencies {
compile 'com.sparkjava:spark-core:2.5'
compile 'com.fasterxml.jackson.core:jackson-databind:2.8.4'
}
...
```
The `build.gradle` file declares both the version of Java that will be used to run your application on <%= vars.product_short %>, as well as the dependencies that should be installed with your application.
To install the required dependencies, simply compile/build your application with:
<pre class="terminal">
$ gradle build
...
:compileJava
:processResources UP-TO-DATE
:classes
:jar
:assemble
:compileTestJava UP-TO-DATE
:processTestResources UP-TO-DATE
:testClasses UP-TO-DATE
:test UP-TO-DATE
:check UP-TO-DATE
:build
BUILD SUCCESSFUL
Total time: 6.78 secs
</pre>
<div style="text-align:center;margin:3em;">
<a href="./run-locally.html" class="btn btn-primary">I've installed the App dependencies locally</a>
</div>