o testing repeatedly with an empty repository

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@516820 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2007-03-11 00:48:53 +00:00
parent 72ce76a260
commit f03d8d662f
16 changed files with 73 additions and 118 deletions

View File

@ -18,7 +18,7 @@
classworlds.version=1.2-alpha-7
plexus.version=1.0-alpha-19
plexus-archiver.version=1.0-alpha-8
plexus-utils.version=1.4
plexus-utils.version=1.4.1
plexus-interactivity-api.version=1.0-alpha-6-SNAPSHOT
commons-cli.version=1.0
commons-lang.version=2.1

View File

@ -328,6 +328,7 @@ public class DefaultWagonManager
else
{
getLogger().debug( "Trying repository " + repository.getId() );
getRemoteFile( repository, artifact.getFile(), remotePath, downloadMonitor, policy.getChecksumPolicy(),
false );
getLogger().debug( " Artifact resolved" );
@ -787,6 +788,20 @@ public class DefaultWagonManager
this.interactive = interactive;
}
public void findAndRegisterWagons( PlexusContainer container )
{
try
{
Map wagons = container.lookupMap( Wagon.ROLE );
registerWagons( wagons.keySet(), container );
}
catch ( ComponentLookupException e )
{
// no wagons found in the extension
}
}
public void registerWagons( Collection wagons, PlexusContainer extensionContainer )
{
for ( Iterator i = wagons.iterator(); i.hasNext(); )

View File

@ -117,4 +117,6 @@ public interface WagonManager
void setInteractive( boolean interactive );
void registerWagons( Collection wagons, PlexusContainer extensionContainer );
void findAndRegisterWagons( PlexusContainer container );
}

View File

@ -295,7 +295,8 @@ public class DefaultArtifactResolver
}
catch ( ArtifactNotFoundException anfe )
{
getLogger().debug( anfe.getMessage() );
getLogger().debug( anfe.getMessage(), anfe );
missingArtifacts.add( node.getArtifact() );
}
}
@ -303,14 +304,6 @@ public class DefaultArtifactResolver
if ( missingArtifacts.size() > 0 )
{
throw new MultipleArtifactsNotFoundException( originatingArtifact, missingArtifacts, remoteRepositories );
// String message = "required artifacts missing:\n";
// for ( Iterator i = missingArtifacts.iterator(); i.hasNext(); )
// {
// Artifact missingArtifact = (Artifact) i.next();
// message += " " + missingArtifact.getId() + "\n";
// }
// message += "\nfor the artifact:";
// throw new ArtifactResolutionException( message, originatingArtifact, remoteRepositories );
}
return artifactResolutionResult;

View File

@ -158,16 +158,7 @@ public class DefaultExtensionManager
public void registerWagons()
{
try
{
Map wagons = container.lookupMap( Wagon.ROLE );
wagonManager.registerWagons( wagons.keySet(), container );
}
catch ( ComponentLookupException e )
{
// no wagons found in the extension
}
wagonManager.findAndRegisterWagons( container );
}
public void contextualize( Context context )

View File

@ -35,12 +35,9 @@ import org.apache.maven.execution.RuntimeInformation;
import org.apache.maven.model.Plugin;
import org.apache.maven.model.ReportPlugin;
import org.apache.maven.plugin.InvalidPluginException;
import org.apache.maven.plugin.registry.MavenPluginRegistryBuilder;
import org.apache.maven.plugin.registry.PluginRegistry;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectBuilder;
import org.apache.maven.project.ProjectBuildingException;
import org.codehaus.plexus.components.interactivity.InputHandler;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.util.StringUtils;
@ -53,17 +50,10 @@ public class DefaultPluginVersionManager
extends AbstractLogEnabled
implements PluginVersionManager
{
private MavenPluginRegistryBuilder mavenPluginRegistryBuilder;
private ArtifactFactory artifactFactory;
private InputHandler inputHandler;
private ArtifactMetadataSource artifactMetadataSource;
// TODO: [jc] Revisit to remove this piece of state. PLUGIN REGISTRY MAY BE UPDATED ON DISK OUT-OF-PROCESS!
private PluginRegistry pluginRegistry;
private MavenProjectBuilder mavenProjectBuilder;
private RuntimeInformation runtimeInformation;
@ -118,21 +108,12 @@ public class DefaultPluginVersionManager
}
}
// we're NEVER going to persist POM-derived plugin versions.
String updatedVersion = null;
// third pass...we're always checking for latest install/deploy, so retrieve the version for LATEST metadata and
// also set that resolved version as the <useVersion/> in settings.xml.
if ( StringUtils.isEmpty( version ) )
{
// 1. resolve the version to be used
version = resolveMetaVersion( groupId, artifactId, project, localRepository, Artifact.LATEST_VERSION );
if ( version != null )
{
// 2. Set the updatedVersion so the user will be prompted whether to make this version permanent.
updatedVersion = version;
}
}
// final pass...retrieve the version for RELEASE and also set that resolved version as the <useVersion/>
@ -141,12 +122,6 @@ public class DefaultPluginVersionManager
{
// 1. resolve the version to be used
version = resolveMetaVersion( groupId, artifactId, project, localRepository, Artifact.RELEASE_VERSION );
if ( version != null )
{
// 2. Set the updatedVersion so the user will be prompted whether to make this version permanent.
updatedVersion = version;
}
}
// if we're still empty here, and the current project matches the plugin in question, use the current project's

