maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jvan...@apache.org
Subject svn commit: r757504 - in /maven/components/branches/MNG-2766/maven-core/src: main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java
Date Mon, 23 Mar 2009 19:06:49 GMT
Author: jvanzyl
Date: Mon Mar 23 19:06:48 2009
New Revision: 757504

URL: http://svn.apache.org/viewvc?rev=757504&view=rev
Log:
o trying to figure out what calls are most useful in something like m2e that is going to make
a hyper-optimized lifecycle
  based on what's required in the IDE versus the CLI

Modified:
    maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
    maven/components/branches/MNG-2766/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java

Modified: maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java?rev=757504&r1=757503&r2=757504&view=diff
==============================================================================
--- maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
(original)
+++ maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
Mon Mar 23 19:06:48 2009
@@ -24,6 +24,7 @@
 import java.util.StringTokenizer;
 
 import org.apache.maven.BuildFailureException;
+import org.apache.maven.artifact.Artifact;
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.execution.ReactorManager;
 import org.apache.maven.lifecycle.mapping.LifecycleMapping;
@@ -40,6 +41,11 @@
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
 
+//TODO: The configuration for the lifecycle needs to be externalized so that I can use the
annotations
+//      properly for the wiring and reference and external source for the lifecycle configuration.
+//TODO: Inside an IDE we are replacing the notion of our reactor with a workspace. In both
of these cases
+//      we need to layer these as local repositories.
+
 /**
  * @author Jason van Zyl
  */
@@ -52,13 +58,14 @@
     @Requirement
     private PluginManager pluginManager;
 
+    @Requirement
+    private Map<String, LifecycleMapping> lifecycleMappings;
+    
+    // @Configuration(source="org/apache/maven/lifecycle/lifecycles.xml")    
     private List<Lifecycle> lifecycles;
 
     private Map<String, Lifecycle> phaseToLifecycleMap;
 
