maven, execution tag, id tag missing

后端 未结 2 1256
有刺的猬
有刺的猬 2021-02-10 03:13

I\'m looking at the plugin section of a pom I\'m inspecting and found this:


    org.apache.maven.plugins
    

        
2条回答
  •  情书的邮戳
    2021-02-10 03:32

    For Maven 3.0.x at least, when not specified, the ID for an execution is default-goalName. So for the example you have, the ID would be default-check. The value default-cli may also be used to configure command line executions.

    The execution IDs are used when creating the effective POM from the POM itself, any parent POMs (including the Maven super POM), and settings.xml. Maven merges configuration for plugin executions having the same ID across these POMs. Here's an example. Assume this plugin config is in a parent POM (only Maven super POM is higher up in the hierarchy.

    
      org.apache.maven.plugins
      maven-jar-plugin
      
        
        
          default-jar
          
            firstJar
            true
          
        
    
        
        
          another-jar
          package
          
            jar
          
          
            duplicateJar
          
        
    
        
        
          default-cli
          
            cmdLineJar
          
        
      
    
    

    With the above config:

    • mvn clean package - builds firstJar.jar and duplicateJar.jar
    • mvn jar:jar - builds cmdLineJar.jar (note, no clean lifecycle!)
    • mvn clean jar:jar - removes target dir, builds empty (except for manifest) cmdLineJar.jar; because jar:jar does not run the full lifecycle, just one goal
    • mvn clean prepare-package jar:jar - runs lifecycle thru prepare-package, then builds a non-empty cmdLineJar.jar

提交回复
热议问题