You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by jv...@apache.org on 2009/05/03 22:29:01 UTC

svn commit: r771122 - /maven/components/branches/MNG-2766/maven-core/lifecycle-executor.txt

Author: jvanzyl
Date: Sun May  3 20:29:00 2009
New Revision: 771122

URL: http://svn.apache.org/viewvc?rev=771122&view=rev
Log:
o more step by step notes about what the lifecycle executor is doing

Modified:
    maven/components/branches/MNG-2766/maven-core/lifecycle-executor.txt

Modified: maven/components/branches/MNG-2766/maven-core/lifecycle-executor.txt
URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-core/lifecycle-executor.txt?rev=771122&r1=771121&r2=771122&view=diff
==============================================================================
--- maven/components/branches/MNG-2766/maven-core/lifecycle-executor.txt (original)
+++ maven/components/branches/MNG-2766/maven-core/lifecycle-executor.txt Sun May  3 20:29:00 2009
@@ -1,65 +1,215 @@
-   /**
-     * These represent the mojos to run in a lifecycle phase for a particular packaging type. The
-     * example below is the set of mojos we are going to run in the default lifecycle for the "jar"
-     * packaging.
-     * 
-
-  <component>
-    <role>org.apache.maven.lifecycle.LifecycleMapping</role>
-    <role-hint>jar</role-hint>
-    <implementation>org.apache.maven.lifecycle.DefaultLifecycleMapping
-    </implementation>
-    <configuration>
-      <lifecycles>
-        <lifecycle>
-          <id>default</id>
-          <phases>
-            <process-resources>org.apache.maven.plugins:maven-resources-plugin:resources</process-resources>
-            <compile>org.apache.maven.plugins:maven-compiler-plugin:compile</compile>
-            <process-test-resources>org.apache.maven.plugins:maven-resources-plugin:testResources</process-test-resources>
-            <test-compile>org.apache.maven.plugins:maven-compiler-plugin:testCompile</test-compile>
-            <test>org.apache.maven.plugins:maven-surefire-plugin:test</test>
-            <package>org.apache.maven.plugins:maven-jar-plugin:jar</package>
-            <install>org.apache.maven.plugins:maven-install-plugin:install</install>
-            <deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy>
-          </phases>
-        </lifecycle>
-      </lifecycles>
-    </configuration>
-  </component>
-
-
-      In the LifecycleExecutor we have configured what the lifecycles look like. Below we have the
-      "default" lifecycle. The mojos you see listed above for the "jar" packaging which are
-      specified to run in the "default" lifecycle will be mapped onto the phases you see below.
-
-  <lifecycle>
-    <id>default</id>
-    <phases>
-      <phase>validate</phase>
-      <phase>initialize</phase>
-      <phase>generate-sources</phase>
-      <phase>process-sources</phase>
-      <phase>generate-resources</phase>
-      <phase>process-resources</phase>
-      <phase>compile</phase>
-      <phase>process-classes</phase>
-      <phase>generate-test-sources</phase>
-      <phase>process-test-sources</phase>
-      <phase>generate-test-resources</phase>
-      <phase>process-test-resources</phase>
-      <phase>test-compile</phase>
-      <phase>process-test-classes</phase>
-      <phase>test</phase>
-      <phase>package</phase>
-      <phase>pre-integration-test</phase>
-      <phase>integration-test</phase>
-      <phase>post-integration-test</phase>
-      <phase>verify</phase>
-      <phase>install</phase>
-      <phase>deploy</phase>
-    </phases>
-  </lifecycle>  
+We have a lifecycle mapping for the packaging of *jar* below. You see that for this packaging we have a *default* lifecycle and a list of phases where each phase is a comma separated list of goals to run and they are in the form groupId:artifactId:version.
 
-     * 
-     */
\ No newline at end of file
+<configuration>
+  <lifecycles>
+    <lifecycle>
+      <id>default</id>
+      <phases>
+        <process-resources>org.apache.maven.plugins:maven-resources-plugin:resources</process-resources>
+        <compile>org.apache.maven.plugins:maven-compiler-plugin:compile</compile>
+        <process-test-resources>org.apache.maven.plugins:maven-resources-plugin:testResources</process-test-resources>
+        <test-compile>org.apache.maven.plugins:maven-compiler-plugin:testCompile</test-compile>
+        <test>org.apache.maven.plugins:maven-surefire-plugin:test</test>
+        <package>org.apache.maven.plugins:maven-jar-plugin:jar</package>
+        <install>org.apache.maven.plugins:maven-install-plugin:install</install>
+        <deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy>
+      </phases>
+    </lifecycle>
+  </lifecycles>
+</configuration>
+
+We need to turn this list of phases into a set of plugin objects that have an xml representation like the following:
+
+<plugins>
+  <plugin>
+    <groupId>org.apache.maven.plugins</groupId>
+    <artifactId>maven-resources-plugin</artifactId>
+    <executions>
+      <execution>
+        <goals>
+          <goal>process</goal>
+        </goals>
+      </execution>
+    </executions>
+  </plugin>
+  .
+  .
+  .
+</plugins>
+ 
+We need this form so that the model builder can make the first pass at merging. Full merging cannot be done because we don't know what the version of the plugin is yet that the user has requested. For plugins in the default lifecycle they are typically defined in the plugin management section of the parent POM. When the merging is complete we are going to have something that looks like the following:
+
+<plugins>
+  <plugin>
+    <groupId>org.apache.maven.plugins</groupId>
+    <artifactId>maven-resources-plugin</artifactId>
+    <version>1.0</version</version>
+    <executions>
+      <execution>
+        <goals>
+          <goal>process</goal>
+        </goals>
+      </execution>
+    </executions>
+  </plugin>
+  .
+  .
+  .
+</plugins>
+
+Once we have the version of the plugins the appropriate call to the plugin manager can be made to get the MojoDescriptor for the goal that needs to be run. In the MojoDescriptor we are interested in the <configuration/> element and <parameters/> element. From these elements we need to make a component configuration for the MojoExecution. The actual DOM like structure we create is of type PlexusConfiguration and is the type we use with the ComponentConfigurator to initialize fields in a Plexus component. Typically this is done within Plexus with the configuration supplied with component configuration, but in Maven we take configuration values from the POM. So we have to use the ComponentConfigurator outside of Plexus in order to configurure the Maven Mojo which is just a Plexus component. We can use the information from the MojoDescriptor along with the merged configuration information that is now present in the POM to create the complete PlexusConfiguration used to populate 
 values in the Maven Mojo. 
