Modified: maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java?rev=773456&r1=773455&r2=773456&view=diff ============================================================================== --- maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java (original) +++ maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java Mon May 11 04:08:29 2009 @@ -21,6 +21,7 @@ import java.util.Arrays; import java.util.List; +import java.util.Map; import java.util.Properties; import org.apache.maven.artifact.repository.ArtifactRepository; @@ -42,6 +43,10 @@ private MavenProject currentProject; + /** + * These projects have already been topologically sorted in the {...@link org.apache.maven.Maven} component before + * being passed into the session. + */ private List<MavenProject> projects; private MavenProject topLevelProject; @@ -91,8 +96,8 @@ { return request.getSettings(); } - - public List<MavenProject> getSortedProjects() + + public List<MavenProject> getProjects() { return projects; }
Modified: maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/execution/ProjectSorter.java URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/execution/ProjectSorter.java?rev=773456&r1=773455&r2=773456&view=diff ============================================================================== --- maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/execution/ProjectSorter.java (original) +++ maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/execution/ProjectSorter.java Mon May 11 04:08:29 2009 @@ -4,6 +4,7 @@ package org.apache.maven.execution; import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; @@ -49,7 +50,7 @@ // In this case, both the verify and the report goals are called // in a different lifecycle. Though the compiler-plugin has a valid usecase, although // that seems to work fine. We need to take versions and lifecycle into account. - public ProjectSorter( List<MavenProject> projects ) + public ProjectSorter( Collection<MavenProject> projects ) throws CycleDetectedException, DuplicateProjectException { dag = new DAG(); Modified: maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java?rev=773456&r1=773455&r2=773456&view=diff ============================================================================== --- maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java (original) +++ maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java Mon May 11 04:08:29 2009 @@ -107,7 +107,7 @@ throw new LifecycleExecutionException( "\n\nYou must specify at least one goal. Try 'mvn install' to build or 'mvn --help' for options \nSee http://maven.apache.org for more information.\n\n" ); } - for ( MavenProject currentProject : session.getSortedProjects() ) + for ( MavenProject currentProject : session.getProjects() ) { logger.info( "Building " + currentProject.getName() ); @@ -508,9 +508,7 @@ return mojoDescriptor; } - - private static int count = 0; - + // org.apache.maven.plugins:maven-remote-resources-plugin:1.0:process MojoDescriptor getMojoDescriptor( String groupId, String artifactId, String version, String goal, MavenProject project, ArtifactRepository localRepository ) throws LifecycleExecutionException @@ -523,10 +521,7 @@ MojoDescriptor mojoDescriptor; //need to do the active project thing as the site plugin is referencing itself - - if ( artifactId.equals( "maven-site-plugin" ) ){ count++; System.out.println( count ); }; - - System.out.println( ">>> " + artifactId ); + try { mojoDescriptor = pluginManager.getMojoDescriptor( plugin, goal, project, localRepository ); Modified: maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java?rev=773456&r1=773455&r2=773456&view=diff ============================================================================== --- maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java (original) +++ maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java Mon May 11 04:08:29 2009 @@ -25,7 +25,6 @@ import java.util.Enumeration; import java.util.HashMap; import java.util.HashSet; -import java.util.Iterator; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; @@ -106,6 +105,9 @@ @Requirement private ResolutionErrorHandler resolutionErrorHandler; + @Requirement + private PluginClassLoaderCache pluginClassLoaderCache; + private Map<String, PluginDescriptor> pluginDescriptors; public DefaultPluginManager() @@ -174,9 +176,6 @@ Artifact pluginArtifact = repositorySystem.createPluginArtifact( plugin ); - //TODO: this is assuming plugins in the reactor. must be replaced with a reactor local repository implementation - pluginArtifact = project.replaceWithActiveArtifact( pluginArtifact ); - ArtifactResolutionRequest request = new ArtifactResolutionRequest( pluginArtifact, localRepository, project.getRemoteArtifactRepositories() ); ArtifactResolutionResult result = repositorySystem.resolve( request ); @@ -199,6 +198,8 @@ } } + //pluginRealm.display(); + try { logger.debug( "Discovering components in realm: " + pluginRealm ); @@ -214,8 +215,10 @@ throw new PluginContainerException( plugin, pluginRealm, "Error scanning plugin realm for components.", e ); } + pluginClassLoaderCache.cachePluginClassLoader( constructPluginKey( plugin ), pluginRealm ); + PluginDescriptor pluginDescriptor = getPluginDescriptor( plugin ); - + // We just need to keep track of the realm, if we need to augment we will wrap the realm pluginDescriptor.setPluginArtifact( pluginArtifact ); pluginDescriptor.setArtifacts( new ArrayList<Artifact>( pluginArtifacts ) ); @@ -266,24 +269,9 @@ ArtifactResolutionResult result = repositorySystem.resolve( request ); resolutionErrorHandler.throwErrors( request, result ); - Set<Artifact> resolved = new LinkedHashSet<Artifact>(); - - //TODO: this is also assuming artifacts in the reactor. - for ( Iterator<Artifact> it = result.getArtifacts().iterator(); it.hasNext(); ) - { - Artifact artifact = it.next(); - - if ( !artifact.equals( pluginArtifact ) ) - { - artifact = project.replaceWithActiveArtifact( artifact ); - } - - resolved.add( artifact ); - } - - logger.debug( "Using the following artifacts for classpath of: " + pluginArtifact.getId() + ":\n\n" + resolved.toString().replace( ',', '\n' ) ); + logger.debug( "Using the following artifacts for classpath of: " + pluginArtifact.getId() + ":\n\n" + result.getArtifacts().toString().replace( ',', '\n' ) ); - return resolved; + return result.getArtifacts(); } // ---------------------------------------------------------------------- @@ -356,7 +344,8 @@ { mojo = getConfiguredMojo( session, mojoExecution, project, false, mojoExecution ); - pluginRealm = pluginDescriptor.getClassRealm(); + //pluginRealm = pluginDescriptor.getClassRealm(); + pluginRealm = pluginClassLoaderCache.getPluginClassLoader( constructPluginKey( mojoDescriptor.getPluginDescriptor() ) ); Thread.currentThread().setContextClassLoader( pluginRealm ); Modified: maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java?rev=773456&r1=773455&r2=773456&view=diff ============================================================================== --- maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java (original) +++ maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java Mon May 11 04:08:29 2009 @@ -151,7 +151,7 @@ } else if ( "reactorProjects".equals( expression ) ) { - value = session.getSortedProjects(); + value = session.getProjects(); } else if ("mojoExecution".equals(expression)) { @@ -246,7 +246,7 @@ throw new ExpressionEvaluationException( "Error evaluating plugin parameter expression: " + expression, e ); } - } + } else if ( "settings".equals( expression ) ) { value = session.getSettings(); Modified: maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java?rev=773456&r1=773455&r2=773456&view=diff ============================================================================== --- maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java (original) +++ maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java Mon May 11 04:08:29 2009 @@ -20,7 +20,9 @@ import java.io.Reader; import java.util.ArrayList; import java.util.Collection; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Properties; import org.apache.maven.artifact.Artifact; @@ -89,8 +91,8 @@ @Requirement private ResolutionErrorHandler resolutionErrorHandler; - - //private static HashMap<String, MavenProject> hm = new HashMap<String, MavenProject>(); + + private Map<File, MavenProject> projectCache = new HashMap<File, MavenProject>(); private MavenProject superProject; @@ -101,6 +103,13 @@ public MavenProject build( File pomFile, ProjectBuilderConfiguration configuration ) throws ProjectBuildingException { + MavenProject project = projectCache.get( pomFile ); + + if ( project != null ) + { + return project; + } + DomainModel domainModel; try @@ -124,7 +133,7 @@ } catch ( ProfileActivationException e ) { - throw new ProjectBuildingException( "", "Failed to activate pom profiles." ); + throw new ProjectBuildingException( "", "Failed to activate pom profiles.", e ); } try @@ -143,56 +152,60 @@ } catch ( IOException e ) { - throw new ProjectBuildingException( "", "" ); + throw new ProjectBuildingException( "", "", e ); } - - //Interpolation & Management - MavenProject project; + try { Model model = interpolateDomainModel( domainModel, configuration, pomFile ); - lifecycleBindingsInjector.injectLifecycleBindings( model ); + if ( configuration.isProcessPlugins() ) + { + lifecycleBindingsInjector.injectLifecycleBindings( model ); + } ProcessorContext.processManagementNodes( model ); project = this.fromDomainModelToMavenProject( model, domainModel.getParentFile(), configuration, pomFile ); - Collection<Plugin> pluginsFromProject = project.getModel().getBuild().getPlugins(); + if ( configuration.isProcessPlugins() ) + { + Collection<Plugin> pluginsFromProject = project.getModel().getBuild().getPlugins(); + + // Merge the various sources for mojo configuration: + // 1. default values from mojo descriptor + // 2. POM values from per-plugin configuration + // 3. POM values from per-execution configuration + // These configuration sources are given in increasing order of dominance. - // Merge the various sources for mojo configuration: - // 1. default values from mojo descriptor - // 2. POM values from per-plugin configuration - // 3. POM values from per-execution configuration - // These configuration sources are given in increasing order of dominance. - - // push plugin configuration down to executions - for ( Plugin buildPlugin : pluginsFromProject ) - { - Xpp3Dom dom = (Xpp3Dom) buildPlugin.getConfiguration(); - - if ( dom != null ) + // push plugin configuration down to executions + for ( Plugin buildPlugin : pluginsFromProject ) { - for ( PluginExecution e : buildPlugin.getExecutions() ) + Xpp3Dom dom = (Xpp3Dom) buildPlugin.getConfiguration(); + + if ( dom != null ) { - Xpp3Dom dom1 = Xpp3Dom.mergeXpp3Dom( (Xpp3Dom) e.getConfiguration(), new Xpp3Dom( dom ) ); - e.setConfiguration( dom1 ); + for ( PluginExecution e : buildPlugin.getExecutions() ) + { + Xpp3Dom dom1 = Xpp3Dom.mergeXpp3Dom( (Xpp3Dom) e.getConfiguration(), new Xpp3Dom( dom ) ); + e.setConfiguration( dom1 ); + } } } - } - // merge in default values from mojo descriptor - lifecycle.populateDefaultConfigurationForPlugins( pluginsFromProject, project, configuration.getLocalRepository() ); + // merge in default values from mojo descriptor + lifecycle.populateDefaultConfigurationForPlugins( pluginsFromProject, project, configuration.getLocalRepository() ); - project.getModel().getBuild().setPlugins( new ArrayList<Plugin>( pluginsFromProject ) ); + project.getModel().getBuild().setPlugins( new ArrayList<Plugin>( pluginsFromProject ) ); + } } catch ( IOException e ) { - throw new ProjectBuildingException( "", "" ); + throw new ProjectBuildingException( "", "", e ); } catch ( LifecycleExecutionException e ) { - throw new ProjectBuildingException( "", e.getMessage() ); + throw new ProjectBuildingException( "", e.getMessage(), e ); } //project.setActiveProfiles( projectProfiles ); @@ -208,6 +221,8 @@ setBuildOutputDirectoryOnParent( project ); + projectCache.put( pomFile, project ); + return project; } Modified: maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilderConfiguration.java URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilderConfiguration.java?rev=773456&r1=773455&r2=773456&view=diff ============================================================================== --- maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilderConfiguration.java (original) +++ maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilderConfiguration.java Mon May 11 04:08:29 2009 @@ -43,6 +43,8 @@ private MavenProject topProject; + private boolean processPlugins = false; + public DefaultProjectBuilderConfiguration() { } @@ -117,4 +119,15 @@ this.listeners = listeners; return this; } + + public boolean isProcessPlugins() + { + return processPlugins; + } + + public ProjectBuilderConfiguration setProcessPlugins( boolean processPlugins ) + { + this.processPlugins = processPlugins; + return this; + } } Modified: maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/MavenProject.java URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/MavenProject.java?rev=773456&r1=773455&r2=773456&view=diff ============================================================================== --- maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/MavenProject.java (original) +++ maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/MavenProject.java Mon May 11 04:08:29 2009 @@ -66,8 +66,6 @@ import org.apache.maven.model.Scm; import org.apache.maven.model.io.xpp3.MavenXpp3Reader; import org.apache.maven.model.io.xpp3.MavenXpp3Writer; -import org.apache.maven.project.artifact.ActiveProjectArtifact; -import org.apache.maven.repository.MavenRepositoryWrapper; import org.apache.maven.repository.RepositorySystem; import org.codehaus.plexus.util.StringUtils; import org.codehaus.plexus.util.xml.Xpp3Dom; @@ -87,7 +85,7 @@ * </ol> */ public class MavenProject - implements Cloneable, MavenRepositoryWrapper + implements Cloneable { public static final String EMPTY_PROJECT_GROUP_ID = "unknown"; @@ -109,8 +107,6 @@ private List<ArtifactRepository> remoteArtifactRepositories; - private List<MavenProject> collectedProjects = Collections.emptyList(); - private List<Artifact> attachedArtifacts; private MavenProject executionProject; @@ -121,8 +117,6 @@ private List<String> scriptSourceRoots = new ArrayList<String>(); - private List<ArtifactRepository> pluginArtifactRepositories; - private ArtifactRepository releaseArtifactRepository; private ArtifactRepository snapshotArtifactRepository; @@ -508,14 +502,12 @@ for ( Artifact a : getArtifacts() ) { - System.out.println( "++> " + a.getArtifactId() ); if ( a.getArtifactHandler().isAddedToClasspath() ) { // TODO: let the scope handler deal with this if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_PROVIDED.equals( a.getScope() ) || Artifact.SCOPE_SYSTEM.equals( a.getScope() ) ) { addArtifactPath( a, list ); - System.out.println( "--> " + a.getArtifactId() ); } } } @@ -1323,19 +1315,8 @@ return build; } - public List<MavenProject> getCollectedProjects() - { - return collectedProjects; - } - - public void setCollectedProjects( List<MavenProject> collectedProjects ) - { - this.collectedProjects = collectedProjects; - } - public void setPluginArtifactRepositories( List<ArtifactRepository> pluginArtifactRepositories ) { - this.pluginArtifactRepositories = pluginArtifactRepositories; } /** @@ -1672,157 +1653,7 @@ { return getBuild() != null ? getBuild().getDefaultGoal() : null; } - - public Artifact find( Artifact artifact ) - { - return replaceWithActiveArtifact( artifact ); - } - - public Artifact replaceWithActiveArtifact( Artifact pluginArtifact ) - { - if ( ( getProjectReferences() != null ) && !getProjectReferences().isEmpty() ) - { - String refId = getProjectReferenceId( pluginArtifact.getGroupId(), pluginArtifact.getArtifactId(), pluginArtifact.getVersion() ); - MavenProject ref = getProjectReferences().get( refId ); - if ( ref != null ) - { - if ( ref.getArtifact() != null - && ref.getArtifact().getDependencyConflictId().equals( pluginArtifact.getDependencyConflictId() ) ) - { - // if the project artifact doesn't exist, don't use it. We haven't built that far. - if ( ref.getArtifact().getFile() != null && ref.getArtifact().getFile().exists() ) - { - // FIXME: Why aren't we using project.getArtifact() for the second parameter here?? - Artifact resultArtifact = new ActiveProjectArtifact( ref, pluginArtifact ); - return resultArtifact; - } - else - { - logMissingSiblingProjectArtifact( pluginArtifact ); - } - } - - Artifact attached = findMatchingArtifact( ref.getAttachedArtifacts(), pluginArtifact ); - if ( attached != null ) - { - if ( attached.getFile() != null && attached.getFile().exists() ) - { - Artifact resultArtifact = ArtifactUtils.copyArtifact( attached ); - resultArtifact.setScope( pluginArtifact.getScope() ); - return resultArtifact; - } - else - { - logMissingSiblingProjectArtifact( pluginArtifact ); - } - } - - /** - * Patch/workaround for: MNG-2871 - * - * We want to use orginal artifact (packaging:ejb) when we are resolving ejb-client - * package and we didn't manage to find attached to project one. - * - * The scenario is such that somebody run "mvn test" in composity project, and - * ejb-client.jar will not be attached to ejb.jar (because it is done in package - * phase) - * - * We prefer in such a case use orginal sources (of ejb.jar) instead of failure - */ - if ( ( ref.getArtifactId().equals( pluginArtifact.getArtifactId() ) ) && ( ref.getGroupId().equals( pluginArtifact.getGroupId() ) ) && ( ref.getArtifact().getType().equals( "ejb" ) ) - && ( pluginArtifact.getType().equals( "ejb-client" ) ) && ( ( ref.getArtifact().getFile() != null ) && ref.getArtifact().getFile().exists() ) ) - { - pluginArtifact = new ActiveProjectArtifact( ref, pluginArtifact ); - return pluginArtifact; - } - } - } - return pluginArtifact; - } - - /** - * Tries to resolve the specified artifact from the given collection of attached project artifacts. - * - * @param artifacts The attached artifacts, may be <code>null</code>. - * @param requestedArtifact The artifact to resolve, must not be <code>null</code>. - * @return The matching artifact or <code>null</code> if not found. - */ - private Artifact findMatchingArtifact( List<Artifact> artifacts, Artifact requestedArtifact ) - { - if ( artifacts != null && !artifacts.isEmpty() ) - { - // first try matching by dependency conflict id - String requestedId = requestedArtifact.getDependencyConflictId(); - for ( Artifact artifact : artifacts ) - { - if ( requestedId.equals( artifact.getDependencyConflictId() ) ) - { - return artifact; - } - } - - // next try matching by repository conflict id - requestedId = getRepositoryConflictId( requestedArtifact ); - for ( Artifact artifact : artifacts ) - { - if ( requestedId.equals( getRepositoryConflictId( artifact ) ) ) - { - return artifact; - } - } - } - - return null; - } - - /** - * Gets the repository conflict id of the specified artifact. Unlike the dependency conflict id, the repository - * conflict id uses the artifact file extension instead of the artifact type. Hence, the repository conflict id more - * closely reflects the identity of artifacts as perceived by a repository. - * - * @param artifact The artifact, must not be <code>null</code>. - * @return The repository conflict id, never <code>null</code>. - */ - private String getRepositoryConflictId( Artifact artifact ) - { - StringBuffer buffer = new StringBuffer( 128 ); - buffer.append( artifact.getGroupId() ); - buffer.append( ':' ).append( artifact.getArtifactId() ); - if ( artifact.getArtifactHandler() != null ) - { - buffer.append( ':' ).append( artifact.getArtifactHandler().getExtension() ); - } - else - { - buffer.append( ':' ).append( artifact.getType() ); - } - if ( artifact.hasClassifier() ) - { - buffer.append( ':' ).append( artifact.getClassifier() ); - } - return buffer.toString(); - } - - private void logMissingSiblingProjectArtifact( Artifact artifact ) - { - /* TODO - if ( logger == null ) - { - return; - } - - StringBuffer message = new StringBuffer(); - message.append( "A dependency of the current project (or of one the plugins used in its build) was found in the reactor, " ); - message.append( "\nbut had not been built at the time it was requested. It will be resolved from the repository instead." ); - message.append( "\n\nCurrent Project: " ).append( getName() ); - message.append( "\nRequested Dependency: " ).append( artifact.getId() ); - message.append( "\n\nNOTE: You may need to run this build to the 'compile' lifecycle phase, or farther, in order to build the dependency artifact." ); - message.append( "\n" ); - - logger.warn( message.toString() ); - */ - } - + public void clearExecutionProject() { if ( !previousExecutionProjects.isEmpty() ) @@ -1990,11 +1821,6 @@ setPluginArtifactRepositories( ( Collections.unmodifiableList( project.getPluginArtifactRepositories() ) ) ); } - if ( project.getCollectedProjects() != null ) - { - setCollectedProjects( ( Collections.unmodifiableList( project.getCollectedProjects() ) ) ); - } - if ( project.getActiveProfiles() != null ) { setActiveProfiles( ( Collections.unmodifiableList( project.getActiveProfiles() ) ) ); Modified: maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/ProjectBuilderConfiguration.java URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/ProjectBuilderConfiguration.java?rev=773456&r1=773455&r2=773456&view=diff ============================================================================== --- maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/ProjectBuilderConfiguration.java (original) +++ maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/ProjectBuilderConfiguration.java Mon May 11 04:08:29 2009 @@ -8,24 +8,28 @@ public interface ProjectBuilderConfiguration { - ArtifactRepository getLocalRepository(); + ProjectBuilderConfiguration setLocalRepository( ArtifactRepository localRepository ); - List<ArtifactRepository> getRemoteRepositories(); + ArtifactRepository getLocalRepository(); - ProfileManager getGlobalProfileManager(); + ProjectBuilderConfiguration setRemoteRepositories( List<ArtifactRepository> remoteRepositories ); - Properties getExecutionProperties(); + List<ArtifactRepository> getRemoteRepositories(); ProjectBuilderConfiguration setGlobalProfileManager( ProfileManager globalProfileManager ); - ProjectBuilderConfiguration setLocalRepository( ArtifactRepository localRepository ); - - ProjectBuilderConfiguration setRemoteRepositories( List<ArtifactRepository> remoteRepositories ); + ProfileManager getGlobalProfileManager(); ProjectBuilderConfiguration setExecutionProperties( Properties executionProperties ); - + + Properties getExecutionProperties(); + + void setTopLevelProjectForReactor(MavenProject mavenProject); + MavenProject getTopLevelProjectFromReactor(); + + ProjectBuilderConfiguration setProcessPlugins( boolean processPlugins ); - void setTopLevelProjectForReactor(MavenProject mavenProject); + boolean isProcessPlugins(); } Modified: maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingException.java URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingException.java?rev=773456&r1=773455&r2=773456&view=diff ============================================================================== --- maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingException.java (original) +++ maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingException.java Mon May 11 04:08:29 2009 @@ -41,9 +41,9 @@ private File pomFile; - public ProjectBuildingException( String projectId, String message ) + public ProjectBuildingException( String projectId, String message, Throwable cause ) { - super( message ); + super( message, cause ); this.projectId = projectId; } Modified: maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java?rev=773456&r1=773455&r2=773456&view=diff ============================================================================== --- maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java (original) +++ maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java Mon May 11 04:08:29 2009 @@ -79,6 +79,8 @@ ProjectBuilderConfiguration configuration = new DefaultProjectBuilderConfiguration(); configuration.setLocalRepository( localRepository ); configuration.setRemoteRepositories( remoteRepositories ); + // We don't care about processing plugins here, all we're interested in is the dependencies. + configuration.setProcessPlugins( false ); MavenProject project; @@ -96,9 +98,7 @@ if ( effectiveScope != null ) { - Artifact dependencyArtifact = - repositorySystem.createArtifact( d.getGroupId(), d.getArtifactId(), d.getVersion(), - effectiveScope, d.getType() ); + Artifact dependencyArtifact = repositorySystem.createArtifact( d.getGroupId(), d.getArtifactId(), d.getVersion(), effectiveScope, d.getType() ); artifacts.add( dependencyArtifact ); } @@ -193,10 +193,13 @@ private List<ArtifactVersion> retrieveAvailableVersionsFromMetadata( Metadata repoMetadata ) { List<ArtifactVersion> versions; + if ( ( repoMetadata != null ) && ( repoMetadata.getVersioning() != null ) ) { List<String> metadataVersions = repoMetadata.getVersioning().getVersions(); + versions = new ArrayList<ArtifactVersion>( metadataVersions.size() ); + for ( String version : metadataVersions ) { versions.add( new DefaultArtifactVersion( version ) ); Modified: maven/components/branches/MNG-2766/maven-embedder/src/main/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulator.java URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-embedder/src/main/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulator.java?rev=773456&r1=773455&r2=773456&view=diff ============================================================================== --- maven/components/branches/MNG-2766/maven-embedder/src/main/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulator.java (original) +++ maven/components/branches/MNG-2766/maven-embedder/src/main/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulator.java Mon May 11 04:08:29 2009 @@ -16,7 +16,6 @@ */ import java.io.File; -import java.io.IOException; import java.util.HashSet; import java.util.Iterator; import java.util.List; @@ -37,18 +36,13 @@ import org.apache.maven.repository.RepositorySystem; import org.apache.maven.settings.MavenSettingsBuilder; import org.apache.maven.settings.Mirror; -import org.apache.maven.settings.Proxy; -import org.apache.maven.settings.Server; import org.apache.maven.settings.Settings; import org.apache.maven.settings.SettingsUtils; import org.apache.maven.toolchain.ToolchainsBuilder; -import org.codehaus.plexus.PlexusContainer; import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.component.annotations.Requirement; import org.codehaus.plexus.logging.AbstractLogEnabled; import org.codehaus.plexus.util.StringUtils; -import org.sonatype.plexus.components.sec.dispatcher.SecDispatcher; -import org.sonatype.plexus.components.sec.dispatcher.SecDispatcherException; /** * Things that we deal with in this populator to ensure that we have a valid @@ -63,9 +57,7 @@ extends AbstractLogEnabled implements MavenExecutionRequestPopulator { - @Requirement - private PlexusContainer container; - + //TODO: this needs to be pushed up to the front-end @Requirement private MavenSettingsBuilder settingsBuilder; @@ -75,10 +67,6 @@ @Requirement private ToolchainsBuilder toolchainsBuilder; - // 2009-03-05 Oleg: this component is defined sub-classed in this package - @Requirement(hint = "maven") - private SecDispatcher securityDispatcher; - public MavenExecutionRequest populateDefaults( MavenExecutionRequest request, Configuration configuration ) throws MavenEmbedderException { @@ -226,6 +214,7 @@ { Settings settings = request.getSettings(); + /* Proxy proxy = settings.getActiveProxy(); if ( proxy != null ) @@ -257,6 +246,7 @@ repositorySystem.addPermissionInfo( server.getId(), server.getFilePermissions(), server.getDirectoryPermissions() ); } + */ for ( Mirror mirror : settings.getMirrors() ) { @@ -367,9 +357,9 @@ try { - return repositorySystem.createLocalRepository( localRepositoryPath, RepositorySystem.DEFAULT_LOCAL_REPO_ID ); + return repositorySystem.createLocalRepository( new File( localRepositoryPath ) ); } - catch ( IOException e ) + catch ( InvalidRepositoryException e ) { throw new MavenEmbedderException( "Cannot create local repository.", e ); } Modified: maven/components/branches/MNG-2766/maven-repository/src/main/java/org/apache/maven/repository/LegacyRepositorySystem.java URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-repository/src/main/java/org/apache/maven/repository/LegacyRepositorySystem.java?rev=773456&r1=773455&r2=773456&view=diff ============================================================================== --- maven/components/branches/MNG-2766/maven-repository/src/main/java/org/apache/maven/repository/LegacyRepositorySystem.java (original) +++ maven/components/branches/MNG-2766/maven-repository/src/main/java/org/apache/maven/repository/LegacyRepositorySystem.java Mon May 11 04:08:29 2009 @@ -18,33 +18,23 @@ import java.io.File; import java.io.IOException; import java.net.MalformedURLException; -import java.util.ArrayList; import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedHashSet; import java.util.List; import java.util.Map; -import java.util.Set; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.InvalidRepositoryException; import org.apache.maven.artifact.factory.ArtifactFactory; -import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.ArtifactRepositoryFactory; import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy; import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; -import org.apache.maven.artifact.resolver.ArtifactCollector; import org.apache.maven.artifact.resolver.ArtifactResolutionRequest; import org.apache.maven.artifact.resolver.ArtifactResolutionResult; import org.apache.maven.artifact.resolver.ArtifactResolver; -import org.apache.maven.artifact.resolver.filter.AndArtifactFilter; -import org.apache.maven.artifact.resolver.filter.ArtifactFilter; -import org.apache.maven.artifact.resolver.filter.ExcludesArtifactFilter; import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; import org.apache.maven.artifact.versioning.VersionRange; import org.apache.maven.model.Dependency; -import org.apache.maven.model.Exclusion; import org.apache.maven.model.Plugin; import org.apache.maven.model.Repository; import org.apache.maven.model.RepositoryPolicy; @@ -53,7 +43,6 @@ import org.apache.maven.wagon.repository.RepositoryPermissions; import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.component.annotations.Requirement; -import org.codehaus.plexus.util.StringUtils; /** * @author Jason van Zyl @@ -63,9 +52,6 @@ implements RepositorySystem { @Requirement - private WagonManager wagonManager; - - @Requirement private ArtifactFactory artifactFactory; @Requirement @@ -78,9 +64,6 @@ private ArtifactRepositoryLayout defaultArtifactRepositoryLayout; @Requirement - private ArtifactCollector artifactCollector; - - @Requirement private MirrorBuilder mirrorBuilder; private Map<String, ProxyInfo> proxies = new HashMap<String, ProxyInfo>(); @@ -281,14 +264,11 @@ String releaseUpdates, boolean snapshots, String snapshotUpdates, String checksumPolicy ) { - ArtifactRepositoryPolicy snapshotsPolicy = - new ArtifactRepositoryPolicy( snapshots, snapshotUpdates, checksumPolicy ); + ArtifactRepositoryPolicy snapshotsPolicy = new ArtifactRepositoryPolicy( snapshots, snapshotUpdates, checksumPolicy ); - ArtifactRepositoryPolicy releasesPolicy = - new ArtifactRepositoryPolicy( releases, releaseUpdates, checksumPolicy ); + ArtifactRepositoryPolicy releasesPolicy = new ArtifactRepositoryPolicy( releases, releaseUpdates, checksumPolicy ); - return artifactRepositoryFactory.createArtifactRepository( repositoryId, url, defaultArtifactRepositoryLayout, - snapshotsPolicy, releasesPolicy ); + return artifactRepositoryFactory.createArtifactRepository( repositoryId, url, defaultArtifactRepositoryLayout, snapshotsPolicy, releasesPolicy ); } public ArtifactResolutionResult resolve( ArtifactResolutionRequest request ) @@ -296,16 +276,7 @@ return artifactResolver.resolve( request ); } - public void setOnline( boolean online ) - { - artifactResolver.setOnline( online ); - } - - public boolean isOnline() - { - return artifactResolver.isOnline(); - } - + /* public void addProxy( String protocol, String host, int port, String username, String password, String nonProxyHosts ) { ProxyInfo proxyInfo = new ProxyInfo(); @@ -320,7 +291,9 @@ wagonManager.addProxy( protocol, host, port, username, password, nonProxyHosts ); } + */ + /* public void addAuthenticationInfo( String repositoryId, String username, String password, String privateKey, String passphrase ) { AuthenticationInfo authInfo = new AuthenticationInfo(); @@ -333,7 +306,9 @@ wagonManager.addAuthenticationInfo( repositoryId, username, password, privateKey, passphrase ); } + */ + /* public void addPermissionInfo( String repositoryId, String filePermissions, String directoryPermissions ) { RepositoryPermissions permissions = new RepositoryPermissions(); @@ -357,6 +332,7 @@ serverPermissionsMap.put( repositoryId, permissions ); } } + */ // Mirror Modified: maven/components/branches/MNG-2766/maven-repository/src/main/java/org/apache/maven/repository/RepositorySystem.java URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-repository/src/main/java/org/apache/maven/repository/RepositorySystem.java?rev=773456&r1=773455&r2=773456&view=diff ============================================================================== --- maven/components/branches/MNG-2766/maven-repository/src/main/java/org/apache/maven/repository/RepositorySystem.java (original) +++ maven/components/branches/MNG-2766/maven-repository/src/main/java/org/apache/maven/repository/RepositorySystem.java Mon May 11 04:08:29 2009 @@ -34,7 +34,6 @@ */ public interface RepositorySystem { - // Default local repository static final String DEFAULT_LOCAL_REPO_ID = "local"; static final String userHome = System.getProperty( "user.home" ); @@ -43,7 +42,6 @@ static final File defaultUserLocalRepository = new File( userMavenConfigurationHome, "repository" ); - // Default remote repository static final String DEFAULT_REMOTE_REPO_ID = "central"; static final String DEFAULT_REMOTE_REPO_URL = "http://repo1.maven.org/maven2"; @@ -55,18 +53,10 @@ Artifact createPluginArtifact( Plugin plugin ); Artifact createDependencyArtifact( Dependency dependency ); - - //TODO: this needs a project to do anything useful - //Set<Artifact> createArtifacts(); - - // maven model + ArtifactRepository buildArtifactRepository( Repository repository ) throws InvalidRepositoryException; - //!!jvz Change this to use a file - ArtifactRepository createLocalRepository( String url, String repositoryId ) - throws IOException; - ArtifactRepository createDefaultRemoteRepository() throws InvalidRepositoryException; @@ -76,9 +66,6 @@ ArtifactRepository createLocalRepository( File localRepository ) throws InvalidRepositoryException; - //correct all uses to let the resolver find the deps of the root and - //pass in overrides where necessary - ArtifactResolutionResult resolve( ArtifactResolutionRequest request ); /** @@ -92,15 +79,8 @@ */ MetadataResolutionResult resolveMetadata( MetadataResolutionRequest request ); - //REMOVE - // These should be associated with repositories and the repositories should be examine as part of metadatda and - // artifact resolution. So these methods should also not be here. - void addProxy( String protocol, String host, int port, String username, String password, String nonProxyHosts ); - void addAuthenticationInfo( String repositoryId, String username, String password, String privateKey, String passphrase ); - void addPermissionInfo( String repositoryId, String filePermissions, String directoryPermissions ); - - // Mirrors - + //TODO: remove the request should already be processed to select the mirror for the request instead of the processing happen internally. + // Mirrors void addMirror( String id, String mirrorOf, String url ); List<ArtifactRepository> getMirrors( List<ArtifactRepository> repositories ); } Modified: maven/components/branches/MNG-2766/pom.xml URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/pom.xml?rev=773456&r1=773455&r2=773456&view=diff ============================================================================== --- maven/components/branches/MNG-2766/pom.xml (original) +++ maven/components/branches/MNG-2766/pom.xml Mon May 11 04:08:29 2009 @@ -22,16 +22,13 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <!-- <parent> <groupId>org.apache.maven</groupId> <artifactId>maven-parent</artifactId> <version>11</version> <relativePath>../pom/maven/pom.xml</relativePath> </parent> - --> - <groupId>org.apache.maven</groupId> <artifactId>maven</artifactId> <version>3.0-SNAPSHOT</version> <packaging>pom</packaging>