You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by bw...@apache.org on 2003/04/09 10:15:06 UTC

cvs commit: maven/src/java/org/apache/maven/plugin PluginManager.java

bwalding    2003/04/09 01:15:06

  Modified:    src/java/org/apache/maven/plugin PluginManager.java
  Log:
  Now throws NoGoalException if no goal could be found to run
  PR: MAVEN-137
  
  Revision  Changes    Path
  1.44      +16 -7     maven/src/java/org/apache/maven/plugin/PluginManager.java
  
  Index: PluginManager.java
  ===================================================================
  RCS file: /home/cvs/maven/src/java/org/apache/maven/plugin/PluginManager.java,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- PluginManager.java	12 Mar 2003 15:53:21 -0000	1.43
  +++ PluginManager.java	9 Apr 2003 08:15:06 -0000	1.44
  @@ -65,10 +65,12 @@
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   import org.apache.maven.AbstractMavenComponent;
  +import org.apache.maven.GoalException;
   import org.apache.maven.MavenConstants;
   import org.apache.maven.MavenException;
   import org.apache.maven.MavenSession;
   import org.apache.maven.MavenUtils;
  +import org.apache.maven.NoGoalException;
   import org.apache.maven.UnknownGoalException;
   import org.apache.maven.jelly.JellyUtils;
   import org.apache.maven.jelly.MavenJellyContext;
  @@ -326,7 +328,7 @@
        *  @throws Exception If an exception occurs while running a goal.
        */
       public void attainGoals( Project project )
  -        throws UnknownGoalException, Exception
  +        throws GoalException, Exception
       {
           // Before attempting to attain the goals verify the project
           // if desired.
  @@ -357,13 +359,20 @@
           // specified in the driver.properties file.
   
           //if ( goalNames.size() == 1 )
  -        if ( project.getGoalNames().size() == 0 )
  +        if ( project.getGoalNames().size() == 0)
           {
  -            String defaultGoalName = project.getContext().getWerkzProject().getDefaultGoalName();
  -
  -            if ( defaultGoalName != null )
  +            if (project.getContext().getWerkzProject() == null)
  +            {
  +                throw new NoGoalException("No goal specified and no project.xml found.");    
  +            } 
  +            else 
               {
  -                project.getGoalNames().add( defaultGoalName );
  +                String defaultGoalName = project.getContext().getWerkzProject().getDefaultGoalName();
  +    
  +                if ( defaultGoalName != null )
  +                {
  +                    project.getGoalNames().add( defaultGoalName );
  +                }
               }
           }
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org