websphere 的 Maven 打包

Maven packaging for websphere

我正在尝试构建一个 EAR 文件 - 它可以部署在 IBM websphere 服务器中。 这是一个现有的 struts 应用程序,我正在尝试对其进行 mavenize。 该项目包含两个文件夹

   1. web
   2. webEAR

web 实际上是 war 文件和 EAR 文件的 webEAR 文件夹,web 包含所有代码,webEAR 是一种包装器。

我已经完成的步骤如下

  1. IDE - 日食
  2. Java 版本 - 1.7
  3. 将 web 和 webEAR 转换为 Maven -(配置为 Maven)
  4. 编辑 POM.XML 如下所示

<modelVersion>4.0.0</modelVersion>
 <groupId>com.comp.web</groupId>
 <artifactId>web</artifactId>
 <version>0.0.1</version>
 <packaging>war</packaging>
 <name>WEB</name>
 <description>WEB</description>

added all relevant jar files - which are in lib folder as below (sample)

<dependency>
 <groupId>jarfile</groupId>
    <artifactId>com.ibm.jar</artifactId>
    <version>1.0</version>
    <scope>system</scope>  
<systemPath>${basedir}/WebContent/WEBINF/lib/com.ibm.jarfile.jar</systemPat>
 </dependency>

现在我在 eclipse 中没有任何错误,我可以通过右键单击服务器中的 webEAR 文件夹 -> 运行 来 运行 应用程序,它可以工作。

但我不确定如何创建一个包含 war 文件的 EAR 文件,以便我可以在 WAS 服务器开发环境中进行部署。

谁能告诉我如何做到这一点。当前 webEAR maven 文件夹

中没有 POM.xml

P.S - 我不是 Java 开发人员。这是我被分配到的第一个 Maven 相关项目。感谢任何帮助

你的模块应该有 <packaging>ear</packaging>.

在此 ear 模块的依赖项中(使用新模块构建 ear)包含您的 war 模块,如下所示。

<dependency>
    <groupId>com.comp.webGroupId</groupId>
    <artifactId>war-artifact</artifactId>
    <version> war-version</version>
    <type>war</type>
</dependency>

在这个 ear 模块的构建插件中包括 maven-ear-plugin。

<plugin>
    <artifactId>maven-ear-plugin</artifactId>
    <version>3.0.0</version>
    <configuration>
        <finalName>web</finalName>
        <version>versionNumber</version>
        <generatedDescriptorLocation>${basedir}/src/main/application/META-INF</generatedDescriptorLocation>
        <modules>
            <webModule>
                <groupId>com.comp.webGroupId</groupId>
                <artifactId>war-artifact</artifactId>
                <uri>web.war</uri>
                <bundleFileName>web.war</bundleFileName>
                <contextRoot>/applicationName</contextRoot>
            </webModule>
        </modules>
    </configuration>
</plugin>

根据需要添加任何特定的配置值。