Skip to content

Commit e8acbbb

Browse files
committed
Update samples to be packaged in executable jars
1 parent fc53454 commit e8acbbb

File tree

13 files changed

+120
-20
lines changed

13 files changed

+120
-20
lines changed

pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -272,11 +272,6 @@
272272
<artifactId>maven-deploy-plugin</artifactId>
273273
<version>${maven-deploy-plugin.version}</version>
274274
</plugin>
275-
<plugin>
276-
<groupId>org.springframework.boot</groupId>
277-
<artifactId>spring-boot-maven-plugin</artifactId>
278-
<version>${spring-boot.version}</version>
279-
</plugin>
280275
</plugins>
281276
</build>
282277

run-sample.sh

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,32 +19,27 @@ case "$choice" in
1919
1)
2020
echo ""
2121
echo "Running: hello-world"
22-
./mvnw -pl org.springframework.shell:spring-shell-sample-hello-world \
23-
exec:java -Dexec.mainClass=org.springframework.shell.samples.helloworld.SpringShellApplication
22+
java -jar spring-shell-samples/spring-shell-sample-hello-world/target/hello-world.jar
2423
;;
2524
2)
2625
echo ""
2726
echo "Running: non-interactive"
28-
./mvnw -pl org.springframework.shell:spring-shell-sample-non-interactive \
29-
spring-boot:run -Dspring-boot.run.arguments=hi
27+
java -jar spring-shell-samples/spring-shell-sample-non-interactive/target/non-interactive.jar hi
3028
;;
3129
3)
3230
echo ""
3331
echo "Running: petclinic"
34-
./mvnw -pl org.springframework.shell:spring-shell-sample-petclinic \
35-
exec:java -Dexec.mainClass=org.springframework.shell.samples.petclinic.SpringShellApplication
32+
java -jar spring-shell-samples/spring-shell-sample-petclinic/target/petclinic.jar
3633
;;
3734
4)
3835
echo ""
3936
echo "Running: secure-input"
40-
./mvnw -pl org.springframework.shell:spring-shell-sample-secure-input \
41-
spring-boot:run
37+
java -jar spring-shell-samples/spring-shell-sample-secure-input/target/secure-input.jar
4238
;;
4339
5)
4440
echo ""
4541
echo "Running: spring-boot"
46-
./mvnw -pl org.springframework.shell:spring-shell-sample-spring-boot \
47-
spring-boot:run
42+
java -jar spring-shell-samples/spring-shell-sample-spring-boot/target/hello-world-boot.jar
4843
;;
4944
*)
5045
echo "Invalid choice: '$choice'. Please enter a number between 1 and 5." >&2

spring-shell-samples/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@
2323

2424
<build>
2525
<plugins>
26+
<plugin>
27+
<groupId>org.springframework.boot</groupId>
28+
<artifactId>spring-boot-maven-plugin</artifactId>
29+
<version>${spring-boot.version}</version>
30+
</plugin>
2631
<plugin>
2732
<groupId>org.apache.maven.plugins</groupId>
2833
<artifactId>maven-deploy-plugin</artifactId>

spring-shell-samples/spring-shell-sample-hello-world/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ To build the project, navigate to the project's root directory and run the follo
1515
To run the application, use the following command:
1616

1717
```bash
18-
./mvnw -pl org.springframework.shell:spring-shell-sample-hello-world exec:java -Dexec.mainClass=org.springframework.shell.samples.helloworld.SpringShellApplication
18+
java -jar spring-shell-samples/spring-shell-sample-hello-world/target/hello-world.jar
1919
```
2020

2121
You should see a prompt where you can enter commands.

spring-shell-samples/spring-shell-sample-hello-world/pom.xml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,25 @@
2727
</dependency>
2828
</dependencies>
2929

30+
<build>
31+
<plugins>
32+
<plugin>
33+
<groupId>org.springframework.boot</groupId>
34+
<artifactId>spring-boot-maven-plugin</artifactId>
35+
<executions>
36+
<execution>
37+
<goals>
38+
<goal>repackage</goal>
39+
</goals>
40+
</execution>
41+
</executions>
42+
<configuration>
43+
<mainClass>org.springframework.shell.samples.helloworld.SpringShellApplication</mainClass>
44+
<layout>JAR</layout>
45+
<finalName>hello-world</finalName>
46+
</configuration>
47+
</plugin>
48+
</plugins>
49+
</build>
50+
3051
</project>

spring-shell-samples/spring-shell-sample-non-interactive/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ To build the project, navigate to the project's root directory and run the follo
1515
To run the application and invoke the `hi` command in a non-interactive way, use the following command:
1616

1717
```bash
18-
./mvnw -pl org.springframework.shell:spring-shell-sample-non-interactive spring-boot:run -Dspring-boot.run.arguments=hi
18+
java -jar spring-shell-samples/spring-shell-sample-non-interactive/target/non-interactive.jar hi
1919
```
2020

2121
You should see the result of the `hi` command printed in the console output.

spring-shell-samples/spring-shell-sample-non-interactive/pom.xml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,25 @@
2626
</dependency>
2727
</dependencies>
2828

29+
<build>
30+
<plugins>
31+
<plugin>
32+
<groupId>org.springframework.boot</groupId>
33+
<artifactId>spring-boot-maven-plugin</artifactId>
34+
<executions>
35+
<execution>
36+
<goals>
37+
<goal>repackage</goal>
38+
</goals>
39+
</execution>
40+
</executions>
41+
<configuration>
42+
<mainClass>org.springframework.shell.samples.noninteractive.SpringShellApplication</mainClass>
43+
<layout>JAR</layout>
44+
<finalName>non-interactive</finalName>
45+
</configuration>
46+
</plugin>
47+
</plugins>
48+
</build>
49+
2950
</project>

spring-shell-samples/spring-shell-sample-petclinic/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ To build the project, navigate to the project's root directory and run the follo
1515
To run the application, use the following command:
1616

1717
```bash
18-
./mvnw -pl org.springframework.shell:spring-shell-sample-petclinic exec:java -Dexec.mainClass=org.springframework.shell.samples.petclinic.SpringShellApplication
18+
java -jar spring-shell-samples/spring-shell-sample-petclinic/target/petclinic.jar
1919
```
2020

2121
You should see a prompt where you can enter commands.

spring-shell-samples/spring-shell-sample-petclinic/pom.xml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,25 @@
3737
</dependency>
3838
</dependencies>
3939

40+
<build>
41+
<plugins>
42+
<plugin>
43+
<groupId>org.springframework.boot</groupId>
44+
<artifactId>spring-boot-maven-plugin</artifactId>
45+
<executions>
46+
<execution>
47+
<goals>
48+
<goal>repackage</goal>
49+
</goals>
50+
</execution>
51+
</executions>
52+
<configuration>
53+
<mainClass>org.springframework.shell.samples.petclinic.SpringShellApplication</mainClass>
54+
<layout>JAR</layout>
55+
<finalName>petclinic</finalName>
56+
</configuration>
57+
</plugin>
58+
</plugins>
59+
</build>
60+
4061
</project>

spring-shell-samples/spring-shell-sample-secure-input/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ To build the project, navigate to the project's root directory and run the follo
1515
To run the application, use the following command:
1616

1717
```bash
18-
./mvnw -pl org.springframework.shell:spring-shell-sample-secure-input spring-boot:run
18+
java -jar spring-shell-samples/spring-shell-sample-secure-input/target/secure-input.jar
1919
```
2020

2121
You should see a prompt where you can use the `change-password` command to securely input and change a password.

0 commit comments

Comments
 (0)