failsafe plugin won't run on one project but will run on another — why?

前端 未结 4 609
眼角桃花
眼角桃花 2020-11-29 12:49

This is driving me insane. The Maven failsafe plugin will not run on my project. If I run mvn verify only surefire runs. If I type mvn failsafe:verify

4条回答
  •  执念已碎
    2020-11-29 13:03

    Take a look at the failsafe docs for the test names failsafe expects by default:

    
      **/IT*.java
      **/*IT.java
      **/*ITCase.java
    
    

    Are your tests named following one of these patterns? If not, try defining the element in the plugin configuration. Or change your test name(s) to fit the default pattern.


    Okay, now that we've verified the test class names - typically when I add executions to plugin config I do it something like this:

    
        org.apache.maven.plugins
        maven-failsafe-plugin
        ${version.maven.failsafe.plugin}
        
        
        
            
                failsafe-integration-tests
                integration-test
                
                    integration-test
                
            
            
                failsafe-verify
                verify
                
                    verify
                
            
        
    
    

    This explicitly binds the failsafe plugin goals you want to run to the correct phases of the build lifecycle. I believe the surefire plugin is bound to the test lifecycle phase by default (for a jar, war, & ejb anyway), but nothing is bound to integration-test or verify.

提交回复
热议问题