How do I get Maven 2 to build 2 separate WAR files

后端 未结 8 2080
有刺的猬
有刺的猬 2020-12-29 15:34

When doing a mvn install I want to end up with 2 WAR files in my target directory. One will contain the production web.xml and the

8条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-29 16:26

    Old Question, but I want to answer for completeness.

    You can do this in one build step very simply with the war plugin with two executions. See the sample code below:

            
                org.apache.maven.plugins
                maven-war-plugin
                
                    
                        build-context-one
                        install
                        
                            war
                        
                        
                            context-one
                            
                                
                                    true
                                    src/main/webapp
                                    
                                        **
                                    
                                
                                
                                    your-context-one-directory
                                
                            
                        
                    
                    
                        build-context-two
                        install
                        
                            war
                        
                        
                            classifier-two
                            
                                
                                    true
                                    src/main/webapp
                                    
                                        **
                                    
                                
                                
                                    your-context-two-directory
                                
                            
                        
                    
                
    

提交回复
热议问题