How do I include test classes and configuration in my war for integration testing using maven?

前端 未结 7 1393
梦谈多话
梦谈多话 2021-01-12 05:33

I currently have a maven web project that I am attempting to write integration tests for. For the structure of the project, I\'ve defined test stubs under src/test/j

7条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-12 06:08

    I believe the following configuration for the maven war plugin would do what you want. You copy your test-classes to your WEB-INF/classes folder. You can even filter those resources.

    
        org.apache.maven.plugins
        maven-war-plugin
        
            
                generate-test-war
                pre-integration-test
                
                    war
                
            
        
        
            ${basedir}/src/test/webapp
            ${project.artifactId}-test
            ${basedir}/target/${project.artifactId}-test
            false
            
                
                    ${basedir}/target/test-classes
                    WEB-INF/classes
                
            
        
    
    

    See http://maven.apache.org/plugins/maven-war-plugin/examples/adding-filtering-webresources.html

提交回复
热议问题