You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by jv...@apache.org on 2004/05/15 08:23:11 UTC

cvs commit: maven-components/maven-core/src/test/java/org/apache/maven/plugin PluginDescriptorBuilderTest.java PluginTest.java

jvanzyl     2004/05/14 23:23:11

  Modified:    maven-core/src/main/java/org/apache/maven
                        DefaultMavenCore.java Maven.java MavenCore.java
               maven-core/src/main/java/org/apache/maven/plugin
                        IntegratedPluginGoalTestCase.java
               maven-core/src/main/java/org/apache/maven/plugin/discovery
                        MavenPluginDiscoverer.java
               maven-core/src/main/java/org/apache/maven/plugin/manager
                        DefaultPluginManager.java PluginManager.java
               maven-core/src/test/java/org/apache/maven/plugin
                        PluginDescriptorBuilderTest.java PluginTest.java
  Added:       maven-core/src/main/java/org/apache/maven/plugin
                        GoalDescriptor.java ParameterDescriptor.java
                        PluginDescriptor.java PluginDescriptorBuilder.java
  Removed:     maven-core/src/main/java/org/apache/maven/plugin/descriptor
                        GoalDescriptor.java ParameterDescriptor.java
                        PluginDescriptor.java PluginDescriptorBuilder.java
  Log:
  o made some changes in plexus to allow its component descriptor to be
    decoupled from custom component descriptors which maven is.
  
    decoupled so that tools can be made to work with the plugin.xml format
    free and clear of plexus. the discovery process just uses a reader now
    and not a plexus configuration.
  
    this is part of work to make pluggy as small as possible and free of
    any large dependencies like plexus so that tools created for working
    with plugins are small. the first one i want to integrate is the
    generation of the plugin.xml files and plugin doco from @tags
    in the plugin sources.
  
    also part of work to decouple the current org.apache.maven.plugin
    code into a separate build of ~4k.
  
  Revision  Changes    Path
  1.5       +3 -2      maven-components/maven-core/src/main/java/org/apache/maven/DefaultMavenCore.java
  
  Index: DefaultMavenCore.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/DefaultMavenCore.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DefaultMavenCore.java	12 May 2004 23:38:40 -0000	1.4
  +++ DefaultMavenCore.java	15 May 2004 06:23:11 -0000	1.5
  @@ -18,8 +18,9 @@
   
   import org.apache.maven.lifecycle.MavenLifecycleContext;
   import org.apache.maven.lifecycle.MavenLifecycleManager;
  -import org.apache.maven.plugin.descriptor.GoalDescriptor;
  -import org.apache.maven.plugin.descriptor.PluginDescriptor;
  +import org.apache.maven.plugin.GoalDescriptor;
  +import org.apache.maven.plugin.PluginDescriptor;
  +import org.apache.maven.plugin.PluginDescriptor;
   import org.apache.maven.plugin.manager.PluginManager;
   import org.apache.maven.project.MavenProject;
   import org.apache.maven.project.MavenProjectBuilder;
  
  
  
  1.15      +3 -3      maven-components/maven-core/src/main/java/org/apache/maven/Maven.java
  
  Index: Maven.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/Maven.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- Maven.java	12 May 2004 23:38:40 -0000	1.14
  +++ Maven.java	15 May 2004 06:23:11 -0000	1.15
  @@ -16,8 +16,8 @@
    * limitations under the License.
    */
   
  -import org.apache.maven.plugin.descriptor.GoalDescriptor;
  -import org.apache.maven.plugin.descriptor.PluginDescriptor;
  +import org.apache.maven.plugin.GoalDescriptor;
  +import org.apache.maven.plugin.PluginDescriptor;
   import org.apache.maven.project.MavenProject;
   import org.apache.maven.project.ProjectBuildingException;
   import org.codehaus.classworlds.ClassWorld;
  
  
  
  1.4       +4 -3      maven-components/maven-core/src/main/java/org/apache/maven/MavenCore.java
  
  Index: MavenCore.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/MavenCore.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- MavenCore.java	12 May 2004 23:38:40 -0000	1.3
  +++ MavenCore.java	15 May 2004 06:23:11 -0000	1.4
  @@ -16,8 +16,9 @@
    * limitations under the License.
    */
   
  -import org.apache.maven.plugin.descriptor.GoalDescriptor;
  -import org.apache.maven.plugin.descriptor.PluginDescriptor;
  +import org.apache.maven.plugin.GoalDescriptor;
  +import org.apache.maven.plugin.PluginDescriptor;
  +import org.apache.maven.plugin.GoalDescriptor;
   import org.apache.maven.project.MavenProject;
   import org.apache.maven.project.ProjectBuildingException;
   
  
  
  
  1.3       +1 -4      maven-components/maven-core/src/main/java/org/apache/maven/plugin/IntegratedPluginGoalTestCase.java
  
  Index: IntegratedPluginGoalTestCase.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/plugin/IntegratedPluginGoalTestCase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- IntegratedPluginGoalTestCase.java	8 May 2004 21:11:17 -0000	1.2
  +++ IntegratedPluginGoalTestCase.java	15 May 2004 06:23:11 -0000	1.3
  @@ -1,8 +1,5 @@
   package org.apache.maven.plugin;
   
  -import org.apache.maven.plugin.descriptor.GoalDescriptor;
  -import org.apache.maven.plugin.descriptor.PluginDescriptor;
  -import org.apache.maven.plugin.descriptor.PluginDescriptorBuilder;
   import org.apache.maven.plugin.manager.DefaultPluginManager;
   import org.apache.maven.plugin.manager.executor.IntegratedPluginExecutor;
   import org.apache.maven.project.MavenProject;
  
  
  
  1.1                  maven-components/maven-core/src/main/java/org/apache/maven/plugin/GoalDescriptor.java
  
  Index: GoalDescriptor.java
  ===================================================================
  package org.apache.maven.plugin;
  
  /*
   * Copyright 2001-2004 The Apache Software Foundation.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  import java.util.List;
  
  /**
   * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
   * @version $Id: GoalDescriptor.java,v 1.1 2004/05/15 06:23:11 jvanzyl Exp $
   */
  public class GoalDescriptor
  {
      private String name;
  
      private List parameters;
  
      private List prereqs;
  
      private String description;
  
      private boolean requiresDependencyResolution = true;
  
      private boolean requiresProject = true;
  
      private String method = "execute";
  
      public String getName()
      {
          return name;
      }
  
      public List getPrereqs()
      {
          return prereqs;
      }
  
      public String getDescription()
      {
          return description;
      }
  
      public List getParameters()
      {
          return parameters;
      }
  
      public String getMethod()
      {
          return method;
      }
  
      // ----------------------------------------------------------------------
      //
      // ----------------------------------------------------------------------
  
      public void setName( String name )
      {
          this.name = name;
      }
  
      public void setParameters( List parameters )
      {
          this.parameters = parameters;
      }
  
      public void setPrereqs( List prereqs )
      {
          this.prereqs = prereqs;
      }
  
      public void setDescription( String description )
      {
          this.description = description;
      }
  
      public void setRequiresDependencyResolution( boolean requiresDependencyResolution )
      {
          this.requiresDependencyResolution = requiresDependencyResolution;
      }
  
      public void setRequiresProject( boolean requiresProject )
      {
          this.requiresProject = requiresProject;
      }
  
      public void setMethod( String method )
      {
          this.method = method;
      }
  }
  
  
  1.1                  maven-components/maven-core/src/main/java/org/apache/maven/plugin/ParameterDescriptor.java
  
  Index: ParameterDescriptor.java
  ===================================================================
  package org.apache.maven.plugin;
  
  /*
   * Copyright 2001-2004 The Apache Software Foundation.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  /**
   * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
   * @version $Id: ParameterDescriptor.java,v 1.1 2004/05/15 06:23:11 jvanzyl Exp $
   */
  public class ParameterDescriptor
  {
      private String name;
  
      private String expression;
  
      private String description;
  
      public String getName()
      {
          return name;
      }
  
      public String getExpression()
      {
          return expression;
      }
  
      public String getDescription()
      {
          return description;
      }
  
      // ----------------------------------------------------------------------
      //
      // ----------------------------------------------------------------------
  
      public void setName( String name )
      {
          this.name = name;
      }
  
      public void setExpression( String expression )
      {
          this.expression = expression;
      }
  
      public void setDescription( String description )
      {
          this.description = description;
      }
  }
  
  
  
  1.1                  maven-components/maven-core/src/main/java/org/apache/maven/plugin/PluginDescriptor.java
  
  Index: PluginDescriptor.java
  ===================================================================
  package org.apache.maven.plugin;
  
  /*
   * Copyright 2001-2004 The Apache Software Foundation.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  import org.codehaus.plexus.component.repository.ComponentDescriptor;
  
  import java.util.List;
  
  public class PluginDescriptor
      extends ComponentDescriptor
  {
      private String id;
  
      private List goals;
  
      private String mode;
  
      public String getRole()
      {
          return "org.apache.maven.plugin.Plugin";
      }
  
      public String getId()
      {
          return id;
      }
  
      public String getRoleHint()
      {
          return id;
      }
  
      public List getGoals()
      {
          return goals;
      }
  
      public String getMode()
      {
          return mode;
      }
  
      // ----------------------------------------------------------------------
      // Setters used by tools like pluggy
      // ----------------------------------------------------------------------
  
      public void setId( String id )
      {
          this.id = id;
      }
  
      public void setGoals( List goals )
      {
          this.goals = goals;
      }
  
      public void setMode( String mode )
      {
          this.mode = mode;
      }
  }
  
  
  
  1.1                  maven-components/maven-core/src/main/java/org/apache/maven/plugin/PluginDescriptorBuilder.java
  
  Index: PluginDescriptorBuilder.java
  ===================================================================
  package org.apache.maven.plugin;
  
  /*
   * Copyright 2001-2004 The Apache Software Foundation.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  import org.codehaus.plexus.configuration.PlexusConfiguration;
  import org.codehaus.plexus.configuration.xml.xstream.PlexusXStream;
  import org.codehaus.plexus.configuration.xml.xstream.alias.HyphenatedClassMapper;
  import org.codehaus.plexus.configuration.xml.xstream.alias.HyphenatedNameMapper;
  
  import java.io.Reader;
  import java.io.StringReader;
  
  import com.thoughtworks.xstream.XStream;
  import com.thoughtworks.xstream.xml.xpp3.Xpp3DomXMLReaderDriver;
  import com.thoughtworks.xstream.xml.xpp3.Xpp3DomBuilder;
  import com.thoughtworks.xstream.xml.xpp3.Xpp3DomXMLReader;
  import com.thoughtworks.xstream.objecttree.reflection.JavaReflectionObjectFactory;
  
  /**
   * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
   * @version $Id: PluginDescriptorBuilder.java,v 1.1 2004/05/15 06:23:11 jvanzyl Exp $
   */
  public class PluginDescriptorBuilder
  {
      private XStream xstream;
  
      public PluginDescriptorBuilder()
      {
          xstream = new XStream( new JavaReflectionObjectFactory(),
                                 new HyphenatedClassMapper( new HyphenatedNameMapper() ),
                                 new Xpp3DomXMLReaderDriver(),
                                 "implementation" );
  
          xstream.alias( "plugin", PluginDescriptor.class );
  
          xstream.alias( "goal", GoalDescriptor.class );
  
          xstream.alias( "prereq", String.class );
  
          xstream.alias( "parameter", ParameterDescriptor.class );
      }
  
      public PluginDescriptor build( Reader reader )
          throws Exception
      {
          return (PluginDescriptor) xstream.fromXML( new Xpp3DomXMLReader( Xpp3DomBuilder.build( reader ) ) );
      }
  }
  
  
  
  1.3       +6 -4      maven-components/maven-core/src/main/java/org/apache/maven/plugin/discovery/MavenPluginDiscoverer.java
  
  Index: MavenPluginDiscoverer.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/plugin/discovery/MavenPluginDiscoverer.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MavenPluginDiscoverer.java	12 May 2004 23:38:40 -0000	1.2
  +++ MavenPluginDiscoverer.java	15 May 2004 06:23:11 -0000	1.3
  @@ -16,13 +16,15 @@
    * limitations under the License.
    */
   
  -import org.apache.maven.plugin.descriptor.PluginDescriptor;
  -import org.apache.maven.plugin.descriptor.PluginDescriptorBuilder;
  +import org.apache.maven.plugin.PluginDescriptor;
  +import org.apache.maven.plugin.PluginDescriptorBuilder;
  +import org.apache.maven.plugin.PluginDescriptor;
   import org.codehaus.plexus.component.discovery.AbstractComponentDiscoverer;
   import org.codehaus.plexus.configuration.PlexusConfiguration;
   
   import java.util.ArrayList;
   import java.util.List;
  +import java.io.Reader;
   
   /**
    * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
  @@ -64,7 +66,7 @@
       // </plugin>
       // ----------------------------------------------------------------------------------
   
  -    public List createComponentDescriptors( PlexusConfiguration componentDescriptorConfiguration )
  +    public List createComponentDescriptors( Reader componentDescriptorConfiguration )
           throws Exception
       {
           List componentDescriptors = new ArrayList();
  
  
  
  1.4       +6 -4      maven-components/maven-core/src/main/java/org/apache/maven/plugin/manager/DefaultPluginManager.java
  
  Index: DefaultPluginManager.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/plugin/manager/DefaultPluginManager.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DefaultPluginManager.java	12 May 2004 23:38:40 -0000	1.3
  +++ DefaultPluginManager.java	15 May 2004 06:23:11 -0000	1.4
  @@ -20,10 +20,12 @@
   import org.apache.maven.plugin.Plugin;
   import org.apache.maven.plugin.PluginExecutionRequest;
   import org.apache.maven.plugin.PluginExecutionResponse;
  -import org.apache.maven.plugin.descriptor.GoalDescriptor;
  -import org.apache.maven.plugin.descriptor.ParameterDescriptor;
  -import org.apache.maven.plugin.descriptor.PluginDescriptor;
  -import org.apache.maven.plugin.descriptor.PluginDescriptorBuilder;
  +import org.apache.maven.plugin.PluginDescriptorBuilder;
  +import org.apache.maven.plugin.GoalDescriptor;
  +import org.apache.maven.plugin.ParameterDescriptor;
  +import org.apache.maven.plugin.PluginDescriptor;
  +import org.apache.maven.plugin.PluginDescriptorBuilder;
  +import org.apache.maven.plugin.GoalDescriptor;
   import org.apache.maven.plugin.manager.executor.PluginExecutor;
   import org.apache.maven.project.MavenProject;
   import org.apache.maven.script.GoalDecorator;
  
  
  
  1.10      +5 -3      maven-components/maven-core/src/main/java/org/apache/maven/plugin/manager/PluginManager.java
  
  Index: PluginManager.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/plugin/manager/PluginManager.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- PluginManager.java	12 May 2004 23:38:40 -0000	1.9
  +++ PluginManager.java	15 May 2004 06:23:11 -0000	1.10
  @@ -18,8 +18,10 @@
   
   import org.apache.maven.lifecycle.MavenLifecycleContext;
   import org.apache.maven.plugin.PluginExecutionResponse;
  -import org.apache.maven.plugin.descriptor.GoalDescriptor;
  -import org.apache.maven.plugin.descriptor.PluginDescriptor;
  +import org.apache.maven.plugin.GoalDescriptor;
  +import org.apache.maven.plugin.GoalDescriptor;
  +import org.apache.maven.plugin.PluginDescriptor;
  +import org.apache.maven.plugin.PluginDescriptor;
   
   import java.util.Map;
   
  
  
  
  1.5       +3 -7      maven-components/maven-core/src/test/java/org/apache/maven/plugin/PluginDescriptorBuilderTest.java
  
  Index: PluginDescriptorBuilderTest.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/test/java/org/apache/maven/plugin/PluginDescriptorBuilderTest.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PluginDescriptorBuilderTest.java	22 Mar 2004 18:05:39 -0000	1.4
  +++ PluginDescriptorBuilderTest.java	15 May 2004 06:23:11 -0000	1.5
  @@ -17,12 +17,8 @@
    */
   
   import junit.framework.TestCase;
  -import org.apache.maven.plugin.descriptor.GoalDescriptor;
  -import org.apache.maven.plugin.descriptor.PluginDescriptor;
  -import org.apache.maven.plugin.descriptor.PluginDescriptorBuilder;
  -import org.apache.maven.plugin.descriptor.ParameterDescriptor;
  -import org.codehaus.plexus.configuration.PlexusConfiguration;
   
  +import java.io.StringReader;
   import java.util.List;
   
   /**
  @@ -70,7 +66,7 @@
   
           PluginDescriptorBuilder pluginDescriptorBuilder = new PluginDescriptorBuilder();
   
  -        PluginDescriptor pd = pluginDescriptorBuilder.build( xml );
  +        PluginDescriptor pd = pluginDescriptorBuilder.build( new StringReader( xml ) );
   
           assertEquals( "compiler", pd.getId() );
   
  
  
  
  1.8       +3 -3      maven-components/maven-core/src/test/java/org/apache/maven/plugin/PluginTest.java
  
  Index: PluginTest.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/test/java/org/apache/maven/plugin/PluginTest.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- PluginTest.java	8 May 2004 21:11:17 -0000	1.7
  +++ PluginTest.java	15 May 2004 06:23:11 -0000	1.8
  @@ -18,8 +18,8 @@
   
   import org.apache.maven.MavenCore;
   import org.apache.maven.MavenPlexusComponentTestBase;
  -import org.apache.maven.plugin.descriptor.PluginDescriptor;
  -import org.apache.maven.plugin.descriptor.PluginDescriptorBuilder;
  +import org.apache.maven.plugin.PluginDescriptor;
  +import org.apache.maven.plugin.PluginDescriptorBuilder;
   import org.apache.maven.plugin.manager.PluginManager;
   
   import java.io.File;
  
  
  

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