You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by jimpo <ja...@gofore.com> on 2007/10/30 13:26:03 UTC

Deploying war to 2 different containers at the same time

I use maven to build my web application (war). I have two tomcat
installations: unit test installation, which has a datasource that points to
unit test db (this db gets predefined data populated by dbUnit), and
development installation, which uses development database.

In my build I want to first run junit tests, then integration tests using
"unit test" tomcat, and then deploy the same war to the development tomcat.

What kind of setup should I use for this type of deployment? I have tried to
use cargo for deploying to the servers, but can't figure out how to make it
deploy to two places at the same time. I could even copy the wars manually,
but cannot find how I am supposed to be able to move a file from A to B
Maven? Seems like I am spending days finding out how to do simple things
like copying a file, things that I could have done in a few minutes using
ant </rant>

At the moment, I have this kind of config in my pom.xml (yuck, not pretty):

                    <plugin>
                        <groupId>org.codehaus.cargo</groupId>
                        <artifactId>cargo-maven2-plugin</artifactId>
                        <version>0.3</version>
                        <configuration>
                            <wait>${cargo.wait}</wait>
                            <container>
                               
<containerId>${cargo.container}</containerId>
                                <home>${cargo.container.home}</home>
                            </container>
                            <configuration>
                                <type>existing</type>
                                <home>${cargo.container.home}</home>
                            </configuration>
                        </configuration>
                        <executions>
                            <execution>
                                <id>deploy</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>deploy</goal>
                                </goals>
                            </execution>
                        </executions>
                        
                    </plugin>

    <!-- additional plugin to copy also to second server -->
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <phase>pre-integration-test</phase>
            <configuration>
              <tasks>
                <copy file="target\myapp-webapp-1.0-SNAPSHOT.war"
todir="${cargo.junit.container.home}\webapps" />
              </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

-- 
View this message in context: http://www.nabble.com/Deploying-war-to-2-different-containers-at-the-same-time-tf4718169s177.html#a13487565
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: Deploying war to 2 different containers at the same time

Posted by jimpo <ja...@gofore.com>.
What do you mean by "if you really have to..."? Am I not supposed to be
testing and deploying the latest version? What I have used so far is, I run
mvn install and myapp-webapp-1.0-SNAPSHOT.war gets deployed to both servers.
What is the "best practise" for this? 

Would you have any pom.xml examples for "create a deployer" and "using real
war as underlay"? 


Michael McCallum-3 wrote:
> 
> perhaps you should think about this differently... create a deployer for 
> tomcat that looks at your repository and deploys the latest release or if
> you 
> _really_ have to the latest snapshots...
> 
> i have found that using cargo is much better if I use the real war as 
> an 'underlay' which the test war gets overlayed onto... - see dependencies
> on 
> wars somewhere around - that way i can build a real application and
> overwrite 
> a few things for testing in my container of choice
> 
> On Wednesday 31 October 2007 01:26, jimpo wrote:
>> I use maven to build my web application (war). I have two tomcat
>> installations: unit test installation, which has a datasource that points
>> to unit test db (this db gets predefined data populated by dbUnit), and
>> development installation, which uses development database.
>>
>> In my build I want to first run junit tests, then integration tests using
>> "unit test" tomcat, and then deploy the same war to the development
>> tomcat.
>>
>> What kind of setup should I use for this type of deployment? I have tried
>> to use cargo for deploying to the servers, but can't figure out how to
>> make
>> it deploy to two places at the same time. I could even copy the wars
>> manually, but cannot find how I am supposed to be able to move a file
>> from
>> A to B Maven? Seems like I am spending days finding out how to do simple
>> things like copying a file, things that I could have done in a few
>> minutes
>> using ant </rant>
>>
>> At the moment, I have this kind of config in my pom.xml (yuck, not
>> pretty):
>>
>>                     <plugin>
>>                         <groupId>org.codehaus.cargo</groupId>
>>                         <artifactId>cargo-maven2-plugin</artifactId>
>>                         <version>0.3</version>
>>                         <configuration>
>>                             <wait>${cargo.wait}</wait>
>>                             <container>
>>
>> <containerId>${cargo.container}</containerId>
>>                                 <home>${cargo.container.home}</home>
>>                             </container>
>>                             <configuration>
>>                                 <type>existing</type>
>>                                 <home>${cargo.container.home}</home>
>>                             </configuration>
>>                         </configuration>
>>                         <executions>
>>                             <execution>
>>                                 <id>deploy</id>
>>                                 <phase>pre-integration-test</phase>
>>                                 <goals>
>>                                     <goal>deploy</goal>
>>                                 </goals>
>>                             </execution>
>>                         </executions>
>>
>>                     </plugin>
>>
>>     <!-- additional plugin to copy also to second server -->
>>       <plugin>
>>         <artifactId>maven-antrun-plugin</artifactId>
>>         <executions>
>>           <execution>
>>             <phase>pre-integration-test</phase>
>>             <configuration>
>>               <tasks>
>>                 <copy file="target\myapp-webapp-1.0-SNAPSHOT.war"
>> todir="${cargo.junit.container.home}\webapps" />
>>               </tasks>
>>             </configuration>
>>             <goals>
>>               <goal>run</goal>
>>             </goals>
>>           </execution>
>>         </executions>
>>       </plugin>
> 
> -- 
> Michael McCallum
> Enterprise Engineer
> mailto:gholam@apache.org
> 
> ---------------------------------------------------------------------
> 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/Deploying-war-to-2-different-containers-at-the-same-time-tf4718169s177.html#a13504231
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: Deploying war to 2 different containers at the same time

