You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by nagl <ne...@gmail.com> on 2009/07/27 20:32:25 UTC

How can I deploy multiple wars using the tomcat plugin in maven?

So I have two wars which I deploy in tow maven projects using tomcat plugin.
I want to do this in one step and be able to deploy more than one wars in a
single maven project. how can i do this. any suggestions

if tomcat plugin doesnt work, is there anyother way this can be done?
-- 
View this message in context: http://www.nabble.com/How-can-I-deploy-multiple-wars-using-the-tomcat-plugin-in-maven--tp24685971p24685971.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: How can I deploy multiple wars using the tomcat plugin in maven?

Posted by Rusty Wright <ru...@gmail.com>.
As an example, here's my deploy pom.xml:

<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <artifactId>waitlist-parent</artifactId>

        <groupId>edu.berkeley.ist.waitlist</groupId>

        <version>1.2</version>

        <relativePath>../waitlist-parent/pom.xml</relativePath>
    </parent>

    <artifactId>waitlist-deploy</artifactId>

    <packaging>jar</packaging>

    <name>WMF waitlist deploy</name>

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.cargo</groupId>
                <artifactId>cargo-maven2-plugin</artifactId>
                <version>${version.cargo}</version>

                <!-- the tomcat username and password should be in a        -->
                <!-- profile section in your ~/.m2/settings.xml file, not   -->
                <!-- here or a profile in any of your pom.xmls.             -->

                <!-- the tomcat.hostname property is in a profile down      -->
                <!-- below. same for the port.                              -->

                <configuration>
                    <container>
                        <containerId>tomcat6x</containerId>
                        <type>remote</type>
                    </container>

                    <configuration>
                        <type>runtime</type>

                        <properties>
                            <cargo.remote.username>${tomcat.manager.username}</cargo.remote.username>
                            <cargo.remote.password>${tomcat.manager.password}</cargo.remote.password>
                            <cargo.hostname>${tomcat.hostname}</cargo.hostname>
                            <cargo.servlet.port>${tomcat.port}</cargo.servlet.port>
                        </properties>
                    </configuration>

                    <deployer>
                        <type>remote</type>

                        <deployables>
                            <deployable>
                                <groupId>edu.berkeley.ist.waitlist</groupId>
                                <artifactId>waitlist-war</artifactId>

                                <type>war</type>

                                <properties>
                                    <context>waitlist</context>
                                </properties>

                                <pingURL>http://${tomcat.hostname}:${tomcat.port}/waitlist/</pingURL>
                            </deployable>
                        </deployables>
                    </deployer>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>edu.berkeley.ist.waitlist</groupId>
            <artifactId>waitlist-war</artifactId>

            <version>${project.version}</version>

            <type>war</type>
        </dependency>
    </dependencies>

    <properties>
        <version.cargo>1.0</version.cargo>

        <!-- you can override these in a profile when necessary -->
        <tomcat.hostname>localhost</tomcat.hostname>
        <tomcat.port>8080</tomcat.port>
    </properties>

    <profiles>
        <profile>
            <id>
                wss-test1-tomcat
            </id>

            <activation>
                <activeByDefault>
                    false
                </activeByDefault>
            </activation>

            <!-- this is just a placeholder, to remind me -->
            <!-- the properties are all set in the parent's pom -->
            <properties>
                <use.this.profile />
            </properties>
        </profile>
    </profiles>
</project>


