簡體   English   中英

Maven將戰爭模塊植入耳朵

[英]Maven build war modules into an ear

我有一個帶有耳朵包裝的maven項目,包括兩個webModule和對Maven WAR軟件包的依賴關系。 每當我進行更改時,我首先需要通過“ maven全新安裝”手動構建兩次戰爭,最后我總是通過“ maven全新安裝”構建耳朵。

<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戰爭和耳朵的方式?

非常感謝

創建一個適當的目錄結構:

 +-- root (pom.xml)
      +--- war-module1 (pom.xml)
      +--- war-module2 (pom.xml)
      +--- ear-module (pom.xml)

將現有模塊列表放入根pom(模塊列表)中,並定義模塊之間的適當依賴關系。 現在,您可以通過以下方法從根本上一次構建所有內容:

mvn clean package 

或者如果您需要:

mvn clean install

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM