首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Maven将war模块构建到ear中

Maven将war模块构建到ear中
EN

Stack Overflow用户
提问于 2018-03-29 23:21:41
回答 1查看 826关注 0票数 1

我有一个带有ear打包的maven项目,包括两个webModule和对maven WAR包的依赖。每当我构建更改时,我首先需要通过"maven clean install“手动构建两个war,最后我总是通过"maven clean install”构建ear。

代码语言:javascript
复制
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>it.test.esempio.fe</groupId>
        <artifactId>ESEMPIO_FE_PTL_PARENT</artifactId>
        <version>1.32.0-SNAPSHOT</version>
        <relativePath>../pom.xml</relativePath>
    </parent>
    <artifactId>ESEMPIO_FE_TEMA_COMPLETO</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <packaging>ear</packaging>
    <dependencies>
        <!-- START: PROJECT DEPENDENCIES -->
        <dependency>
            <groupId>it.test.esempio.fe</groupId>
            <artifactId>ESEMPIO_FE_TEMA_COMPLETO_STATICO</artifactId>
            <version>1.0.0-SNAPSHOT</version>
            <type>war</type>
        </dependency>
        <dependency>
            <groupId>it.test.esempio.fe</groupId>
            <artifactId>ESEMPIO_FE_TEMA_COMPLETO_DINAMICO</artifactId>
            <version>1.0.0-SNAPSHOT</version>
            <type>war</type>
        </dependency>
        <!-- END: PROJECT DEPENDENCIES -->
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-ear-plugin</artifactId>
                <version>2.10.1</version>
                <configuration>
                    <version>6</version>
                    <modules>
                        <webModule>
                            <groupId>it.test.esempio.fe</groupId>
                            <artifactId>ESEMPIO_FE_TEMA_COMPLETO_DINAMICO</artifactId>
                            <bundleFileName>ESEMPIO_FE_TEMA_COMPLETO_DINAMICO.war</bundleFileName>
                            <contextRoot>wps/ESEMPIO_FE_TEMA_COMPLETO_DINAMICO</contextRoot>
                        </webModule>
                        <webModule>
                            <groupId>it.test.esempio.fe</groupId>
                            <artifactId>ESEMPIO_FE_TEMA_COMPLETO_STATICO</artifactId>
                            <bundleFileName>ESEMPIO_FE_TEMA_COMPLETO_STATICO.war</bundleFileName>
                            <contextRoot>wps/ESEMPIO_FE_TEMA_COMPLETO_STATICO</contextRoot>
                        </webModule>
                    </modules>
                    <defaultLibBundleDir>lib</defaultLibBundleDir>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

是否有可能使用一个构建命令自动构建2个war和ear?

非常感谢

EN

回答 1

Stack Overflow用户

发布于 2018-03-30 20:45:31

创建适当的目录结构:

代码语言:javascript
复制
 +-- root (pom.xml)
      +--- war-module1 (pom.xml)
      +--- war-module2 (pom.xml)
      +--- ear-module (pom.xml)

将现有模块的列表放入根pom (模块列表)..and中,定义模块之间的适当依赖关系。现在,您可以简单地从root通过以下命令一次性构建所有内容:

代码语言:javascript
复制
mvn clean package 

或者,如果您需要:

代码语言:javascript
复制
mvn clean install
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49559732

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档