brett 2004/03/04 21:17:17 Modified: src/java/org/apache/maven/plugin Tag: MAVEN-1_0-BRANCH PluginManager.java Log: rationalise dependency processing Revision Changes Path No revision No revision 1.70.4.22 +13 -23 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.70.4.21 retrieving revision 1.70.4.22 diff -u -r1.70.4.21 -r1.70.4.22 --- PluginManager.java 1 Mar 2004 22:36:38 -0000 1.70.4.21 +++ PluginManager.java 5 Mar 2004 05:17:16 -0000 1.70.4.22 @@ -283,18 +283,8 @@ { JellyScriptHousing jellyScriptHousing = new JellyScriptHousing(); - // TODO [1.0]: this is processing the loaded project, and hence all project dependencies - move it? - ForeheadClassLoader classLoader = new ForeheadClassLoader( Forehead.getInstance().getClassLoader( ROOT_MAVEN_CLASSLOADER ), project.getId() ); - - // We will add the JARs that have been instructed to be place in the class loader - // for use in the plugin in the plugin class loader. - processDependencies( project, classLoader ); - // Now lets compile the script once so we can use it repeatedly. - Script script = null; - - // Projects may not have a maven.xml file. - script = JellyUtils.compileScript( jelly, project.getContext() ); + Script script = JellyUtils.compileScript( jelly, project.getContext() ); jellyScriptHousing.setProject( project ); jellyScriptHousing.setScript( script ); @@ -314,13 +304,6 @@ { JellyScriptHousing jellyScriptHousing = new JellyScriptHousing(); - // TOOD [1.0]: isn't this all redundant processing? - ForeheadClassLoader classLoader = new ForeheadClassLoader( Forehead.getInstance().getClassLoader( ROOT_MAVEN_CLASSLOADER ), project.getId() ); - - // We will add the JARs that have been instructed to be place in the class loader - // for use in the plugin in the plugin class loader. - processDependencies( project, classLoader ); - jellyScriptHousing.setProject( project ); jellyScriptHousing.setSource( jelly ); @@ -342,6 +325,7 @@ log.debug( "No dependencies to process for project " + project.getName() ); return; } + log.debug( "Processing dependencies for project " + project.getName() ); // add the dependencies to the classpath for ( Iterator i = project.getArtifacts().iterator(); i.hasNext(); ) @@ -369,9 +353,12 @@ ForeheadClassLoader loader = Forehead.getInstance().getClassLoader( dependencyClassLoader ); if ( loader == null ) { - log.info( "classloader '" + dependencyClassLoader + "' not found. Adding dependencies to " + "the project classloader instead" ); + log.warn( "classloader '" + dependencyClassLoader + "' not found. Adding dependencies to the project classloader instead" ); loader = projectClassLoader; } + else { + log.debug( "poking dependency " + artifact.getFile() + " into classloader " + dependencyClassLoader ); + } loader.addURL( artifact.getFile().toURL() ); } else @@ -417,6 +404,10 @@ // to be verified, or that the project object hasn't been used before project.verifyDependencies(); + ForeheadClassLoader classLoader = new ForeheadClassLoader( Forehead.getInstance().getClassLoader( ROOT_MAVEN_CLASSLOADER ), project.getId() ); + processDependencies( project, classLoader ); + + // Set up the ant project. AntProjectBuilder.build( project, baseContext ); @@ -799,16 +790,15 @@ private Script loadScript(JellyScriptHousing jellyScriptHousing) throws Exception { - // TODO: should differentiate between plugins and script housings // TODO [1.0]: this currently duplicates createJellyScriptHousing for others - it is the lazy version - ForeheadClassLoader pluginClassLoader = (ForeheadClassLoader) jellyScriptHousing.getProject().getContext().getClassLoader(); // We will add the plugin classes to the plugin class loader. if ( jellyScriptHousing.getPluginDirectory() != null ) { // not needed for maven.xml + // TODO: should differentiate between plugins and script housings better + ForeheadClassLoader pluginClassLoader = (ForeheadClassLoader) jellyScriptHousing.getProject().getContext().getClassLoader(); jellyScriptHousing.getProject().verifyDependencies(); - // TODO: does this line belong in here or out? processDependencies(jellyScriptHousing.getProject(), pluginClassLoader); pluginClassLoader.addURL( jellyScriptHousing.getPluginDirectory().toURL() ); }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]