Maven: how to get a war package with resources copied in WEB-INF?

前端 未结 3 971
春和景丽
春和景丽 2020-12-08 20:44

when I create a war package with maven, files and directories under the directory \"src/main/resources\" are copied in /WEB-INF/classes instead of /WEB-INF. How can I get th

3条回答
  •  星月不相逢
    2020-12-08 21:38

    either configure the outputDirectory parameter of resources:resources plugin, or put your files under src/main/webapp/WEB-INF/ directory. resource plugin

    EDIT:

    This configuration is working for me:

      
        org.apache.maven.plugins
        maven-resources-plugin
        2.4.2
        
          
            default-copy-resources
            process-resources
            
              copy-resources
            
            
              true
              ${project.build.directory}/${project.artifactId}-${project.version}/WEB-INF/
              
                
                  ${project.basedir}/src/main/resources
                
              
            
          
        
      
    

    you can run a phase in the form somePhase or a goal somePlugin:someGoal. The phase invocations will invoke all plugins goals hooked on phases in interval [validate,phase] in order, so there's no need to explicitly call them.

提交回复
热议问题