Maven deploy multiple wars to embedded server for integration tests

前端 未结 2 1129
故里飘歌
故里飘歌 2021-01-04 13:34

I have had no issue running a maven war project on an embedded server for its own integration tests, but now I need to run multiple wars and test from a different project.

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-04 13:46

    I was able to achieve this using the cargo-maven2-plugin.

    Here are the relevant pieces of the pom for anyone who is interested...

    ...
    com.test
    webapp-integration
    jar
    1.0-SNAPSHOT
    ...
    
            ...
            
                webapp1
                com.test
                1.0
                war
            
            
                webapp2
                com.test
                1.0-SNAPSHOT
                war
            
        
        
            
                
                    org.codehaus.cargo
                    cargo-maven2-plugin
                    1.2.2
                    
                        
                            jetty6x
                            embedded
                        
                        
                            standalone
                            
                                8085
                            
                            
                                
                                    webapp1
                                    com.test
                                    war
                                    http://localhost:8085/testapp/
                                    
                                        testapp
                                    
                                
                                
                                    webapp2
                                    com.test
                                    war
                                    http://localhost:8085/testapp2/
                                    
                                        testapp2
                                    
                                
                            
                        
                    
                    
                        
                            start-server
                            pre-integration-test
                            
                                start
                            
                        
                        
                            stop-server
                            post-integration-test
                            
                                stop
                            
                        
                    
                
                
                    maven-failsafe-plugin
                    2.12
                    
                        
                            org.apache.maven.surefire
                            surefire-junit47
                            2.12
                        
                    
                    
                        com.test.integration.IntegrationTestMarker
                    
                    
                        
                            
                                integration-test
                            
                            
                                
                                    **/*.class
                                
                                false
                            
                        
                    
                
            
        
    

提交回复
热议问题