Rusty Wright wrote:
> nagl, to expand on what David is saying; for the two projects that 
> create war files, when you build those war files your final step for 
> each one should be an install (e.g., "mvn -Pwhatever clean verify 
> install") and the install phase will copy the war files into your local 
> maven repository (e.g., ~/.m2 on unix).  For maven, install means copy 
> the war, jar, whatever, into your local repository.
> 
> Then, in the tomcat deploy project, when you deploy, since you've 
> specified the war files as dependencies, it will first pull the war 
> files from your local maven repository, then deploy them to tomcat.
> 
> I use cargo, but I don't know how you could use it to deploy two 
> different war files at the same time.  (I'm not saying you can't, just 
> that I don't know if it's possible.)
> 
> 
> David C. Hicks wrote:
>> Oh, no, you misunderstood my intention. You don't build a war file using
>> the two other wars as a dependency. The only reason you make them
>> dependencies is to make them available to the plugin for deployment.
>> Your third project doesn't really have its own artifact, other than the
>> *.pom file.
>>
>> nagl wrote:
>>> by declaring the two war files as dependencies in the third project, 
>>> after i
>>> build the third project as a war and deploy it, I am not able to 
>>> access the
>>> first two web apps. what i want to knw is a way to sort of merge the 
>>> two wars. now maven cargo plugin as something called uber war which 
>>> does the job of
>>> merging. but it is quite complicated and there is very little 
>>> documentation
>>> on it.
>>>
>>>
>>> dchicks wrote:
>>>  
>>>> The first question is relatively straightforward. Since your wars are
>>>> created in different projects, just set up a third project that has the
>>>> artifact WAR files from the other two as dependencies. If your war 
>>>> files
>>>> are generated in different modules of the same project, you would
>>>> accomplish the same thing using a third module that depends on the 
>>>> other
>>>> two. Think of it like you would an assembly, in that case.
>>>>
>>>> Looking at the Tomcat plugin, I don't see any configuration for
>>>> deploying multiple wars at the same time. Your third project could have
>>>> multiple modules - one for each deployment.
>>>>
>>>> Hopefully, someone has a better answer than that. That seems a bit like
>>>> overkill.
>>>>
>>>> Dave
>>>>
>>>>
>>>> nagl wrote:
>>>>    
>>>>> So I have two wars which I deploy in tow maven projects using tomcat
>>>>> plugin.
>>>>> I want to do this in one step and be able to deploy more than one 
>>>>> wars in
>>>>> a
>>>>> single maven project. how can i do this. any suggestions
>>>>>
>>>>> if tomcat plugin doesnt work, is there anyother way this can be done?
>>>>>         
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>> For additional commands, e-mail: users-help@maven.apache.org
>>>>
>>>>
>>>>
>>>>     
>>>   
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: How can I deploy multiple wars using the tomcat plugin in maven?

Posted by Rusty Wright <ru...@gmail.com>.
nagl, to expand on what David is saying; for the two projects that create war files, when you build those war files your final step for each one should be an install (e.g., "mvn -Pwhatever clean verify install") and the install phase will copy the war files into your local maven repository (e.g., ~/.m2 on unix).  For maven, install means copy the war, jar, whatever, into your local repository.

Then, in the tomcat deploy project, when you deploy, since you've specified the war files as dependencies, it will first pull the war files from your local maven repository, then deploy them to tomcat.

I use cargo, but I don't know how you could use it to deploy two different war files at the same time.  (I'm not saying you can't, just that I don't know if it's possible.)


David C. Hicks wrote:
> Oh, no, you misunderstood my intention. You don't build a war file using
> the two other wars as a dependency. The only reason you make them
> dependencies is to make them available to the plugin for deployment.
> Your third project doesn't really have its own artifact, other than the
> *.pom file.
> 
> nagl wrote:
>> by declaring the two war files as dependencies in the third project, after i
>> build the third project as a war and deploy it, I am not able to access the
>> first two web apps. 
>> what i want to knw is a way to sort of merge the two wars. 
>> now maven cargo plugin as something called uber war which does the job of
>> merging. but it is quite complicated and there is very little documentation
>> on it. 
>>
>>
>>
>> dchicks wrote:
>>   
>>> The first question is relatively straightforward. Since your wars are
>>> created in different projects, just set up a third project that has the
>>> artifact WAR files from the other two as dependencies. If your war files
>>> are generated in different modules of the same project, you would
>>> accomplish the same thing using a third module that depends on the other
>>> two. Think of it like you would an assembly, in that case.
>>>
>>> Looking at the Tomcat plugin, I don't see any configuration for
>>> deploying multiple wars at the same time. Your third project could have
>>> multiple modules - one for each deployment.
>>>
>>> Hopefully, someone has a better answer than that. That seems a bit like
>>> overkill.
>>>
>>> Dave
>>>
>>>
>>> nagl wrote:
>>>     
>>>> So I have two wars which I deploy in tow maven projects using tomcat
>>>> plugin.
>>>> I want to do this in one step and be able to deploy more than one wars in
>>>> a
>>>> single maven project. how can i do this. any suggestions
>>>>
>>>> if tomcat plugin doesnt work, is there anyother way this can be done?
>>>>   
>>>>       
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>>
>>>     
>>   
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: How can I deploy multiple wars using the tomcat plugin in maven?

Posted by "David C. Hicks" <dh...@i-hicks.org>.
Oh, no, you misunderstood my intention. You don't build a war file using
the two other wars as a dependency. The only reason you make them
dependencies is to make them available to the plugin for deployment.
Your third project doesn't really have its own artifact, other than the
*.pom file.

nagl wrote:
> by declaring the two war files as dependencies in the third project, after i
> build the third project as a war and deploy it, I am not able to access the
> first two web apps. 
> what i want to knw is a way to sort of merge the two wars. 
> now maven cargo plugin as something called uber war which does the job of
> merging. but it is quite complicated and there is very little documentation
> on it. 
>
>
>
> dchicks wrote:
>   
>> The first question is relatively straightforward. Since your wars are
>> created in different projects, just set up a third project that has the
>> artifact WAR files from the other two as dependencies. If your war files
>> are generated in different modules of the same project, you would
>> accomplish the same thing using a third module that depends on the other
>> two. Think of it like you would an assembly, in that case.
>>
>> Looking at the Tomcat plugin, I don't see any configuration for
>> deploying multiple wars at the same time. Your third project could have
>> multiple modules - one for each deployment.
>>
>> Hopefully, someone has a better answer than that. That seems a bit like
>> overkill.
>>
>> Dave
>>
>>
>> nagl wrote:
>>     
>>> So I have two wars which I deploy in tow maven projects using tomcat
>>> plugin.
>>> I want to do this in one step and be able to deploy more than one wars in
>>> a
>>> single maven project. how can i do this. any suggestions
>>>
>>> if tomcat plugin doesnt work, is there anyother way this can be done?
>>>   
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>>
>>     
>
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: How can I deploy multiple wars using the tomcat plugin in maven?

Posted by nagl <ne...@gmail.com>.
by declaring the two war files as dependencies in the third project, after i
build the third project as a war and deploy it, I am not able to access the
first two web apps. 
what i want to knw is a way to sort of merge the two wars. 
now maven cargo plugin as something called uber war which does the job of
merging. but it is quite complicated and there is very little documentation
on it. 



dchicks wrote:
> 
> The first question is relatively straightforward. Since your wars are
> created in different projects, just set up a third project that has the
> artifact WAR files from the other two as dependencies. If your war files
> are generated in different modules of the same project, you would
> accomplish the same thing using a third module that depends on the other
> two. Think of it like you would an assembly, in that case.
> 
> Looking at the Tomcat plugin, I don't see any configuration for
> deploying multiple wars at the same time. Your third project could have
> multiple modules - one for each deployment.
> 
> Hopefully, someone has a better answer than that. That seems a bit like
> overkill.
> 
> Dave
> 
> 
> nagl wrote:
>> So I have two wars which I deploy in tow maven projects using tomcat
>> plugin.
>> I want to do this in one step and be able to deploy more than one wars in
>> a
>> single maven project. how can i do this. any suggestions
>>
>> if tomcat plugin doesnt work, is there anyother way this can be done?
>>   
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-can-I-deploy-multiple-wars-using-the-tomcat-plugin-in-maven--tp24685971p24687667.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: How can I deploy multiple wars using the tomcat plugin in maven?

Posted by "David C. Hicks" <dh...@i-hicks.org>.
The first question is relatively straightforward. Since your wars are
created in different projects, just set up a third project that has the
artifact WAR files from the other two as dependencies. If your war files
are generated in different modules of the same project, you would
accomplish the same thing using a third module that depends on the other
two. Think of it like you would an assembly, in that case.

Looking at the Tomcat plugin, I don't see any configuration for
deploying multiple wars at the same time. Your third project could have
multiple modules - one for each deployment.

Hopefully, someone has a better answer than that. That seems a bit like
overkill.

Dave


nagl wrote:
> So I have two wars which I deploy in tow maven projects using tomcat plugin.
> I want to do this in one step and be able to deploy more than one wars in a
> single maven project. how can i do this. any suggestions
>
> if tomcat plugin doesnt work, is there anyother way this can be done?
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org