新增模組至 EAR 專案

您可以新增模組至 EAR 專案,這些模組可以是 Maven 專案或 Maven 保存檔。

關於這項作業

重要: 適用於 Liberty 和 WebSphere® Application Server 傳統版

程序

  1. 存取「新增相依關係」對話框。 按兩下 pom.xml 檔,來開啟 POM 編輯器。按一下相依關係標籤,然後按一下新增。
  2. 輸入模組的值。 輸入您想新增之模組的群組 ID 和構件 ID。或者,您可以使用過濾器欄位來搜尋模組。
  3. 選取模組,然後按一下確定。
  4. 在 maven-ear-plugin 中配置模組。 按一下 pom.xml 標籤,以直接處理 POM 原始檔。配置模組。下列範例顯示 Web 模組的配置。如需支援的模組清單,請參閱 http://maven.apache.org/plugins/maven-ear-plugin/modules.html。
    <plugin>
       <artifactId>maven-ear-plugin</artifactId>
       <version>2.7</version>
       <configuration>
          <version>6</version>
          <modules>
             <webModule>
                <groupId>sample</groupId>
                <artifactId>webapp</artifactId>
    				   <!-- More configuration can be set here -->
             </webModule>
          </modules>
       </configuration>
    </plugin>
  5. 儲存 pom.xml 檔。
  6. 更新專案。 用滑鼠右鍵按一下 EAR 專案,並選取 Maven > 更新專案。當完成時,請按一下確定。
  7. 驗證模組已新增至部署組合。 用滑鼠右鍵按一下該專案,並選取內容。按一下部署組合。
  8. 如果 EAR 有部署描述子檔案 META-INF/application.xml,請驗證已將模組新增至這個檔案。
Icon that indicates the type of topic Task topic
Timestamp icon Last updated: last_date

File name: add_mods_to_ear.html