安裝為 Maven 構件

您可以將 Liberty 伺服器安裝為 Maven 構件。安裝為 Maven 構件有兩個選項:使用 Maven 安裝外掛程式及使用 Liberty 組合包裝方法。

使用 Maven 安裝外掛程式

用法:

您可以利用 maven-install-plugin,將包含 Liberty 伺服器檔案的壓縮保存檔安裝成 Maven 構件。 例如,您可以利用 liberty:package-server 目標來產生壓縮保存檔。

範例:使用指令行
mvn install:install-file
    -Dfile=/opt/ibm/wlp.zip \
    -DgroupId=myGroup \
    -DartifactId=myServer \
    -Dversion=1.0 \
    -Dpackaging=zip \
範例:使用 pom.xml
這是可以在產品的 pom.xml 檔中使用的程式碼 Snippet。
...
<plugin>
    <!-- 將 Liberty 伺服器 zip 安裝在本端 Maven 儲存庫中 -->
    <groupId>org.apache.maven.plugins</groupId>
    	<artifactId>maven-install-plugin</artifactId>
    	<version>2.2</version>
    	<executions>
        		<execution>
            			<id>install-liberty-to-repo</id>
            			<phase>process-resources</phase>
            			<goals>
                				<goal>install-file</goal>
            			</goals>
            <configuration>
                <file>/opt/ibm/wlp.zip</file>
                <groupId>myGroup</groupId>
                <artifactId>myServer</artifactId>
                	<version>1.0</version>
                				<packaging>zip</packaging>
           </configuration>
       		</execution>
</plugin> ...

使用 Liberty 組合

用法:

您可以利用 liberty-assembly 包裝類型,從現有的伺服器安裝架構、壓縮保存檔或另一個伺服器 Maven 構件,建立 Liberty 伺服器 Maven 構件。 任何指定為 Maven compile 相依關係的應用程式,都會隨著組合的伺服器而自動包裝在 dropins/ 目錄中。

範例:使用 liberty-assembly 包裝類型
這是可以在產品的 pom.xml 檔中使用的程式碼 Snippet。
<project>
    ...
    <groupId>myGroup</groupId>
    <artifactId>myServer</artifactId>
    <!-- Create Liberty server assembly -->
    <packaging>liberty-assembly</packaging>
    ...
    <dependencies>
        <!-- Package SimpleServlet.war with server assembly -->
        <dependency>
            <groupId>wasdev</groupId>
            <artifactId>SimpleServlet</artifactId>
            	<version>1.0</version>
            <type>war</type>
        </dependency>
    </dependencies>
    ...
    <build>
        <plugins>
            <!-- Enable liberty-maven-plugin -->
            <plugin>
                	<groupId>com.ibm.websphere.wlp.maven.plugins</groupId>
                	<artifactId>liberty-maven-plugin</artifactId>
                	<version>1.0</version>
                <extensions>true</extensions>
                <configuration>
                    <serverHome>/opt/ibm/wlp</serverHome>
                    			<serverName>test</serverName>
                </configuration>
            </plugin>         </plugins>
    </build>
    ...        
</project>

指示主題類型的圖示 參照主題



「時間戳記」圖示 前次更新: 2016 年 11 月 30 日
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-libcore-mp&topic=rwlp_maven_artifact
檔名:rwlp_maven_artifact.html