dion        2003/08/13 22:59:48

  Modified:    src/java/org/apache/maven/project Tag: MAVEN_RC1_STABLE
                        Project.java
  Log:
  Add plugin installation to dependency processing
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.83.2.3  +17 -17    maven/src/java/org/apache/maven/project/Project.java
  
  Index: Project.java
  ===================================================================
  RCS file: /home/cvs/maven/src/java/org/apache/maven/project/Project.java,v
  retrieving revision 1.83.2.2
  retrieving revision 1.83.2.3
  diff -u -r1.83.2.2 -r1.83.2.3
  --- Project.java      11 Aug 2003 06:21:33 -0000      1.83.2.2
  +++ Project.java      14 Aug 2003 05:59:48 -0000      1.83.2.3
  @@ -61,6 +61,7 @@
   import org.apache.maven.DependencyClasspathBuilder;
   import org.apache.maven.ArtifactListBuilder;
   import org.apache.maven.AntProjectBuilder;
  +import org.apache.maven.plugin.PluginManager;
   import org.apache.maven.repository.Artifact;
   import org.apache.maven.verifier.RepoConfigException;
   import org.apache.maven.verifier.UnsatisfiedDependencyException;
  @@ -1424,17 +1425,6 @@
       }
   
       /**
  -     * Jars and ejbs.
  -     * 
  -     * @param d
  -     * @return true if the given dependency belongs on the classpath
  -     */
  -    private boolean isClasspathDependency(Dependency d)
  -    {
  -        return d.getType().equals( "jar" ) || d.getType().equals( "ejb" );
  -    }
  -
  -    /**
        * Build the dependency classpath.
        *
        * @throws Exception If an error occurs while building the dependency classpath.
  @@ -1589,7 +1579,7 @@
        * @param cl The classloader to add dependencies
        * @throws MalformedURLException
        */
  -    public void processDependencies() throws MalformedURLException
  +    public void processDependencies() throws MalformedURLException, Exception
       {
           if (getArtifacts() == null)
           {
  @@ -1607,6 +1597,18 @@
               {
                   ForeheadClassLoader loader = 
(ForeheadClassLoader)projectClassLoader;
                   Artifact artifact = (Artifact) i.next();
  +                Dependency dependency = artifact.getDependency();
  +                // FIXME: handle plugin dependencies here - download from remote 
repos
  +                //        and install
  +                if (dependency.isPlugin())
  +                {
  +                    // dependencies should already be downloaded
  +                    // so the artifact needs to be copied to the plugin
  +                    // directory and the plugin manager asked to load it
  +                    PluginManager pluginManager = 
getContext().getMavenSession().getPluginManager();
  +                    pluginManager.installPlugin(this, artifact.getFile());
  +                }
  +
                   // get correct classloader
                   String classLoader = artifact.getDependency().getProperty( 
"classloader" );
                   if (classLoader != null)
  @@ -1623,7 +1625,7 @@
                   // add to classloader
                   if (artifact.exists())
                   {
  -                    if (isClasspathDependency(artifact.getDependency()))
  +                    if (dependency.isAddedToClasspath())
                       {
                           loader.addURL( artifact.getFile().toURL() );
                       }
  @@ -1637,9 +1639,6 @@
                   {
                       log.info("Artifact '" + artifact.getFile() + "' not found to 
add to classpath");
                   }
  -                
  -                // FIXME: handle plugin dependencies here - download from remote 
repos
  -                //        and install 
               }
           }
           
  @@ -1648,4 +1647,5 @@
           // poked all the dependencies into the classloader.
           getContext().setClassLoader( projectClassLoader );
       }
  +
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to