Conditionally exclude some resources in maven from war

前端 未结 2 1739
Happy的楠姐
Happy的楠姐 2021-01-21 02:40

I developed an application, and its final war was OK in a development mode but it contains some configuration files which I need to externalize for production. I was able to man

2条回答
  •  北海茫月
    2021-01-21 03:27

    I end up with the following solution. It does not use profiles, which are considered as antipattern by some guys: blackbuild and Henrik Larne. The solution is built with classifiers and maven war resources exclusion. It will produce two wars that differ with their content and file name.

    
        maven-war-plugin
        
            dev
            ${project.build.directory}/${project.build.finalName}-dev
        
        
            
                package-prod
                package
                
                    prod
                    ${project.build.directory}/${project.build.finalName}-prod
                    WEB-INF/classes/*.jks,WEB-INF/classes/some.properties
                
                
                    war
                
            
        
    
    

    Thanks everybody.

提交回复
热议问题