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

后端 未结 8 2046
有刺的猬
有刺的猬 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:24

    You can tell the Maven Assembly plugin to simply generate two assemblies. You just write an assembly descriptor file for each output you wish to create and list them in the plugin config.

    For example I'm using it to generate a WAR file and a TGZ file, but there's no reason you can't do two WARs in the same way. mvn package will then generate both files.

            
                maven-assembly-plugin
                2.3
                
                    
                        src/main/assembly/assembly-war.xml
                        src/main/assembly/assembly-dist.xml
                    
                
                
                    
                        dist-assembly
                        package
                        
                            single
                        
                    
                
            
    

提交回复
热议问题