1、下載wlp.zip包:下載地址:https://developer.ibm.com/wasdev/downloads/#asset/runtimes-wlp-javaee8
2、解壓
3、啟動cmd命令:
進入 wlp/bin
目錄:(cd path_to_liberty是我自己的目錄)
-
Where path_to_liberty is the location you installed Liberty on your operating system.
- 執行以下命令(server_name是自己給自己的應用起的名字),創建的server在你liberty安裝路徑下的usr/services下面。
server create server_name
比如:server create myServer
4、將項目打成war包,放置到創建的serverName路徑下的dropins文件夾中。5、更改server.xml文件夾下的端口,與你的項目路徑端口一致<?xml version="1.0" encoding="UTF-8"?> <server description="new server"> <!-- Enable features --> <featureManager> <feature>javaee-8.0</feature> </featureManager> <!-- This template enables security. To get the full use of all the capabilities, a keystore and user registry are required. --> <!-- For the keystore, default keys are generated and stored in a keystore. To provide the keystore password, generate an encoded password using bin/securityUtility encode and add it below in the password attribute of the keyStore element. Then uncomment the keyStore element. --> <!-- <keyStore password=""/> --> <!--For a user registry configuration, configure your user registry. For example, configure a basic user registry using the basicRegistry element. Specify your own user name below in the name attribute of the user element. For the password, generate an encoded password using bin/securityUtility encode and add it in the password attribute of the user element. Then uncomment the user element. --> <basicRegistry id="basic" realm="BasicRealm"> <!-- <user name="yourUserName" password="" /> --> </basicRegistry> <!-- To access this server from a remote client add a host attribute to the following element, e.g. host="*" --> <!--host目錄代表配置的ip地址,如果不配置host的話,應用只能通過127.0.0.1訪問 --> <httpEndpoint id="defaultHttpEndpoint" host="*" httpPort="9080" httpsPort="9443" /> <!-- Automatically expand WAR files and EAR files --> <!-- <applicationManager autoExpand="true"/> --> <!--配置要發布的war包 localtion代表着war的位置,mo默認指向apps目錄下面, 如需要放在 apps/war目錄下面的話,localtion則改為 war/Test.war --> <application id="Test" location="Test.war" name="Test" type="war"/> </server>
6、在cmd中通過命令啟動和停止服務:
server start serverName;
server stop serverName;