-    @Requirement
-    private Map<String, LifecycleMapping> lifecycleMappings;
-
     public void execute( MavenSession session )
         throws BuildFailureException, LifecycleExecutionException
     {
@@ -108,12 +115,8 @@
         {
             if ( !session.getReactorManager().isBlackListed( currentProject ) )
             {
-                line();
-
                 logger.info( "Building " + currentProject.getName() );
 
-                line();
-
                 // !! This is ripe for refactoring to an aspect.
                 // Event monitoring.
                 String event = MavenEvents.PROJECT_EXECUTION;
@@ -294,6 +297,22 @@
          */
     }
 
+    //TODO: which form is most useful. passing in string to parse is not really good.
+    
+    MojoDescriptor getMojoDescriptor( Artifact pluginArtifact, String goal, MavenSession
session, MavenProject project )
+        throws LifecycleExecutionException
+    {
+        return null;
+    }    
+    
+    
+    MojoDescriptor getMojoDescriptor( String groupId, String artifactId, String version,
String goal, MavenSession session, MavenProject project )
+        throws LifecycleExecutionException
+    {
+        return null;
+    }    
+    
+    // org.apache.maven.plugins:maven-remote-resources-plugin:1.0:process
     MojoDescriptor getMojoDescriptor( String task, MavenSession session, MavenProject project
)
         throws LifecycleExecutionException
     {
@@ -376,11 +395,6 @@
         return mojoDescriptor;
     }
 
-    protected void line()
-    {
-        logger.info( "------------------------------------------------------------------------"
);
-    }
-
     private PluginDescriptor loadPlugin( Plugin plugin, MavenProject project, MavenSession
session )
         throws LifecycleExecutionException
     {

Modified: maven/components/branches/MNG-2766/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java
URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java?rev=757504&r1=757503&r2=757504&view=diff
==============================================================================
--- maven/components/branches/MNG-2766/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java
(original)
+++ maven/components/branches/MNG-2766/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java
Mon Mar 23 19:06:48 2009
@@ -89,13 +89,10 @@
         File sourceDirectory = new File( getBasedir(), "src/test/" + base );
         File targetDirectory = new File( getBasedir(), "target/" + base );
         FileUtils.copyDirectoryStructure( sourceDirectory, targetDirectory );
-        File targetPom = new File( targetDirectory, "pom.xml" );        
-        
-        MavenSession session = createMavenSession( targetPom );
-        
+        File targetPom = new File( targetDirectory, "pom.xml" );                
+        MavenSession session = createMavenSession( targetPom );        
         assertEquals( "project-with-additional-lifecycle-elements", session.getCurrentProject().getArtifactId()
);
-        assertEquals( "1.0-SNAPSHOT", session.getCurrentProject().getVersion() );       
        
-                
+        assertEquals( "1.0-SNAPSHOT", session.getCurrentProject().getVersion() );       
                        
         lifecycleExecutor.execute( session );
     }
     
@@ -107,19 +104,11 @@
         throws Exception
     {
         MavenSession session = createMavenSession( targetPom );       
-
         String pluginArtifactId = "remote-resources";
         String goal = "process";
         MojoDescriptor mojoDescriptor = lifecycleExecutor.getMojoDescriptor( pluginArtifactId
+ ":" + goal, session, session.getCurrentProject() );
-
-        PluginDescriptor pd = mojoDescriptor.getPluginDescriptor();
-        assertNotNull( pd );
-        assertEquals( "org.apache.maven.plugins", pd.getGroupId() );
-        assertEquals( "maven-remote-resources-plugin", pd.getArtifactId() );
-        assertEquals( "1.0", pd.getVersion() );
-
+        assertPluginDescriptor( mojoDescriptor, "org.apache.maven.plugins", "maven-remote-resources-plugin",
"1.0" );
         MojoExecution mojoExecution = new MojoExecution( mojoDescriptor );
-
         pluginManager.executeMojo( session.getCurrentProject(), mojoExecution, session );
     }
 
@@ -127,20 +116,11 @@
         throws Exception
     {
         MavenSession session = createMavenSession( targetPom );       
-
         String pluginArtifactId = "surefire";
         String goal = "test";
         MojoDescriptor mojoDescriptor = lifecycleExecutor.getMojoDescriptor( pluginArtifactId
+ ":" + goal, session, session.getCurrentProject() );
-        assertNotNull( mojoDescriptor );
-        
-        PluginDescriptor pd = mojoDescriptor.getPluginDescriptor();
-        assertNotNull( pd );
-        assertEquals( "org.apache.maven.plugins", pd.getGroupId() );
-        assertEquals( "maven-surefire-plugin", pd.getArtifactId() );
-        assertEquals( "2.4.2", pd.getVersion() );
-
+        assertPluginDescriptor( mojoDescriptor, "org.apache.maven.plugins", "maven-surefire-plugin",
"2.4.2" );
         MojoExecution mojoExecution = new MojoExecution( mojoDescriptor );
-
         pluginManager.executeMojo( session.getCurrentProject(), mojoExecution, session );
     }
     
@@ -148,6 +128,16 @@
     // Testing help
     // -----------------------------------------------------------------------------------------------
 
+    protected void assertPluginDescriptor( MojoDescriptor mojoDescriptor, String groupId,
String artifactId, String version )
+    {
+        assertNotNull( mojoDescriptor );        
+        PluginDescriptor pd = mojoDescriptor.getPluginDescriptor();
+        assertNotNull( pd );
+        assertEquals( groupId, pd.getGroupId() );
+        assertEquals( artifactId, pd.getArtifactId() );
+        assertEquals( version, pd.getVersion() );        
+    }
+    
     /**
      * We need to customize the standard Plexus container with the plugin discovery listener
which
      * is what looks for the META-INF/maven/plugin.xml resources that enter the system when
a



Mime
View raw message