Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The problem can not be treated with respect to <code>id</code> tag only but <strong>notice</strong> the different values of it through the examples. This has been tested with maven 3.0.5. Consider the following pom part:</p> <pre><code> &lt;plugin&gt; &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt; &lt;artifactId&gt;maven-docck-plugin&lt;/artifactId&gt; &lt;version&gt;1.0&lt;/version&gt; &lt;executions&gt; &lt;execution&gt; &lt;id&gt;some-other-other-id&lt;/id&gt; &lt;!-- No goal for execution is defined --&gt; &lt;phase&gt;pre-site&lt;/phase&gt; &lt;/execution&gt; &lt;execution&gt; &lt;phase&gt;pre-site&lt;/phase&gt; &lt;!-- No id for execution is defined --&gt; &lt;goals&gt; &lt;goal&gt;check&lt;/goal&gt; &lt;/goals&gt; &lt;/execution&gt; &lt;execution&gt; &lt;id&gt;some-id&lt;/id&gt; &lt;!-- No phase for execution is defined --&gt; &lt;goals&gt; &lt;goal&gt;check&lt;/goal&gt; &lt;/goals&gt; &lt;/execution&gt; &lt;execution&gt; &lt;id&gt;some-other-id&lt;/id&gt; &lt;!-- Both id and phase defined --&gt; &lt;phase&gt;pre-site&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;check&lt;/goal&gt; &lt;/goals&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;/plugin&gt; </code></pre> <p>When run <code>mvn clean site</code> from command line it outputs the following:</p> <pre><code>[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. </code></pre> <p>Notice that the execution outputs are always in form of:</p> <pre><code>&lt;plugin-name&gt;:&lt;plugin-version&gt;:&lt;phase&gt; (&lt;execution-id&gt;) </code></pre> <h3>Case 1: No goal for execution is defined</h3> <p>From <a href="http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html#Build_Lifecycle_Basics" rel="nofollow">Build lifecycle basics</a>:</p> <blockquote> <p>A plugin goal represents a specific task (finer than a build phase) which contributes to the building and managing of a project. It may be bound to zero or more build phases. <strong>A goal not bound to any build phase could be executed outside of the build lifecycle by direct invocation.</strong> (...) Moreover, if a goal is bound to one or more build phases, that goal will be called in all those phases.</p> </blockquote> <p>From <a href="http://maven.apache.org/guides/mini/guide-configuring-plugins.html#Configuring_Build_Plugins" rel="nofollow">Guide to configuring plugins: Configuring build plugins</a>:</p> <blockquote> <p>But if the goal is not bound to any lifecycle phase then it simply won't be executed during the build lifecycle.</p> </blockquote> <p>From what is quoted, it may be concluded that the execution with id <code>some-other-other-id</code> can be ran from the command line, but that is not so, it can never be ran - it will be covered in the 5th example.</p> <h3>Case 2: No id for execution is defined</h3> <p>The definition of <code>goal</code> and a <code>phase</code> in the first execution is enough for it to get run so it gets <a href="http://maven.apache.org/guides/mini/guide-default-execution-ids.html" rel="nofollow">assigned a default execution id</a> of value <code>default</code> and it gets executed.</p> <h3>Case 3: No phase for execution is defined</h3> <p>Since the phase is not defined <em>anywhere</em> this execution does not get executed. It can be verified by the fact that the output <strong>does not contain</strong> the line with its execution id.</p> <h3>Case 4: Both id and phase defined</h3> <p>This execution defines all three: an <code>id</code>, a <code>phase</code> and a <code>goal</code> so it gets executed.</p> <h3>Case 5: CLI execution</h3> <p>If you run (read the syntax in the <a href="http://maven.apache.org/plugins/maven-docck-plugin/plugin-info.html" rel="nofollow">docck plugin documentation</a>):</p> <pre><code>mvn docck:check -Doffline=true </code></pre> <p>it will output:</p> <pre><code>[INFO] --- maven-docck-plugin:1.0:check (default-cli) @ MavenJavaApplication --- </code></pre> <p>From <a href="http://maven.apache.org/guides/mini/guide-default-execution-ids.html" rel="nofollow">Guide to configuring default mojo executions</a>:</p> <blockquote> <p>Starting in Maven 2.2.0, each mojo invoked directly from the command line will have an execution Id of default-cli assigned to it, which will allow the configuration of that execution from the POM by using this default execution Id</p> </blockquote> <p>You can provide the properties for the goal executed from CLI in three different ways:</p> <ul> <li>in the command line directly</li> <li>in the plugin configuration</li> <li>in the execution tag with <code>id</code> of value <code>default-cli</code></li> </ul> <p>Specifically, the above command is equivalent of running</p> <pre><code>mvn docck:check </code></pre> <p>with the pom containing:</p> <pre><code> &lt;plugin&gt; &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt; &lt;artifactId&gt;maven-docck-plugin&lt;/artifactId&gt; &lt;version&gt;1.0&lt;/version&gt; &lt;configuration&gt; &lt;offline&gt;true&lt;/offline&gt; &lt;/configuration&gt; &lt;/plugin&gt; </code></pre> <p>or:</p> <pre><code> &lt;plugin&gt; &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt; &lt;artifactId&gt;maven-docck-plugin&lt;/artifactId&gt; &lt;version&gt;1.0&lt;/version&gt; &lt;executions&gt; &lt;execution&gt; &lt;id&gt;default-cli&lt;/id&gt; &lt;phase&gt;pre-site&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;check&lt;/goal&gt; &lt;/goals&gt; &lt;configuration&gt; &lt;offline&gt;true&lt;/offline&gt; &lt;/configuration&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;/plugin&gt; </code></pre> <p>This last part comes in handy if you want to keep the global configuration for some common properties in different executions, but you want a complete other set of properties for running from CLI.</p> <h3>Case 6: The default execution</h3> <p>Since the <code>maven-docck-plugin</code> has no default binding I'll cover it with the <a href="http://maven.apache.org/plugins/maven-compiler-plugin/index.html" rel="nofollow"><code>maven-compiler-plugin</code></a>. Consider an empty pom with <code>jar</code> packaging. If you run:</p> <pre><code> mvn clean install </code></pre> <p>it will trigger the <code>compile</code> phase also and you will see in output:</p> <pre><code>[INFO] --- maven-compiler-plugin:2.3.1:compile (default-compile) @ MavenJavaApplication --- </code></pre> <p>To cover the value of the <code>id</code> tag, from <a href="http://maven.apache.org/guides/mini/guide-default-execution-ids.html" rel="nofollow">Guide to Configuring Default Mojo Executions</a>: </p> <blockquote> <p>Likewise, each mojo bound to the build lifecycle via the default lifecycle mapping for the specified POM packaging will have an execution Id of default-&lt;goalName&gt; assigned to it, to allow configuration of each default mojo execution independently.</p> </blockquote> <p>If you run <a href="http://maven.apache.org/plugins/maven-help-plugin/effective-pom-mojo.html" rel="nofollow"><code>mvn help:effective-pom</code></a> you will find the default execution definition for compiler plugin in output:</p> <pre><code>&lt;execution&gt; &lt;id&gt;default-compile&lt;/id&gt; &lt;phase&gt;compile&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;compile&lt;/goal&gt; &lt;/goals&gt; &lt;/execution&gt; </code></pre> <p>It gets inherited from <a href="http://maven.apache.org/guides/introduction/introduction-to-the-pom.html#Super_POM" rel="nofollow">super POM</a> for the <code>jar</code> <a href="http://maven.apache.org/pom.html#Maven_Coordinates" rel="nofollow">packaging</a> type:</p> <blockquote> <p>When no packaging is declared, Maven assumes the artifact is the default: jar. The valid types are Plexus role-hints (read more on Plexus for a explanation of roles and role-hints) of the component role org.apache.maven.lifecycle.mapping.LifecycleMapping. The current core packaging values are: pom, jar, maven-plugin, ejb, war, ear, rar, par. <strong>These define the default list of goals which execute to each corresponding build lifecycle stage for a particular package structure.</strong></p> </blockquote> <p>In other words, the above default execution definition is the consequence of a <strong>default lifecycle mapping</strong> (<a href="http://maven.apache.org/plugins/maven-compiler-plugin/index.html" rel="nofollow">documentation</a>, <a href="http://maven.apache.org/ref/3.1.0/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging" rel="nofollow">definition</a> ) for the <code>compiler-plugin</code>:</p> <blockquote> <p>The Compiler Plugin has two goals. Both are already bound to their proper phases within the Maven Lifecycle and are therefore, automatically executed during their respective phases.</p> <ul> <li>compiler:compile is bound to the compile phase and is used to compile the main source files. </li> </ul> </blockquote> <h2>Uniqueness of an execution id tag</h2> <p>From <a href="http://maven.apache.org/guides/mini/guide-configuring-plugins.html#Using_the_executions_Tag" rel="nofollow">Guide to configuring plugins.html: Using the executions tag</a>:</p> <blockquote> <p>Note that while execution id's have to be unique among all executions of a single plugin within a POM, they don't have to be unique across an inheritance hierarchy of POMs. Executions of the same id from different POMs are merged. The same applies to executions that are defined by profiles.</p> </blockquote>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload