簡體   English   中英

部署多個Maven配置文件

[英]Deploying multiple maven profiles

我想通過cargo:deploy同時向Tomcat 7和Weblogic容器部署war 就目前而言,我一次只能啟用一個配置文件。

這是我目前擁有的:

<profiles>
    <!--  *********************************************************************
                          CARGO - FOR TOMCAT.
                          Activated when file ${env.USERPROFILE}/foo.bar exists (which should be there after successful Tomcat tookit install)
              ********************************************************************* -->
    <profile>
        <id>tomcat</id>
        <activation>
            <file><exists>${env.USERPROFILE}/foo.bar</exists></file>
        </activation>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.codehaus.cargo</groupId>
                    <artifactId>cargo-maven2-plugin</artifactId>
                    <version>${cargo-maven2-plugin.version}</version>
                    <configuration>
                        <container>
                            <containerId>tomcat7x</containerId>
                            <type>installed</type>
                            <home>${env.USERPROFILE}/foo/apache-tomcat-7.0.57</home>
                            <timeout>180000</timeout>
                        </container>
                        <configuration>
                            <type>existing</type>
                            <home>${env.USERPROFILE}/foo/apache-tomcat-7.0.57</home>
                        </configuration>
                        <deployables>
                            <deployable>
                                <groupId>${project.groupId}</groupId>
                                <artifactId>${project.artifactId}</artifactId>
                                <type>war</type>
                                <properties>
                                    <!--No slash needed before the context-->
                                    <context>sec-captc</context>
                                </properties>
                            </deployable>
                        </deployables>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </profile>


  <!--  *********************************************************************
                              CARGO - FOR WEBLOGIC
                    ********************************************************************* -->
    <profile>
        <id>weblogic</id>
        <activation>
            <file><exists>${env.USERPROFILE}/foo.bar</exists></file>
        </activation>
        <build><plugins>
            <plugin>
                <groupId>org.codehaus.cargo</groupId>
                <artifactId>cargo-maven2-plugin</artifactId>
                <version>${cargo-maven2-plugin.version}</version>
                <configuration>
                    <container>
                        <containerId>weblogic12x</containerId>
                        <type>installed</type>
                        <home>${installed-weblogic.home}/foo</home>
                        <timeout>180000</timeout>
                    </container>
                    <configuration>
                        <type>existing</type>
                        <home>${installed-weblogic.domain}</home>
                    </configuration>
                    <deployables>
                        <deployable>
                            <groupId>${project.groupId}</groupId>
                            <artifactId>${project.artifactId}</artifactId>
                            <type>war</type>
                            <properties>
                                <context>/${installed-weblogic.war.contextpath}</context>
                            </properties>
                        </deployable>
                    </deployables>
                </configuration>
            </plugin>
        </plugins></build>
    </profile>
</profiles>

我需要添加/更改什么才能使其同時工作?

您確定只有一個配置文件處於活動狀態嗎? 可能兩個都處於活動狀態,但是cargo-maven2-plugin插件執行使用相同的ID,因此只能執行一個。

在概要文件中,看起來您已經為每個服務器進行了配置,但是沒有插件執行。 嘗試將執行添加到未運行的配置文件中的cargo-maven2-plugin。 將執行ID設置為“ deploy-tomcat”。 看看是否有幫助。

在調試模式下(使用-X )運行Maven可能會幫助您了解發生了什么。

暫無
暫無

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

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