How do I run a specific goal with a particular configuration in a Maven plugin when I have several configurations for that goal

后端 未结 4 786
栀梦
栀梦 2020-12-28 14:15

See plugin config from pom.xml below.

I can do:

mvn myplugin:myGoal

Which runs myGoal (both executions I suppose) but I want to be able

4条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-28 15:10

    I can do mvn myplugin:myGoalWhich runs myGoal (both executions I suppose)

    None of them (assuming they had unique id). Executions are bound to a phase, you need to run the given phase to trigger them.

    I know I can add an id to the execution element, but how do I refer to that id on the command line.

    Not supported. What is possible for plugins invoked on the CLI is to define a non global configuration in the POM using the special default-cli executionId, like this:

    
      maven-assembly-plugin
      
        
          default-cli
          
            
              jar-with-dependencies
              project
            
          
        
      
    
    

    Is this possible, or am I going about this the wrong way?

    No, not possible. Either pass the parameters on the command line or use profiles (with or without the above default execution).

    References

    • Default Plugin Execution IDs
    • http://jira.codehaus.org/browse/MNG-3203
    • http://jira.codehaus.org/browse/MNG-3401

提交回复
热议问题