Author: jdcasey Date: Tue Aug 23 21:45:04 2011 New Revision: 1160893 URL: http://svn.apache.org/viewvc?rev=1160893&view=rev Log: initialize remote repositories before attempting to load projects
Modified: maven/sandbox/trunk/mae/mae-booter/src/main/java/org/apache/maven/mae/app/AbstractMAEApplication.java maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/main/java/org/apache/maven/mae/project/DefaultProjectLoader.java maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/main/java/org/apache/maven/mae/project/session/DefaultSessionInjector.java Modified: maven/sandbox/trunk/mae/mae-booter/src/main/java/org/apache/maven/mae/app/AbstractMAEApplication.java URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/mae/mae-booter/src/main/java/org/apache/maven/mae/app/AbstractMAEApplication.java?rev=1160893&r1=1160892&r2=1160893&view=diff ============================================================================== --- maven/sandbox/trunk/mae/mae-booter/src/main/java/org/apache/maven/mae/app/AbstractMAEApplication.java (original) +++ maven/sandbox/trunk/mae/mae-booter/src/main/java/org/apache/maven/mae/app/AbstractMAEApplication.java Tue Aug 23 21:45:04 2011 @@ -19,6 +19,11 @@ package org.apache.maven.mae.app; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Set; + import org.apache.log4j.Logger; import org.apache.maven.mae.MAEException; import org.apache.maven.mae.boot.embed.MAEEmbedder; @@ -35,16 +40,10 @@ import org.apache.maven.mae.internal.con import org.apache.maven.mae.internal.container.VirtualInstance; import org.codehaus.plexus.component.repository.exception.ComponentLookupException; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Set; - /** - * {@link MAEApplication} implementation that provides support for loading a full Maven component - * environment, complete with {@link MAELibrary}'s, {@link ComponentSelector} and {@link InstanceRegistry}. - * This class supervises the assembly of the environment, giving the application developer an easy - * way to inject the behavior he needs. + * {@link MAEApplication} implementation that provides support for loading a full Maven component environment, complete + * with {@link MAELibrary}'s, {@link ComponentSelector} and {@link InstanceRegistry}. This class supervises the assembly + * of the environment, giving the application developer an easy way to inject the behavior he needs. * * @author John Casey */ @@ -66,9 +65,8 @@ public abstract class AbstractMAEApplica } /** - * Programmatically add a new {@link MAELibrary} instance, beyond those that are automatically - * detected via the /META-INF/services/org.apache.maven.mae.conf.MAELibrary files on the - * classpath. + * Programmatically add a new {@link MAELibrary} instance, beyond those that are automatically detected via the + * /META-INF/services/org.apache.maven.mae.conf.MAELibrary files on the classpath. */ protected final AbstractMAEApplication withLibrary( final MAELibrary library ) { @@ -78,6 +76,7 @@ public abstract class AbstractMAEApplica /** * {@inheritDoc} + * * @see org.apache.maven.mae.app.MAEApplication#load() */ @Override @@ -88,21 +87,19 @@ public abstract class AbstractMAEApplica } /** - * Carry out the application loading process. This means: - * <br/> + * Carry out the application loading process. This means: <br/> * <ul> - * <li>Create a new {@link MAEEmbedderBuilder}</li> - * <li>Add to that an {@link InstanceLibraryLoader} to handle libraries that were - * programmatically added here</li> - * <li>Call {@link AbstractMAEApplication#beforeLoading()}</li> - * <li>Call {@link AbstractMAEApplication#configureBuilder(MAEEmbedderBuilder)} to allow - * fine-tuning of the {@link MAEEmbedderBuilder} instance</li> - * <li>Call {@link MAEEmbedderBuilder#build} to create an instance of {@link MAEEmbedder}</li> - * <li>For each instance in the {@link InstanceRegistry}, lookup via {@link MAEEmbedder#container()} - * to ensure injectable component dependencies are filled</li> - * <li>Call {@link AbstractMAEApplication#afterLoading()}</li> - * <li>Set the loaded flag, which will prevent this process from repeating for an application - * that has already been loaded</li> + * <li>Create a new {@link MAEEmbedderBuilder}</li> + * <li>Add to that an {@link InstanceLibraryLoader} to handle libraries that were programmatically added here</li> + * <li>Call {@link AbstractMAEApplication#beforeLoading()}</li> + * <li>Call {@link AbstractMAEApplication#configureBuilder(MAEEmbedderBuilder)} to allow fine-tuning of the + * {@link MAEEmbedderBuilder} instance</li> + * <li>Call {@link MAEEmbedderBuilder#build} to create an instance of {@link MAEEmbedder}</li> + * <li>For each instance in the {@link InstanceRegistry}, lookup via {@link MAEEmbedder#container()} to ensure + * injectable component dependencies are filled</li> + * <li>Call {@link AbstractMAEApplication#afterLoading()}</li> + * <li>Set the loaded flag, which will prevent this process from repeating for an application that has already been + * loaded</li> * </ul> */ private synchronized final MAEApplication doLoad() @@ -113,7 +110,8 @@ public abstract class AbstractMAEApplica return this; } - final MAEEmbedderBuilder builder = new MAEEmbedderBuilder().withLibraryLoader( new InstanceLibraryLoader( additionalLibraries ) ); + final MAEEmbedderBuilder builder = + new MAEEmbedderBuilder().withLibraryLoader( new InstanceLibraryLoader( additionalLibraries ) ); configureBuilder( builder ); @@ -139,8 +137,8 @@ public abstract class AbstractMAEApplica } /** - * Register a new, external component instance for injection into other components, or to - * have components injected into it. + * Register a new, external component instance for injection into other components, or to have components injected + * into it. */ @SuppressWarnings( { "unchecked", "rawtypes" } ) protected final void withComponentInstance( final Object instance ) @@ -149,9 +147,9 @@ public abstract class AbstractMAEApplica } /** - * Register a new {@link VirtualInstance}, which allows the component environment to bind its - * requirements without actually having access to the component instance. The instance itself - * will be injected into the {@link VirtualInstance} later. + * Register a new {@link VirtualInstance}, which allows the component environment to bind its requirements without + * actually having access to the component instance. The instance itself will be injected into the + * {@link VirtualInstance} later. */ protected final <C> void withVirtualComponent( final Class<C> virtualClass ) { @@ -167,8 +165,8 @@ public abstract class AbstractMAEApplica } /** - * Register a new, external component instance to make it available for injection, or to allow - * other components to be injected into it. + * Register a new, external component instance to make it available for injection, or to allow other components to + * be injected into it. */ protected final <C> void withComponentInstance( final ComponentKey<C> componentKey, final C instance ) { @@ -176,9 +174,9 @@ public abstract class AbstractMAEApplica } /** - * Register a new {@link VirtualInstance}, which allows the component environment to bind its - * requirements without actually having access to the component instance. The instance itself - * will be injected into the {@link VirtualInstance} later. + * Register a new {@link VirtualInstance}, which allows the component environment to bind its requirements without + * actually having access to the component instance. The instance itself will be injected into the + * {@link VirtualInstance} later. */ protected final <C> void withVirtualComponent( final ComponentKey<C> virtualKey ) { @@ -194,8 +192,8 @@ public abstract class AbstractMAEApplica } /** - * Fine-tune the {@link MAEEmbedderBuilder} instance before it is used to create the - * {@link MAEEmbedder} that will be used to load the application components. + * Fine-tune the {@link MAEEmbedderBuilder} instance before it is used to create the {@link MAEEmbedder} that will + * be used to load the application components. */ protected void configureBuilder( final MAEEmbedderBuilder builder ) throws MAEException @@ -203,10 +201,10 @@ public abstract class AbstractMAEApplica } /** - * Hook allowing application developers access to the {@link MAEEmbedder} just after the registered - * external component instances have been injected, but before loading is considered complete. + * Hook allowing application developers access to the {@link MAEEmbedder} just after the registered external + * component instances have been injected, but before loading is considered complete. */ - protected void afterLoading(MAEEmbedder embedder) + protected void afterLoading( final MAEEmbedder embedder ) throws MAEException { } @@ -278,7 +276,7 @@ public abstract class AbstractMAEApplica if ( provider == null ) { throw new IllegalStateException( "Your application booter: " + getClass().getName() - + " must implement either getVersion() or getVersionProvider()." ); + + " must implement either getVersion() or getVersionProvider()." ); } return provider.getVersion(); Modified: maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/main/java/org/apache/maven/mae/project/DefaultProjectLoader.java URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/main/java/org/apache/maven/mae/project/DefaultProjectLoader.java?rev=1160893&r1=1160892&r2=1160893&view=diff ============================================================================== --- maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/main/java/org/apache/maven/mae/project/DefaultProjectLoader.java (original) +++ maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/main/java/org/apache/maven/mae/project/DefaultProjectLoader.java Tue Aug 23 21:45:04 2011 @@ -85,6 +85,7 @@ public class DefaultProjectLoader final File... rootPoms ) throws ProjectToolsException { + sessionInjector.getRemoteRepositories( session ); final ProjectBuildingRequest pbr = sessionInjector.getProjectBuildingRequest( session ); try @@ -217,6 +218,7 @@ public class DefaultProjectLoader public MavenProject buildProjectInstance( final File pomFile, final ProjectToolsSession session ) throws ProjectToolsException { + sessionInjector.getRemoteRepositories( session ); final ProjectBuildingRequest pbr = sessionInjector.getProjectBuildingRequest( session ); try Modified: maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/main/java/org/apache/maven/mae/project/session/DefaultSessionInjector.java URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/main/java/org/apache/maven/mae/project/session/DefaultSessionInjector.java?rev=1160893&r1=1160892&r2=1160893&view=diff ============================================================================== --- maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/main/java/org/apache/maven/mae/project/session/DefaultSessionInjector.java (original) +++ maven/sandbox/trunk/mae/mae-components/mae-project-tools/src/main/java/org/apache/maven/mae/project/session/DefaultSessionInjector.java Tue Aug 23 21:45:04 2011 @@ -60,6 +60,8 @@ public class DefaultSessionInjector public synchronized ProjectBuildingRequest getProjectBuildingRequest( final ProjectToolsSession session ) throws ProjectToolsException { + getRemoteRepositories( session ); + ProjectBuildingRequest pbr = session.getProjectBuildingRequest(); try {