Maven Deploy To Multiple Tomcat Servers

前端 未结 5 1864
轻奢々
轻奢々 2020-12-23 00:18

What is the most minimal example of deploying a war to multiple tomcat servers using maven that can be written?

I\'ve tried the following URLs and asked the mailing

5条回答
  •  春和景丽
    2020-12-23 00:53

    The idea of Markus Lux can be also applied with a Maven2 solution, with the profiles management:

    
        
            
                org.codehaus.cargo
                cargo-maven2-plugin
            
        
        ...
    
    
        
            env-foo1
            
            
                
                    env
                    foo1
                
            
            
                xxx
                http://foo1/manager
                foo
                bar
            
         
        
            env-foo2
            
            
                
                    env
                    foo2
                
            
            
                dev
                http://foo2/manager
                foo
                bar
            
        
        ... 
        
    

    Then, you will just need to run X times the mvn command, with the adequate parameter (-Denv=foo1, -Denv=foo2,...)


    In addition to that, you can enhance this solution by using the Matrix feature of the Hudson Continuous Integration server. I gave a short explanation about this feature here.

    Basically, you just define a "normal" Maven2 job in Hudson, and with the Matrix feature, you can ask Hudson to run this job several times, one per environment. In others words, you create your Hudson job, and then you define the "environment axis" with all possible value for the env parameter:

    • foo1
    • foo2
    • foo3
    • ...

    Hudson will then build the application with the mvn command and with the parameter -Denv=foo1.Once this build is finished, it will build the same application but with the parameter -Denv=foo2, and so on...

    This way, Hudson will deploy your application in every environments...

    I hope my solution will help you to reach your goals...

提交回复
热议问题