Liberty:Maven 目標 - liberty:install-apps
您可以利用 liberty:install-apps 目標,將一或多個應用程式複製到 Liberty 伺服器中。
liberty:install-apps 目標會將指定為 Maven 相依關係的應用程式,複製到 Liberty 伺服器的 dropins/ 目錄中。只有 compile 範圍中的 Maven 相依關係會複製到伺服器中。 伺服器必須存在,且不能在執行中。 liberty:install-apps 目標可以結合 liberty:package-server 目標,來建立含有預先安裝之應用程式的 Liberty 伺服器保存檔。
參數
下表說明 install-apps 目標的參數。
參數 | 說明 | 必要 |
---|---|---|
serverHome | Liberty 伺服器安裝架構的目錄位置。 | 是,只在未設定 assemblyArchive 和 assemblyArtifact 參數之時。 |
assemblyArchive | Liberty 伺服器壓縮保存檔的位置。這個保存檔會解壓縮到 installDirectory 參數所指定的目錄中。 | 是,只在未設定 serverHome 和 assemblyArtifact 參數之時。 |
assemblyArtifact | Liberty 伺服器組合的 Maven 構件名稱。組合會安裝到 installDirectory 參數所指定的目錄中。如需 Liberty 伺服器 Maven 組合的相關資訊,請參閱Liberty:安裝為 Maven 構件。 | 是,只在未設定 serverHome 和 assemblyArchive 參數之時。 |
installDirectory | 當利用組合保存檔或構件選項來安裝 Liberty 伺服器時,該伺服器的本端安裝目錄位置。預設值為 ${project.build.directory} /liberty。 | 否 |
refresh | 如果是 true,則將 Liberty 伺服器重新安裝到本端目錄中。只有在利用組合保存檔或構件選項來安裝伺服器時,才使用這個參數。 預設值為 false。 | 否 |
serverName | Liberty 伺服器實例的名稱。預設值為 defaultServer。 | 否 |
- 範例:安裝應用程式
- 這是可以在產品的 pom.xml 檔中使用的程式碼 Snippet。
<build> ... <dependencies> <!-- 要安裝及包裝的應用程式 --> <dependency> <groupId>wasdev</groupId> <artifactId>SimpleServlet</artifactId> <version>1.0</version> <type>war</type> </dependency> </dependencies> ... <plugins> <plugin> <groupId>com.ibm.websphere.wlp.maven.plugins</groupId> <artifactId>liberty-maven-plugin</artifactId> <version>1.0</version> <executions> ... <execution> <id>install-apps</id> <phase>compile</phase> <goals> <goal>install-apps</goal> </goals> </execution> ... <executions> <configuration> <serverHome>/opt/ibm/wlp</serverHome> <serverName>test</serverName> </configuration> </plugin> </plugins> ... </build>