Maven, execution tag, id tag missing

I look at the pump plugin section that I am checking and found this:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-docck-plugin</artifactId>
    <version>1.0</version>
    <executions>
        <execution>
            <phase>pre-site</phase>
            <goals>
                <goal>check</goal>
            </goals>
        </execution>
    </executions>
</plugin>

If you notice a runtime section, you will notice that it does not have an id tag. My question is how the id tag used by Maven and how the absence of one affects the observed behavior. I looked into the Maven tutorials and could suggest that the id of the various stages of execution should be unique, in pom it is not necessary through inherited pores, but he did not mention how it is used.

+4
source share
2 answers

Maven 3.0.x , , - defaultName. , ID default-check. default-cli .

POM POM, POM ( Maven super POM) settings.xml. Maven POM. . , config POM ( Maven super POM .

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-jar-plugin</artifactId>
  <executions>
    <!-- default-jar is the ID assigned to the jar:jar execution 
         included automatically by Maven.  This demonstrates how we 
         can tweak the built-in plugin executions to meet our needs.  
         Note we do not have to specify phase or goals, as those are 
         inherited.  In the example we add a configuration block and
         change the values of the <forceCreation> and <finalName> 
         elements. -->
    <execution>
      <id>default-jar</id>
      <configuration>
        <finalName>firstJar</finalName>
        <forceCreation>true</forceCreation>
      </configuration>
    </execution>

    <!-- Add an execution of the jar plugin to build a jar with the 
         same contents but different name.  We assign an execution ID.
         Because we are not inheriting config for this execution it our 
         responsibility to specify phase and goals, as well as the config
         we want.  Executions are run in order so this one will run after 
         the default. -->
    <execution>
      <id>another-jar</id>
      <phase>package</phase>
      <goals>
        <goal>jar</goal>
      </goals>
      <configuration>
        <finalName>duplicateJar</finalName>
      </configuration>
    </execution>

    <!-- Configure plugin behavior if we execute the jar:jar goal 
         directly from the command line.  Don't bind this to a phase; 
         we don't want to run this as part of the normal lifecycle. -->
    <execution>
      <id>default-cli</id>
      <configuration>
        <finalName>cmdLineJar</finalName>
      </configuration>
    </execution>
  </executions>
</plugin>

:

  • mvn clean package - firstJar.jar duplicateJar.jar
  • mvn jar: jar - cmdLineJar.jar( , !)
  • mvn clean jar: jar - , ( ) cmdLineJar.jar; jar: jar ,
  • mvn clean cook-pack jar: jar - , cmdLineJar.jar
+5

id, notice . maven 3.0.5. pom:

       <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-docck-plugin</artifactId>
            <version>1.0</version>
            <executions>
                <execution>
                    <id>some-other-other-id</id> <!-- No goal for execution is defined -->
                    <phase>pre-site</phase>
                </execution>
                <execution>
                    <phase>pre-site</phase>   <!-- No id for execution is defined -->
                    <goals>
                        <goal>check</goal>
                    </goals>
                </execution>
                <execution>
                    <id>some-id</id>          <!-- No phase for execution is defined -->           
                    <goals>
                        <goal>check</goal>
                    </goals>
                </execution>
                <execution>
                    <id>some-other-id</id>     <!-- Both id and phase defined -->
                    <phase>pre-site</phase>
                    <goals>
                        <goal>check</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

mvn clean site :

[INFO] --- maven-docck-plugin:1.0:check (default) @ MavenJavaApplication ---
[INFO] Skipping unsupported project: MavenJavaApplication
[INFO] No documentation errors were found.
[INFO] 
[INFO] --- maven-docck-plugin:1.0:check (some-other-id) @ MavenJavaApplication ---
[INFO] Skipping unsupported project: MavenJavaApplication
[INFO] No documentation errors were found.

, :

<plugin-name>:<plugin-version>:<phase> (<execution-id>)

1:

:

( , ), . . , - , . (...) , , .

: :

- , .

, id some-other-other-id , , - .

2:

goal a phase , default .

3:

, . - , .

4:

: a id, a phase a goal, .

5: CLI

( docck plugin):

mvn docck:check -Doffline=true

:

[INFO] --- maven-docck-plugin:1.0:check (default-cli) @ MavenJavaApplication ---

mojo :

Maven 2.2.0, mojo, , -cli, POM, Id Id p >

, CLI :

  • id default-cli

,

mvn docck:check

pom, :

 <plugin>
     <groupId>org.apache.maven.plugins</groupId>
     <artifactId>maven-docck-plugin</artifactId>
     <version>1.0</version>
     <configuration>
         <offline>true</offline>
     </configuration>
  </plugin>

  <plugin>
     <groupId>org.apache.maven.plugins</groupId>
     <artifactId>maven-docck-plugin</artifactId>
     <version>1.0</version>
     <executions>
         <execution>
             <id>default-cli</id>
             <phase>pre-site</phase>
             <goals>
                 <goal>check</goal>
             </goals>
             <configuration>
                 <offline>true</offline>
             </configuration>
         </execution>
     </executions>
  </plugin>

, , CLI.

6:

maven-docck-plugin , maven-compiler-plugin. jar. :

 mvn clean install

compile, :

[INFO] --- maven-compiler-plugin:2.3.1:compile (default-compile) @ MavenJavaApplication ---

id, Mojo Executions:

, mojo, POM, - <goalName> , mojo .

mvn help:effective-pom, :

<execution>
    <id>default-compile</id>
    <phase>compile</phase>
    <goals>
        <goal>compile</goal>
     </goals>
 </execution>

POM jar :

, Maven , : jar. Plexus ( Plexus ) org.apache.maven.lifecycle.mapping.LifecycleMapping. : pom, jar, maven-plugin, ejb, war, ear, rar, par. , .

, (, ) compiler-plugin:

. Maven .

  • : .

id

plugins.html: :

, POM, POM. POM . , .

+2

All Articles