+
+foreach configuration element:
+ - if read only and being set squawk
+ 
+ - find the parameter
+ - get value from expression or default
+ - if required and null squawk
+
+      <configuration>
+        <attached implementation="boolean" default-value="true"/>
+        <localRepository implementation="org.apache.maven.artifact.repository.ArtifactRepository">${localRepository}</localRepository>
+        <resources implementation="java.util.List">${project.resources}</resources>
+        <repositories implementation="java.util.List">${project.repositories}</repositories>
+        <remoteArtifactRepositories implementation="java.util.List">${project.remoteArtifactRepositories}</remoteArtifactRepositories>
+        <appendedResourcesDirectory implementation="java.io.File">${basedir}/src/main/appended-resources</appendedResourcesDirectory>
+        <excludeScope implementation="java.lang.String" default-value="">${excludeScope}</excludeScope>
+        <includeScope implementation="java.lang.String" default-value="runtime">${includeScope}</includeScope>
+        <excludeGroupIds implementation="java.lang.String" default-value="">${excludeGroupIds}</excludeGroupIds>
+        <skip implementation="boolean" default-value="false">${remoteresources.skip}</skip>
+        <outputDirectory implementation="java.io.File">${project.build.directory}/maven-shared-archive-resources</outputDirectory>
+        <excludeArtifactIds implementation="java.lang.String" default-value="">${excludeArtifactIds}</excludeArtifactIds>
+        <excludeTransitive implementation="boolean" default-value="false">${excludeTransitive}</excludeTransitive>
+        <includeGroupIds implementation="java.lang.String" default-value="">${includeGroupIds}</includeGroupIds>
+        <mavenSession implementation="org.apache.maven.execution.MavenSession">${session}</mavenSession>
+        <project implementation="org.apache.maven.project.MavenProject">${project}</project>
+        <includeArtifactIds implementation="java.lang.String" default-value="">${includeArtifactIds}</includeArtifactIds>
+      </configuration>
+
+      <parameters>
+        <parameter>
+          <name>appendedResourcesDirectory</name>
+          <type>java.io.File</type>
+          <required>false</required>
+          <editable>true</editable>
+        </parameter>
+        <parameter>
+          <name>attached</name>
+          <type>boolean</type>
+          <required>false</required>
+          <editable>true</editable>
+        </parameter>
+        <parameter>
+          <name>excludeArtifactIds</name>
+          <type>java.lang.String</type>
+          <required>false</required>
+          <editable>true</editable>
+        </parameter>
+        <parameter>
+          <name>excludeGroupIds</name>
+          <type>java.lang.String</type>
+          <required>false</required>
+          <editable>true</editable>
+        </parameter>
+        <parameter>
+          <name>excludeScope</name>
+          <type>java.lang.String</type>
+          <required>false</required>
+          <editable>true</editable>
+        </parameter>
+        <parameter>
+          <name>excludeTransitive</name>
+          <type>boolean</type>
+          <required>false</required>
+          <editable>true</editable>
+        </parameter>
+        <parameter>
+          <name>includeArtifactIds</name>
+          <type>java.lang.String</type>
+          <required>false</required>
+          <editable>true</editable>
+        </parameter>
+        <parameter>
+          <name>includeGroupIds</name>
+          <type>java.lang.String</type>
+          <required>false</required>
+          <editable>true</editable>
+        </parameter>
+        <parameter>
+          <name>includeScope</name>
+          <type>java.lang.String</type>
+          <required>false</required>
+          <editable>true</editable>
+        </parameter>
+        <parameter>
+          <name>localRepository</name>
+          <type>org.apache.maven.artifact.repository.ArtifactRepository</type>
+          <required>true</required>
+          <editable>false</editable>
+        </parameter>
+        <parameter>
+          <name>mavenSession</name>
+          <type>org.apache.maven.execution.MavenSession</type>
+          <required>true</required>
+          <editable>false</editable>
+          <description>The Maven session.</description>
+        </parameter>
+        <parameter>
+          <name>outputDirectory</name>
+          <type>java.io.File</type>
+          <required>false</required>
+          <editable>true</editable>
+        </parameter>
+        <parameter>
+          <name>project</name>
+          <type>org.apache.maven.project.MavenProject</type>
+          <required>true</required>
+          <editable>false</editable>
+        </parameter>
+        <parameter>
+          <name>properties</name>
+          <type>java.util.Map</type>
+          <required>false</required>
+          <editable>true</editable>
+        </parameter>
+        <parameter>
+          <name>remoteArtifactRepositories</name>
+          <type>java.util.List</type>
+          <required>true</required>
+          <editable>false</editable>
+        </parameter>
+        <parameter>
+          <name>repositories</name>
+          <type>java.util.List</type>
+          <required>true</required>
+          <editable>false</editable>
+        </parameter>
+        <parameter>
+          <name>resourceBundles</name>
+          <type>java.util.List</type>
+          <required>true</required>
+          <editable>true</editable>
+        </parameter>
+        <parameter>
+          <name>resources</name>
+          <type>java.util.List</type>
+          <required>true</required>
+          <editable>false</editable>
+        </parameter>
+        <parameter>
+          <name>skip</name>
+          <type>boolean</type>
+          <required>false</required>
+          <editable>true</editable>
+        </parameter>
+        <parameter>
+          <name>supplementalModels</name>
+          <type>java.lang.String[]</type>
+          <required>false</required>
+          <editable>true</editable>
+        </parameter>
+      </parameters>
+
+- we need to know what came from the POM, and validate those
+- plugin in any default values
+- check to see if anything is missing