Skip to content

Commit 656bba4

Browse files
committed
Uber jar example
1 parent 3f1e11c commit 656bba4

File tree

3 files changed

+38
-2
lines changed

3 files changed

+38
-2
lines changed

canteen/README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,22 @@ Bundle your jar as an executable jar, and add the `canteen-maven-plugin` to your
2020
```xml
2121
<build>
2222
<plugins>
23-
<!-- Make the jar executable (for java -jar) -->
23+
<!-- Shade dependencies into an uber jar -->
24+
<plugin>
25+
<groupId>org.apache.maven.plugins</groupId>
26+
<artifactId>maven-shade-plugin</artifactId>
27+
<version>3.2.1</version>
28+
<executions>
29+
<execution>
30+
<phase>package</phase>
31+
<goals>
32+
<goal>shade</goal>
33+
</goals>
34+
</execution>
35+
</executions>
36+
</plugin>
37+
38+
<!-- Populate the jar's manifest main class to make it executable -->
2439
<plugin>
2540
<groupId>org.apache.maven.plugins</groupId>
2641
<artifactId>maven-jar-plugin</artifactId>

canteen/canteen-it/pom.xml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919
<artifactId>canteen-it</artifactId>
2020

2121
<dependencies>
22+
<dependency>
23+
<groupId>com.google.guava</groupId>
24+
<artifactId>guava</artifactId>
25+
<version>21.0</version>
26+
</dependency>
2227
<dependency>
2328
<groupId>junit</groupId>
2429
<artifactId>junit</artifactId>
@@ -42,6 +47,20 @@
4247

4348
<build>
4449
<plugins>
50+
<plugin>
51+
<groupId>org.apache.maven.plugins</groupId>
52+
<artifactId>maven-shade-plugin</artifactId>
53+
<version>3.2.1</version>
54+
<executions>
55+
<execution>
56+
<phase>package</phase>
57+
<goals>
58+
<goal>shade</goal>
59+
</goals>
60+
</execution>
61+
</executions>
62+
</plugin>
63+
4564
<plugin>
4665
<groupId>org.apache.maven.plugins</groupId>
4766
<artifactId>maven-jar-plugin</artifactId>

canteen/canteen-it/src/main/java/com/salesforce/servicelibs/canteen/it/Main.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
package com.salesforce.servicelibs.canteen.it;
99

10+
import com.google.common.base.Strings;
11+
1012
import java.io.BufferedReader;
1113
import java.io.InputStreamReader;
1214

@@ -21,7 +23,7 @@ public static void main(String[] args) throws Exception {
2123
if (args.length == 1) {
2224
choice = args[0];
2325
} else {
24-
System.out.print("1 = Success, 0 = Failure > ");
26+
System.out.print("1 = Success, 0 = Failure >" + Strings.repeat(" ", 2));
2527
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
2628
choice = br.readLine();
2729
}

0 commit comments

Comments
 (0)