Posted by Michael McCallum <gh...@apache.org>.
perhaps you should think about this differently... create a deployer for 
tomcat that looks at your repository and deploys the latest release or if you 
_really_ have to the latest snapshots...

i have found that using cargo is much better if I use the real war as 
an 'underlay' which the test war gets overlayed onto... - see dependencies on 
wars somewhere around - that way i can build a real application and overwrite 
a few things for testing in my container of choice

On Wednesday 31 October 2007 01:26, jimpo wrote:
> I use maven to build my web application (war). I have two tomcat
> installations: unit test installation, which has a datasource that points
> to unit test db (this db gets predefined data populated by dbUnit), and
> development installation, which uses development database.
>
> In my build I want to first run junit tests, then integration tests using
> "unit test" tomcat, and then deploy the same war to the development tomcat.
>
> What kind of setup should I use for this type of deployment? I have tried
> to use cargo for deploying to the servers, but can't figure out how to make
> it deploy to two places at the same time. I could even copy the wars
> manually, but cannot find how I am supposed to be able to move a file from
> A to B Maven? Seems like I am spending days finding out how to do simple
> things like copying a file, things that I could have done in a few minutes
> using ant </rant>
>
> At the moment, I have this kind of config in my pom.xml (yuck, not pretty):
>
>                     <plugin>
>                         <groupId>org.codehaus.cargo</groupId>
>                         <artifactId>cargo-maven2-plugin</artifactId>
>                         <version>0.3</version>
>                         <configuration>
>                             <wait>${cargo.wait}</wait>
>                             <container>
>
> <containerId>${cargo.container}</containerId>
>                                 <home>${cargo.container.home}</home>
>                             </container>
>                             <configuration>
>                                 <type>existing</type>
>                                 <home>${cargo.container.home}</home>
>                             </configuration>
>                         </configuration>
>                         <executions>
>                             <execution>
>                                 <id>deploy</id>
>                                 <phase>pre-integration-test</phase>
>                                 <goals>
>                                     <goal>deploy</goal>
>                                 </goals>
>                             </execution>
>                         </executions>
>
>                     </plugin>
>
>     <!-- additional plugin to copy also to second server -->
>       <plugin>
>         <artifactId>maven-antrun-plugin</artifactId>
>         <executions>
>           <execution>
>             <phase>pre-integration-test</phase>
>             <configuration>
>               <tasks>
>                 <copy file="target\myapp-webapp-1.0-SNAPSHOT.war"
> todir="${cargo.junit.container.home}\webapps" />
>               </tasks>
>             </configuration>
>             <goals>
>               <goal>run</goal>
>             </goals>
>           </execution>
>         </executions>
>       </plugin>

-- 
Michael McCallum
Enterprise Engineer
mailto:gholam@apache.org

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


Re: Deploying war to 2 different containers at the same time

Posted by Graham Leggett <mi...@sharp.fm>.
jimpo <ja...@gofore.com> wrote, in part, on 10/30/2007 08:26:03
AM:

>> <rant>Seems like I am spending days finding out how to do simple things
>> like copying a file, things that I could have done in a few minutes
> using
>> ant </rant>

Then use ant, seriously.

The maven-antrun-plugin is designed for those cases where maven plugins
don't go far enough, or aren't find grained enough to do the job required.

We use a short ant script to build Matlab code, and another ant script to
build C++ code[1], and these are wrapped into our maven build process by
being triggered by the antrun plugin.

Ant and maven work very well together.

[1] We needed a way to build C++ code cross-platform, and the various
maven plugins wanted us to choose a single platform. Ant to the rescue.

Regards,
Graham
--



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


Re: Deploying war to 2 different containers at the same time

Posted by ro...@aciworldwide.com.
Amen to that. I've gotten so frustrated at the lack of basic file support 
that I've written my own plugin for such elementary goals as

        file:create
        file:mkdir
        file:copy
        file:move
        file:append
        file:delete
        file:rmdir


Robert Egan


jimpo <ja...@gofore.com> wrote, in part, on 10/30/2007 08:26:03 
AM:

> <rant>Seems like I am spending days finding out how to do simple things
> like copying a file, things that I could have done in a few minutes 
using
> ant </rant>
> 

This email message and any attachments may contain confidential, 
proprietary or non-public information.  The information is intended solely 
for the designated recipient(s).  If an addressing or transmission error 
has misdirected this email, please notify the sender immediately and 
destroy this email.  Any review, dissemination, use or reliance upon this 
information by unintended recipients is prohibited.  Any opinions 
expressed in this email are those of the author personally.