View File

@ -610,16 +610,9 @@ under the License.
<role>org.apache.maven.artifact.metadata.ArtifactMetadataSource</role>
<role-hint>default</role-hint>
</requirement>
<requirement>
<role>org.apache.maven.plugin.registry.MavenPluginRegistryBuilder</role>
</requirement>
<requirement>
<role>org.apache.maven.artifact.factory.ArtifactFactory</role>
</requirement>
<requirement>
<role>org.codehaus.plexus.components.interactivity.InputHandler</role>
<role-hint>default</role-hint>
</requirement>
<requirement>
<role>org.apache.maven.project.MavenProjectBuilder</role>
</requirement>

View File

@ -86,6 +86,7 @@ under the License.
<exclude>classworlds:classworlds</exclude>
<exclude>junit:junit</exclude>
<exclude>jmock:jmock</exclude>
<exclude>xml-apis:xml-apis</exclude>
</excludes>
<!--
<dependenciesToHide>
@ -129,6 +130,18 @@ under the License.
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-http-lightweight</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh-external</artifactId>
</dependency>
</dependencies>
<distributionManagement>
<site>

View File

@ -427,10 +427,14 @@ public class MavenEmbedder
{
request = defaultsPopulator.populateDefaults( request, this );
//mkleint: copied from DefaultLifecycleExecutor
project = readProject( new File( request.getPomFile() ) );
Map handlers = findArtifactTypeHandlers( project );
//is this necessary in this context, I doubt it..mkleint
artifactHandlerManager.addHandlers( handlers );
project = mavenProjectBuilder.buildWithDependencies( new File( request.getPomFile() ),
request.getLocalRepository(), profileManager,
request.getTransferListener() );

View File

@ -113,6 +113,8 @@ public class DefaultMavenExecutionRequestDefaultsPopulator
}
else
{
wagonManager.findAndRegisterWagons( container );
wagonManager.setInteractive( request.isInteractiveMode() );
wagonManager.setDownloadMonitor( request.getTransferListener() );

View File

@ -17,25 +17,6 @@ specific language governing permissions and limitations
under the License.
-->
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

View File

@ -247,10 +247,22 @@ public class MavenEmbedderTest
throws Exception
{
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setShowErrors( true )
.setPomFile( getPomFile().getAbsolutePath() );
.setPomFile( getPomFile().getAbsolutePath() ).setShowErrors( true );
MavenExecutionResult result = maven.readProjectWithDependencies( request );
if ( result.hasExceptions() )
{
for ( Iterator i = result.getExceptions().iterator(); i.hasNext(); )
{
Exception e = (Exception) i.next();
e.printStackTrace();
}
fail( "Exception is readProjectWithDependencies() test." );
}
assertNoExceptions( result );
assertEquals( "org.apache.maven", result.getMavenProject().getGroupId() );

View File

@ -21,31 +21,9 @@ under the License.
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven</groupId>
<artifactId>maven-model</artifactId>
<name>Maven Model</name>
<version>2.0-beta-2-SNAPSHOT</version>
<description>Maven Model</description>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.modello</groupId>
<artifactId>modello-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>xpp3-writer</goal>
<goal>java</goal>
<goal>xpp3-reader</goal>
<goal>xsd</goal>
</goals>
</execution>
</executions>
<configuration>
<version>4.0.0</version>
<model>maven.mdo</model>
</configuration>
</plugin>
</plugins>
</build>
<name>Maven Embedder Test Project</name>
<version>1.0</version>
<description>Maven Embedder Test Project</description>
<dependencies>
<dependency>
<groupId>plexus</groupId>

View File

@ -1,24 +1,5 @@
package org.apache.maven.project;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file

View File

@ -59,7 +59,7 @@ import java.util.List;
import java.util.Set;
/**
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
* @author Jason van Zyl
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
* @version $Id$
*/

17
pom.xml
View File

@ -24,7 +24,7 @@ under the License.
<parent>
<groupId>org.apache.maven</groupId>
<artifactId>maven-parent</artifactId>
<version>6-SNAPSHOT</version>
<version>5</version>
<relativePath>../pom/maven/pom.xml</relativePath>
</parent>
<artifactId>maven</artifactId>
@ -179,6 +179,21 @@ under the License.
<artifactId>wagon-file</artifactId>
<version>${wagonVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-http-lightweight</artifactId>
<version>${wagonVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh</artifactId>
<version>${wagonVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh-external</artifactId>
<version>${wagonVersion}</version>
</dependency>
<dependency>
<groupId>easymock</groupId>
<artifactId>easymock</artifactId>