Copying file from one project to another in maven

前端 未结 1 1754
灰色年华
灰色年华 2021-02-05 07:31

I\'m working on a multi-module project. We\'re using the appCtx.xml from one module in few other modules.

Current issue is that they\'re not always in sync with each ot

1条回答
  •  Happy的楠姐
    2021-02-05 08:01

    You can do this with the maven resources plugin: copy-resources, something like:

    
        maven-resources-plugin
        
            
                copy-appCtx
                generate-resources
                
                    copy-resources
                
                
                    ${project.build.directory}/src/blahhere
                    true
                    
                        
                            ../other_project/src/blah/blah
                            
                                appCtx.xml
                            
                        
                    
                
            
        
    
    

    This copies a file from one project (colocated on the same source tree) as part of the generate-resources phase. You can adapt this to your needs.

    This copying from one project to another may cause unstable builds if the projects aren't all built at once, but the above will work for projects which are always built together.

    0 讨论(0)
提交回复
热议问题