首页 > 解决方案 > 使用 maven pom.xml 生成包含 WAR 文件的 Ear 文件

问题描述

我有一个应用程序的 EAR,我需要使用我自己的代码来扩展这个应用程序,该代码被打包为一个 WAR。是否有 maven 插件可以帮助我将 WAR 放入 EAR 中?

需要自动生成包含war文件的ear文件的解决方案

4.0.0 com.spring.example 示例 1 耳朵示例

<!-- Add Spring Web and MVC dependencies -->
<dependencies>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>4.3.9.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>4.3.9.RELEASE</version>
    </dependency>
    <!-- Servlet -->
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.5</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet.jsp</groupId>
        <artifactId>jsp-api</artifactId>
        <version>2.1</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>
    
    
    <dependency>
    
    <groupId>com.spring.example</groupId>
    <artifactId>example</artifactId>
   <version>1</version>
   <type>war</type>
    </dependency>   
</dependencies>
<build>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.6.1</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
        
        
        <plugin>
<artifactId>maven-ear-plugin</artifactId>
<version>2.3.2</version>
<configuration>
    <finalName>spring-mvc-example</finalName>

    <modules>
        <webModule>
           <groupId>com.spring.example</groupId>
    <artifactId>example</artifactId>
            <uri>example.war</uri>
            <bundleFileName>sexample.war</bundleFileName>
        </webModule>
    </modules>
</configuration>
maven-war-plugin 3.0.0 WebContent ${project.artifactId} 并在依赖生成war文件的行出现错误。所以我在哪里失踪请帮助我。

标签: maven

解决方案


推荐阅读