Is it possible to execute two different maven exec-maven-plugin in a single POM

后端 未结 6 2060
臣服心动
臣服心动 2021-01-30 09:59

I execute the following code using mvn exec:java com.mycompany.FooServer.

I would like to add another server which I can execute like mvn exec:java co

6条回答
  •  感动是毒
    2021-01-30 10:56

    I'm afraid that what you want is not possible. I could not find a way to call the same exec-maven-plugin goal directly (mvn exec:java) with different configurations in .pom file.

    Said that, you can however have multiple executions of exec-maven-plugin. The thing is you can not call the goals directly. You have to use multiple executions and bind them to particular build phases.

    You could also make use of the following solution that fitted me. You can still call one goal directly with it's configuration in the .pom:

    
        org.codehaus.mojo
        exec-maven-plugin
        1.3.2
        
            
                Acceptance Tests
                integration-test
                
                    exec
                
                
                    pybot
                    
                        
                    
                
            
        
        
            pt.jandias.someapp.persistence.SchemaGenerator
            
                
            
        
    
    

    One could than use mvn exec:java and mvn integration-test at will.

提交回复
热议问题