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
To begin, navigate to the `start` directory. Build the `system` microservice that is provided and deploy it to Open Liberty by running the Maven `liberty:run` goal:
80
80
81
+
include::{common-includes}/os-tabs.adoc[]
82
+
83
+
[.tab_content.windows_section]
84
+
--
85
+
[role='command']
86
+
```
87
+
cd start
88
+
mvnw.cmd liberty:run
89
+
```
90
+
--
91
+
92
+
[.tab_content.mac_section]
93
+
--
81
94
[role='command']
82
95
```
83
96
cd start
84
-
mvn liberty:run
97
+
./mvnw liberty:run
85
98
```
99
+
--
86
100
87
-
The `mvn` command initiates a Maven build, during which the `target` directory is created to store all build-related files.
101
+
[.tab_content.linux_section]
102
+
--
103
+
[role='command']
104
+
```
105
+
cd start
106
+
./mvnw liberty:run
107
+
```
108
+
--
109
+
110
+
The Maven command initiates a Maven build, during which the `target` directory is created to store all build-related files.
88
111
89
112
The `liberty:run` argument specifies the Open Liberty `run` goal, which starts an Open Liberty instance in the foreground. As part of this phase, an Open Liberty runtime is downloaded and installed into the `target/liberty/wlp` directory, an instance of Liberty is created and configured in the `target/liberty/wlp/usr/servers/defaultServer` directory, and the application is installed into that instance using https://www.ibm.com/support/knowledgecenter/en/SSEQTP_liberty/com.ibm.websphere.wlp.doc/ae/rwlp_loose_applications.html[loose config^].
90
113
@@ -110,10 +133,31 @@ To access the `system` microservice, see the http://localhost:9080/system/proper
110
133
111
134
When you need to stop the Liberty instance, press `CTRL+C` in the command-line session where you ran Liberty, or run the `liberty:stop` goal from the `start` directory in another command-line session:
// Starting and stopping Open Liberty in the background
@@ -123,11 +167,35 @@ mvn liberty:stop
123
167
124
168
Although you can start and stop Liberty in the foreground by using the Maven `liberty:run` goal, you can also start and stop the Liberty instance in the background with the Maven `liberty:start` and `liberty:stop` goals:
@@ -140,10 +208,32 @@ The Open Liberty Maven plug-in includes a `dev` goal that listens for any change
140
208
141
209
Stop the Open Liberty instance if it is running, and start it in https://openliberty.io/docs/latest/development-mode.html[dev mode^] by running the `liberty:dev` goal in the `start` directory:
142
210
211
+
include::{common-includes}/os-tabs.adoc[]
212
+
213
+
[.tab_content.windows_section]
214
+
--
143
215
[role='command']
144
216
```
145
-
mvn liberty:dev
217
+
mvnw.cmd liberty:dev
146
218
```
219
+
--
220
+
221
+
[.tab_content.mac_section]
222
+
--
223
+
[role='command']
224
+
```
225
+
./mvnw liberty:dev
226
+
```
227
+
--
228
+
229
+
[.tab_content.linux_section]
230
+
--
231
+
[role='command']
232
+
```
233
+
./mvnw liberty:dev
234
+
```
235
+
236
+
--
147
237
148
238
Dev mode automatically picks up changes that you make to your application and allows you to run tests by pressing the `enter/return` key in the active command-line session. When you’re working on your application, rather than rerunning Maven commands, press the `enter/return` key to verify your change.
149
239
@@ -190,8 +280,8 @@ Try to access the `/health` endpoint again by visiting the http://localhost:9080
190
280
[source, JSON, role="no_copy"]
191
281
----
192
282
{
193
-
"checks":[],
194
-
"status":"UP"
283
+
"status":"UP",
284
+
"checks":[]
195
285
}
196
286
----
197
287
@@ -264,26 +354,26 @@ Access the `/health` endpoint again by going to the http://localhost:9080/health
264
354
265
355
[source, JSON, role="no_copy"]
266
356
----
267
-
{
268
-
"checks":[
269
-
{
270
-
"data":{},
271
-
"name":"SystemResource Readiness Check",
272
-
"status":"UP"
273
-
},
274
-
{
275
-
"data":{},
276
-
"name":"SystemResource Liveness Check",
277
-
"status":"UP"
278
-
}
279
-
],
280
-
"status":"UP"
357
+
{
358
+
"status": "UP",
359
+
"checks": [
360
+
{
361
+
"name":"SystemResource Liveness Check",
362
+
"status":"UP",
363
+
"data": {}
364
+
},
365
+
{
366
+
"name":"SystemResource Readiness Check",
367
+
"status":"UP",
368
+
"data": {}
369
+
}
370
+
]
281
371
}
282
372
----
283
373
284
374
You can also access the `/health/ready` endpoint by going to the http://localhost:9080/health/ready[http://localhost:9080/health/ready^] URL to view the data from the readiness health check. Similarly, access the `/health/live` endpoint by going to the http://localhost:9080/health/live[http://localhost:9080/health/live^] URL to view the data from the liveness health check.
285
375
286
-
Making code changes and recompiling is fast and straightforward. Open Liberty dev mode automatically picks up changes in the `.class` files and artifacts, without needing to be restarted. Alternatively, you can run the `run` goal and manually repackage or recompile the application by using the `mvn package` command or the `mvn compile` command while Liberty is running. Dev mode was added to further improve the developer experience by minimizing turnaround times.
376
+
Making code changes and recompiling is fast and straightforward. Open Liberty dev mode automatically picks up changes in the `.class` files and artifacts, without needing to be restarted. Alternatively, you can run the `run` goal and manually repackage or recompile the application by using the Maven `package` goal or the Maven `compile` goal while Liberty is running. Dev mode was added to further improve the developer experience by minimizing turnaround times.
To containerize the application, you need a `Dockerfile`. This file contains a collection of instructions that define how a Docker image is built, what files are packaged into it, what commands run when the image runs as a container, and other information. You can find a complete `Dockerfile` in the `start` directory. This `Dockerfile` copies the `.war` file into a Docker image that contains the Java runtime and a preconfigured Open Liberty runtime.
348
438
349
-
Run the `mvn package` command from the `start` directory so that the `.war` file resides in the `target` directory.
439
+
Run the Maven `package` goal from the `start` directory so that the `.war` file resides in the `target` directory.
440
+
441
+
include::{common-includes}/os-tabs.adoc[]
350
442
443
+
[.tab_content.windows_section]
444
+
--
351
445
[role='command']
352
446
```
353
-
mvn package
447
+
mvnw.cmd package
354
448
```
449
+
--
355
450
451
+
[.tab_content.mac_section]
452
+
--
453
+
[role='command']
454
+
```
455
+
./mvnw package
456
+
```
457
+
--
458
+
459
+
[.tab_content.linux_section]
460
+
--
461
+
[role='command']
462
+
```
463
+
./mvnw package
464
+
```
465
+
466
+
--
356
467
357
468
358
469
To build and containerize the application, run the following Docker build command in the `start` directory:
@@ -435,17 +546,38 @@ Build and run the container by running the devc goal from the `start` directory:
@@ -566,10 +698,34 @@ So far, Open Liberty was running out of the `target/liberty/wlp` directory, whic
566
698
Open Liberty supports a number of different server packages. The sample application currently generates a `usr` package that contains the Liberty runtime and application to be extracted onto an Open Liberty installation.
567
699
568
700
Instead of creating a server package, you can generate a runnable JAR file that contains the application along with a Liberty runtime. This JAR file can then be run anywhere and deploy your application and runtime at the same time. To generate a runnable JAR file, override the `include` property:
701
+
702
+
include::{common-includes}/os-tabs.adoc[]
703
+
704
+
[.tab_content.windows_section]
705
+
--
706
+
[role='command']
707
+
```
708
+
mvnw.cmd liberty:package -Dinclude=runnable
709
+
```
710
+
--
711
+
712
+
[.tab_content.mac_section]
713
+
--
569
714
[role='command']
570
715
```
571
-
mvn liberty:package -Dinclude=runnable
716
+
./mvnw liberty:package -Dinclude=runnable
572
717
```
718
+
--
719
+
720
+
[.tab_content.linux_section]
721
+
--
722
+
[role='command']
723
+
```
724
+
./mvnw liberty:package -Dinclude=runnable
725
+
```
726
+
727
+
--
728
+
573
729
574
730
The packaging type is overridden from the `usr` package to the `runnable` package. This property then propagates to the [hotspot=libertyMavenPlugin file=0]`liberty-maven-plugin` plug-in, which generates the server package based on the `openliberty-kernel` package.
0 commit comments