jvanzyl     2002/12/09 18:22:05

  Modified:    src/java/org/apache/maven/plugin PluginManager.java
  Log:
  o Use the ArtifactListBuilder.
  
  Revision  Changes    Path
  1.15      +11 -17    
jakarta-turbine-maven/src/java/org/apache/maven/plugin/PluginManager.java
  
  Index: PluginManager.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/plugin/PluginManager.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- PluginManager.java        8 Dec 2002 20:32:39 -0000       1.14
  +++ PluginManager.java        10 Dec 2002 02:22:05 -0000      1.15
  @@ -63,6 +63,7 @@
   import org.apache.maven.AbstractMavenComponent;
   import org.apache.maven.DependencyClasspathBuilder;
   import org.apache.maven.MavenUtils;
  +import org.apache.maven.ArtifactListBuilder;
   import org.apache.maven.verifier.DependencyVerifier;
   import org.apache.maven.jelly.JellyUtils;
   import org.apache.maven.jelly.MavenJellyContext;
  @@ -917,32 +918,25 @@
               createNewFile( getPluginProcessedMarker( name ) );
           }
   
  -        for ( Iterator i = pluginProject.getDependencies().iterator(); i.hasNext(); 
)
  +        List projectArtifacts = ArtifactListBuilder.build( pluginProject, 
pluginContext );
  +
  +        for ( Iterator i = projectArtifacts.iterator(); i.hasNext(); )
           {
  -            Dependency dependency = (Dependency) i.next();
  +            Artifact artifact = (Artifact) i.next();
  +            Dependency dependency = artifact.getDependency();
               String classloader = dependency.getProperty( "classloader" );
   
               // Only add compile type dependencies to classloader
  -            if ( classloader != null
  -                 &&
  -               ( dependency.isCompileType() || dependency.isTestType() ) )
  -            {
  -                Artifact artifact = DefaultArtifactFactory.createArtifact( 
dependency );
  -                String localRepo = getContext().getMavenRepoLocal();
  -                File jarFile = new File( localRepo, artifact.getPath() );
  -
  +            if ( classloader != null && dependency.getType().equals( "jar" ) )
  +            {
                   // We have the jar and the classloader to push it into so
                   // lets do it!
  -                if ( jarFile.exists() )
  +                if ( artifact.exists() )
                   {
                       // Make sure the stated classloader actually exists.
                       if ( Forehead.getInstance().getClassLoader( classloader ) != 
null )
                       {
  -                        if ( log.isDebugEnabled() )
  -                        {
  -                            log.debug( "Adding " + jarFile + " to " + classloader );
  -                        }
  -                        Forehead.getInstance().getClassLoader( classloader 
).addURL( jarFile.toURL() );
  +                        Forehead.getInstance().getClassLoader( classloader 
).addURL( artifact.getFile().toURL() );
                       }
                   }
               }
  
  
  

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

Reply via email to