Specify common resources in a multi-module maven project

前端 未结 6 1303
忘掉有多难
忘掉有多难 2020-12-09 15:00

Is there any way to share resources between modules of a parent project in Maven? For example, I would like to specify one log4j.properties file for all the modules in a mul

6条回答
  •  粉色の甜心
    2020-12-09 15:36

    Yes, it seems as a possible solution. But I was interested whether it is possible to specify these resources in the parent project (without introducing additional module) since the parent project specifies all the common dependencies and Maven configurations for the child modules, I think that the parent project is the most suitable place also for the common resources.

    In case of packaging type pom , when goal package specified to manage your shared resources, just add next (check folders) into build section of pom file :

            
            org.apache.maven.plugins
            maven-resources-plugin
           
               
                   copy-config-files
                   package
                   
                       copy-resources
                   
                   
                       ${project.build.directory}/logconfig
                       
                           
                            false
                            ${project.basedir}/src/main/resources
                           
                       
                   
            
           
        
    

提交回复
热议问题