LoginSignup
7
6

More than 5 years have passed since last update.

WebSphere Application ServerのMaven archetypes

Last updated at Posted at 2016-10-26

Mavenプロジェクトのarchetypeに、WebSphere Application Server(Liberty、Traditional)用のものがあることを知ったので、メモします。このarchetypeを使うと、pom.xmlやプロジェクト・ファセットを設定してくれて便利です。

IBM Knowledge Center > SSHR6W_9.0.0 > WebSphere Developer Tools > Developing Apache Maven projects > Example archetypes

archetypeの一部を抜粋。
image

(備考)IBMのサポートはなし

Note: These archetypes are not supported by IBM®. This information is provided for reference only.

Eclipseで、webapp-jee7-libertyを使ってMavenプロジェクトを作ってみます。

環境

Eclipse Java EE IDE for Web Developers
Version: Mars.1 Release (4.5.1)

Mavenプロジェクト作成(webapp-jee7-liberty使用)

  1. File > New > Maven Project をクリック
  2. 「Create a simple project (skip archetype selection)」にチェックはつけずに、「Next」
  3. Catalogを追加するため、「Configure」クリック
    image

  4. 「Add Remote Catalog」クリック
    image

  5. 「url」を入力し、「OK」クリック
    url: http://central.maven.org/maven2/
    image

  6. Archetypesウィンドウで「OK」クリック

  7. 「Filter」でWASのものに絞り、「webapp-jee7-liberty」を選択し、「Next」クリック
    Filter: net.wasdev.maven.tools.archetypes
    image

  8. ウィザードに従って、プロジェクトのGroup Id等のパラメータを設定して、完了

完成したMavenプロジェクトを見てみる

こんな感じでできます。

image

pom.xmlを見ると、「liberty-target」というdependencyが設定されています。
image

これは、Libertyのクラスパスをエミュレートするもので、ライブラリーのMaven Dependenciesを見ると、WASのjarが入っているのがわかります。
image

Knowledge Center > Configuring dependency POM files that emulate the classpath of specific WebSphere runtime environments

liberty-target
This dependency aggregates all of the WebSphere Application Server Liberty API, SPI, recommended Java specification dependencies, and third-party implementation dependencies.

もし、WASのarchetypeを使ってMavenプロジェクトを使ってなかったら、後からpom.xmlにdependencyを入れてあげれば、パス通せます。

<dependency>
      <groupId>net.wasdev.maven.tools.targets</groupId>
      <artifactId>liberty-target</artifactId>
      <version>RELEASE</version>
      <type>pom</type>
      <scope>provided</scope>
</dependency>

※versionのところは明示的に「8.5.5.9」などバージョン指定できる

プロジェクト・ファセットは、こんな感じで入ってます。

image

以上。

7
6
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
6