> Added: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/io/DefaultMetadataReader.java
> URL:
http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/io/DefaultMetadataReader.java?rev=829934&view=auto> ==============================================================================
> --- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/io/DefaultMetadataReader.java (added)
> +++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/io/DefaultMetadataReader.java Mon Oct 26 20:16:00 2009
> @@ -0,0 +1,110 @@
> +package org.apache.maven.artifact.repository.metadata.io;
> +
> +/*
> + * 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.
> + */
> +
> +import java.io.File;
> +import java.io.IOException;
> +import java.io.InputStream;
> +import java.io.Reader;
> +import java.util.Map;
> +
> +import org.apache.maven.artifact.repository.metadata.Metadata;
> +import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Reader;
> +import org.codehaus.plexus.component.annotations.Component;
> +import org.codehaus.plexus.util.IOUtil;
> +import org.codehaus.plexus.util.ReaderFactory;
> +import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
> +
> +/**
> + * Handles deserialization of metadata from some kind of textual format like XML.
> + *
> + * @author Benjamin Bentmann
> + */
> +@Component( role = MetadataReader.class )
> +public class DefaultMetadataReader
> + implements MetadataReader
> +{
> +
> + public Metadata read( File input, Map<String, ?> options )
> + throws IOException
> + {
> + if ( input == null )
> + {
> + throw new IllegalArgumentException( "input file missing" );
> + }
> +
> + Metadata metadata = read( ReaderFactory.newXmlReader( input ), options );
> +
> + return metadata;
> + }
> +
> + public Metadata read( Reader input, Map<String, ?> options )
> + throws IOException
> + {
> + if ( input == null )
> + {
> + throw new IllegalArgumentException( "input reader missing" );
> + }
> +
> + try
> + {
> + MetadataXpp3Reader r = new MetadataXpp3Reader();
> + return r.read( input, isStrict( options ) );
> + }
> + catch ( XmlPullParserException e )
> + {
> + throw new MetadataParseException( e.getMessage(), e.getLineNumber(), e.getColumnNumber(), e );
> + }
> + finally
> + {
> + IOUtil.close( input );
> + }
> + }
> +
> + public Metadata read( InputStream input, Map<String, ?> options )
> + throws IOException
> + {
> + if ( input == null )
> + {
> + throw new IllegalArgumentException( "input stream missing" );
> + }
> +
> + try
> + {
> + MetadataXpp3Reader r = new MetadataXpp3Reader();
> + return r.read( input, isStrict( options ) );
> + }
> + catch ( XmlPullParserException e )
> + {
> + throw new MetadataParseException( e.getMessage(), e.getLineNumber(), e.getColumnNumber(), e );
> + }
> + finally
> + {
> + IOUtil.close( input );
> + }
> + }
> +
> + private boolean isStrict( Map<String, ?> options )
> + {
> + Object value = ( options != null ) ? options.get( IS_STRICT ) : null;
> + return value == null || Boolean.parseBoolean( value.toString() );
> + }
> +
> +}
>
> Propchange: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/io/DefaultMetadataReader.java
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Propchange: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/io/DefaultMetadataReader.java
> ------------------------------------------------------------------------------
> svn:keywords = Author Date Id Revision
>
> Copied: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionResult.java (from r828801, maven/maven-3/trunk/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionResult.java)
> URL:
http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionResult.java?p2=maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionResult.java&p1=maven/maven-3/trunk/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionResult.java&r1=828801&r2=829934&rev=829934&view=diff> ==============================================================================
> --- maven/maven-3/trunk/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionResult.java (original)
> +++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionResult.java Mon Oct 26 20:16:00 2009
> @@ -24,7 +24,6 @@
> import org.apache.maven.artifact.Artifact;
> import org.apache.maven.artifact.repository.ArtifactRepository;
> import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
> -import org.apache.maven.repository.legacy.resolver.DefaultLegacyArtifactCollector;
>
> /**
> * Specific problems during resolution that we want to account for:
>
> Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/MavenProject.java
> URL:
http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/MavenProject.java?rev=829934&r1=829933&r2=829934&view=diff> ==============================================================================
> --- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/MavenProject.java (original)
> +++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/MavenProject.java Mon Oct 26 20:16:00 2009
> @@ -38,7 +38,6 @@
> import org.apache.maven.artifact.factory.ArtifactFactory;
> import org.apache.maven.artifact.repository.ArtifactRepository;
> import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
> -import org.apache.maven.artifact.versioning.ManagedVersionMap;
> import org.apache.maven.model.Build;
> import org.apache.maven.model.CiManagement;
> import org.apache.maven.model.Contributor;
> @@ -1583,7 +1582,7 @@
> DependencyManagement dependencyManagement = getDependencyManagement();
> if ( ( dependencyManagement != null ) && ( ( deps = dependencyManagement.getDependencies() ) != null ) && ( deps.size() > 0 ) )
> {
> - map = new ManagedVersionMap( map );
> + map = new HashMap<String, Artifact>();
> for ( Iterator<Dependency> i = dependencyManagement.getDependencies().iterator(); i.hasNext(); )
> {
> Dependency d = i.next();
> @@ -1928,7 +1927,7 @@
>
> if ( project.getManagedVersionMap() != null )
> {
> - setManagedVersionMap( new ManagedVersionMap( project.getManagedVersionMap() ) );
> + setManagedVersionMap( new HashMap<String, Artifact>( project.getManagedVersionMap() ) );
> }
> }
>
>
> Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingException.java
> URL:
http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingException.java?rev=829934&r1=829933&r2=829934&view=diff> ==============================================================================
> --- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingException.java (original)
> +++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingException.java Mon Oct 26 20:16:00 2009
> @@ -1,20 +1,5 @@
> package org.apache.maven.project;
>
> -import java.io.File;
> -import java.io.IOException;
> -import java.io.PrintWriter;
> -import java.io.StringWriter;
> -import java.util.List;
> -
> -import org.apache.maven.artifact.InvalidRepositoryException;
> -import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
> -import org.apache.maven.artifact.resolver.ArtifactResolutionException;
> -import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
> -import org.apache.maven.model.building.ModelProblem;
> -import org.apache.maven.profiles.activation.ProfileActivationException;
> -import org.apache.maven.project.artifact.InvalidDependencyVersionException;
> -import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
> -
> /*
> * Licensed to the Apache Software Foundation (ASF) under one
> * or more contributor license agreements. See the NOTICE file
> @@ -34,6 +19,13 @@
> * under the License.
> */
>
> +import java.io.File;
> +import java.io.PrintWriter;
> +import java.io.StringWriter;
> +import java.util.List;
> +
> +import org.apache.maven.model.building.ModelProblem;
> +
> /**
> * @author Jason van Zyl
> * @version $Id$
> @@ -56,19 +48,6 @@
> /**
> * @param projectId
> * @param message
> - * @param pomLocation absolute path of the pom file
> - * @deprecated use {@link File} constructor for pomLocation
> - */
> - protected ProjectBuildingException( String projectId, String message, String pomLocation )
> - {
> - super( createMessage( message, projectId, new File( pomLocation ) ) );
> - this.projectId = projectId;
> - pomFile = new File( pomLocation );
> - }
> -
> - /**
> - * @param projectId
> - * @param message
> * @param pomFile pom file location
> */
> public ProjectBuildingException( String projectId, String message, File pomFile )
> @@ -91,171 +70,6 @@
> this.pomFile = pomFile;
> }
>
> - /**
> - * @deprecated use {@link File} constructor for pomLocation
> - */
> - public ProjectBuildingException( String projectId, String message, String pomLocation,
> - ProfileActivationException cause )
> - {
> - super( createMessage( message, projectId, new File( pomLocation ) ), cause );
> - this.projectId = projectId;
> - pomFile = new File( pomLocation );
> - }
> -
> - public ProjectBuildingException( String projectId, String message, File pomFile, ProfileActivationException cause )
> - {
> - super( createMessage( message, projectId, pomFile ), cause );
> - this.projectId = projectId;
> - this.pomFile = pomFile;
> - }
> -
> - /**
> - * @deprecated use {@link File} constructor for pomLocation
> - */
> - public ProjectBuildingException( String projectId, String message, String pomLocation, IOException cause )
> - {
> - super( createMessage( message, projectId, new File( pomLocation ) ), cause );
> - this.projectId = projectId;
> - pomFile = new File( pomLocation );
> - }
> -
> - public ProjectBuildingException( String projectId, String message, File pomFile, IOException cause )
> - {
> - super( createMessage( message, projectId, pomFile ), cause );
> - this.projectId = projectId;
> - this.pomFile = pomFile;
> - }
> -
> - // for super-POM building.
> - public ProjectBuildingException( String projectId, String message, IOException cause )
> - {
> - super( createMessage( message, projectId, null ), cause );
> - this.projectId = projectId;
> - }
> -
> - /**
> - * @deprecated use {@link File} constructor for pomLocation
> - */
> - public ProjectBuildingException( String projectId, String message, String pomLocation,
> - XmlPullParserException cause )
> - {
> - super( createMessage( message, projectId, new File( pomLocation ) ), cause );
> - this.projectId = projectId;
> - pomFile = new File( pomLocation );
> - }
> -
> - public ProjectBuildingException( String projectId, String message, File pomFile, XmlPullParserException cause )
> - {
> - super( createMessage( message, projectId, pomFile ), cause );
> - this.projectId = projectId;
> - this.pomFile = pomFile;
> - }
> -
> - protected ProjectBuildingException( String projectId, String message, XmlPullParserException cause )
> - {
> - super( createMessage( message, projectId, null ), cause );
> - this.projectId = projectId;
> - }
> -
> - public ProjectBuildingException( String projectId, String message, ArtifactResolutionException cause )
> - {
> - super( createMessage( message, projectId, null ), cause );
> - this.projectId = projectId;
> - }
> -
> - public ProjectBuildingException( String projectId, String message, InvalidRepositoryException cause )
> - {
> - super( createMessage( message, projectId, null ), cause );
> - this.projectId = projectId;
> - }
> -
> - public ProjectBuildingException( String projectId, String message, File pomFile, InvalidRepositoryException cause )
> - {
> - super( createMessage( message, projectId, pomFile ), cause );
> - this.projectId = projectId;
> - this.pomFile = pomFile;
> - }
> -
> - public ProjectBuildingException( String projectId, String message, ArtifactNotFoundException cause )
> - {
> - super( createMessage( message, projectId, null ), cause );
> - this.projectId = projectId;
> - }
> -
> - public ProjectBuildingException( String projectId, String message, File pomFile, ArtifactResolutionException cause )
> - {
> - super( createMessage( message, projectId, pomFile ), cause );
> - this.projectId = projectId;
> - this.pomFile = pomFile;
> - }
> -
> - /**
> - * @deprecated use {@link File} constructor for pomLocation
> - */
> - public ProjectBuildingException( String projectId, String message, String pomLocation,
> - ArtifactResolutionException cause )
> - {
> - super( createMessage( message, projectId, new File( pomLocation ) ), cause );
> - this.projectId = projectId;
> - pomFile = new File( pomLocation );
> - }
> -
> - public ProjectBuildingException( String projectId, String message, File pomFile, ArtifactNotFoundException cause )
> - {
> - super( createMessage( message, projectId, pomFile ), cause );
> - this.projectId = projectId;
> - this.pomFile = pomFile;
> - }
> -
> - /**
> - * @deprecated use {@link File} constructor for pomLocation
> - */
> - public ProjectBuildingException( String projectId, String message, String pomLocation,
> - ArtifactNotFoundException cause )
> - {
> - super( createMessage( message, projectId, new File( pomLocation ) ), cause );
> - this.projectId = projectId;
> - pomFile = new File( pomLocation );
> - }
> -
> - public ProjectBuildingException( String projectId, String message, File pomFile,
> - InvalidVersionSpecificationException cause )
> - {
> - super( createMessage( message, projectId, pomFile ), cause );
> - this.projectId = projectId;
> - this.pomFile = pomFile;
> - }
> -
> - /**
> - * @deprecated use {@link File} constructor for pomLocation
> - */
> - public ProjectBuildingException( String projectId, String message, String pomLocation,
> - InvalidVersionSpecificationException cause )
> - {
> - super( createMessage( message, projectId, new File( pomLocation ) ), cause );
> - this.projectId = projectId;
> - pomFile = new File( pomLocation );
> - }
> -
> - public ProjectBuildingException( String projectId, String message, File pomFile,
> - InvalidDependencyVersionException cause )
> - {
> - super( createMessage( message, projectId, pomFile ), cause );
> - this.projectId = projectId;
> - this.pomFile = pomFile;
> - }
> -
> - /**
> - * @deprecated use {@link File} constructor for pomLocation
> - */
> - public ProjectBuildingException( String projectId, String message, String pomLocation,
> - InvalidDependencyVersionException cause )
> - {
> - super( createMessage( message, projectId, new File( pomLocation ) ), cause );
> - this.projectId = projectId;
> - pomFile = new File( pomLocation );
> - }
> -
> public ProjectBuildingException( List<ProjectBuildingResult> results )
> {
> super( createMessage( results ) );
>
> Copied: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/repository/RepositorySystem.java (from r828801, maven/maven-3/trunk/maven-compat/src/main/java/org/apache/maven/repository/RepositorySystem.java)
> URL:
http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/repository/RepositorySystem.java?p2=maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/repository/RepositorySystem.java&p1=maven/maven-3/trunk/maven-compat/src/main/java/org/apache/maven/repository/RepositorySystem.java&r1=828801&r2=829934&rev=829934&view=diff> ==============================================================================
> --- maven/maven-3/trunk/maven-compat/src/main/java/org/apache/maven/repository/RepositorySystem.java (original)
> +++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/repository/RepositorySystem.java Mon Oct 26 20:16:00 2009
> @@ -133,8 +133,6 @@
>
> ArtifactResolutionResult resolve( ArtifactResolutionRequest request );
>
> - MetadataResolutionResult resolveMetadata( MetadataResolutionRequest request );
> -
> // Install
>
> // Deploy
>
> Modified: maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/ProjectDependenciesResolverTest.java
> URL:
http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/ProjectDependenciesResolverTest.java?rev=829934&r1=829933&r2=829934&view=diff> ==============================================================================
> --- maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/ProjectDependenciesResolverTest.java (original)
> +++ maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/ProjectDependenciesResolverTest.java Mon Oct 26 20:16:00 2009
> @@ -38,6 +38,7 @@
> return "src/test/projects/project-dependencies-resolver";
> }
>
> + /*
> public void testExclusionsInDependencies()
> throws Exception
> {
> @@ -59,6 +60,7 @@
> assertEquals( 1, artifactDependencies.size() );
> assertEquals( "b", artifactDependencies.iterator().next().getArtifactId() );
> }
> + */
>
> public void testSystemScopeDependencies()
> throws Exception
>
> Modified: maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorTest.java
> URL:
http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorTest.java?rev=829934&r1=829933&r2=829934&view=diff> ==============================================================================
> --- maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorTest.java (original)
> +++ maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorTest.java Mon Oct 26 20:16:00 2009
> @@ -31,19 +31,18 @@
> import org.apache.maven.artifact.ArtifactUtils;
> import org.apache.maven.artifact.factory.ArtifactFactory;
> import org.apache.maven.artifact.repository.ArtifactRepository;
> -import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
> -import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
> -import org.apache.maven.artifact.versioning.VersionRange;
> import org.apache.maven.execution.DefaultMavenExecutionRequest;
> import org.apache.maven.execution.DefaultMavenExecutionResult;
> import org.apache.maven.execution.MavenExecutionRequest;
> import org.apache.maven.execution.MavenSession;
> import org.apache.maven.model.Build;
> +import org.apache.maven.model.Dependency;
> import org.apache.maven.model.Model;
> import org.apache.maven.plugin.descriptor.MojoDescriptor;
> import org.apache.maven.plugin.descriptor.PluginDescriptor;
> import org.apache.maven.project.DuplicateProjectException;
> import org.apache.maven.project.MavenProject;
> +import org.apache.maven.repository.RepositorySystem;
> import org.codehaus.plexus.MutablePlexusContainer;
> import org.codehaus.plexus.PlexusContainer;
> import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator;
> @@ -60,15 +59,13 @@
> {
> private static final String FS = System.getProperty( "file.separator" );
>
> - private ArtifactFactory factory;
> - private ArtifactRepositoryFactory artifactRepositoryFactory;
> + private RepositorySystem factory;
>
> public void setUp()
> throws Exception
> {
> super.setUp();
> - factory = lookup( ArtifactFactory.class );
> - artifactRepositoryFactory = lookup( ArtifactRepositoryFactory.class );
> + factory = lookup( RepositorySystem.class );
> }
>
> @Override
> @@ -100,12 +97,7 @@
> {
> MojoExecution exec = newMojoExecution();
>
> - Artifact depArtifact = factory.createDependencyArtifact( "group",
> - "artifact",
> - VersionRange.createFromVersion( "1" ),
> - "jar",
> - null,
> - Artifact.SCOPE_COMPILE );
> + Artifact depArtifact = createArtifact( "group", "artifact", "1" );
>
> List<Artifact> deps = new ArrayList<Artifact>();
> deps.add( depArtifact );
> @@ -128,12 +120,7 @@
> {
> MojoExecution exec = newMojoExecution();
>
> - Artifact depArtifact = factory.createDependencyArtifact( "group",
> - "artifact",
> - VersionRange.createFromVersion( "1" ),
> - "jar",
> - null,
> - Artifact.SCOPE_COMPILE );
> + Artifact depArtifact = createArtifact( "group", "artifact", "1" );
>
> List<Artifact> deps = new ArrayList<Artifact>();
> deps.add( depArtifact );
> @@ -399,9 +386,7 @@
> private ExpressionEvaluator createExpressionEvaluator( MavenProject project, PluginDescriptor pluginDescriptor, Properties executionProperties )
> throws Exception
> {
> - ArtifactRepositoryLayout repoLayout = lookup( ArtifactRepositoryLayout.class, "default" );
> -
> - ArtifactRepository repo = artifactRepositoryFactory.createArtifactRepository( "local", "target/repo", repoLayout, null, null );
> + ArtifactRepository repo = factory.createDefaultLocalRepository();
>
> MutablePlexusContainer container = (MutablePlexusContainer) getContainer();
> MavenSession session = createSession( container, repo, executionProperties );
> @@ -416,15 +401,17 @@
> return new PluginParameterExpressionEvaluator( session, mojoExecution );
> }
>
> - protected Artifact createArtifact( String groupId,
> - String artifactId,
> - String version )
> + protected Artifact createArtifact( String groupId, String artifactId, String version )
> throws Exception
> {
> - ArtifactFactory artifactFactory = lookup( ArtifactFactory.class );
> + Dependency dependency = new Dependency();
> + dependency.setGroupId( groupId );
> + dependency.setArtifactId( artifactId );
> + dependency.setVersion( version );
> + dependency.setType( "jar" );
> + dependency.setScope( "compile" );
>
> - // TODO: used to be SCOPE_COMPILE, check
> - return artifactFactory.createBuildArtifact( groupId, artifactId, version, "jar" );
> + return factory.createDependencyArtifact( dependency );
> }
>
> private MojoExecution newMojoExecution()
> @@ -454,4 +441,5 @@
> // TODO Auto-generated method stub
> return null;
> }
> +
> }
>
> Modified: maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java
> URL:
http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java?rev=829934&r1=829933&r2=829934&view=diff> ==============================================================================
> --- maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java (original)
> +++ maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java Mon Oct 26 20:16:00 2009
> @@ -23,7 +23,6 @@
> import java.util.Arrays;
>
> import org.apache.maven.artifact.repository.ArtifactRepository;
> -import org.apache.maven.artifact.repository.DefaultArtifactRepository;
> import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
> import org.apache.maven.model.building.ModelBuildingException;
> import org.apache.maven.model.building.ModelProblem;
>
> Modified: maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/DefaultMavenProjectBuilderTest.java
> URL:
http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/DefaultMavenProjectBuilderTest.java?rev=829934&r1=829933&r2=829934&view=diff> ==============================================================================
> --- maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/DefaultMavenProjectBuilderTest.java (original)
> +++ maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/DefaultMavenProjectBuilderTest.java Mon Oct 26 20:16:00 2009
> @@ -25,7 +25,6 @@
> import java.util.List;
>
> import org.apache.maven.artifact.repository.ArtifactRepository;
> -import org.apache.maven.artifact.repository.DefaultArtifactRepository;
> import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
> import org.codehaus.plexus.util.FileUtils;
>
>
> Modified: maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/MavenProjectTest.java
> URL:
http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/MavenProjectTest.java?rev=829934&r1=829933&r2=829934&view=diff> ==============================================================================
> --- maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/MavenProjectTest.java (original)
> +++ maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/MavenProjectTest.java Mon Oct 26 20:16:00 2009
> @@ -24,7 +24,6 @@
> import java.util.List;
> import java.util.Map;
>
> -import org.apache.maven.artifact.versioning.ManagedVersionMap;
> import org.apache.maven.model.DependencyManagement;
> import org.apache.maven.model.Model;
> import org.apache.maven.model.Parent;
> @@ -121,7 +120,6 @@
> Map clonedMap = clonedProject.getManagedVersionMap();
> assertNotNull( "ManagedVersionMap not copied", clonedMap );
> assertTrue( "ManagedVersionMap is empty", !clonedMap.isEmpty() );
> - assertTrue( "Not a ManagedVersionMap", clonedMap instanceof ManagedVersionMap );
> assertTrue( "ManagedVersionMap does not contain test key",
> clonedMap.containsKey( "maven-test:maven-test-b:jar" ) );
> }
>
> Modified: maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/TestMetadataSource.java
> URL:
http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/TestMetadataSource.java?rev=829934&r1=829933&r2=829934&view=diff> ==============================================================================
> --- maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/TestMetadataSource.java (original)
> +++ maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/project/TestMetadataSource.java Mon Oct 26 20:16:00 2009
> @@ -12,7 +12,6 @@
> import org.apache.maven.artifact.repository.ArtifactRepository;
> import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
> import org.apache.maven.project.artifact.MavenMetadataSource;
> -import org.apache.maven.repository.metadata.MetadataSource;
> import org.codehaus.plexus.component.annotations.Component;
>
> @Component(role=ArtifactMetadataSource.class,hint="classpath")
>
> Added: maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/repository/TestArtifactHandler.java
> URL:
http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/repository/TestArtifactHandler.java?rev=829934&view=auto> ==============================================================================
> --- maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/repository/TestArtifactHandler.java (added)
> +++ maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/repository/TestArtifactHandler.java Mon Oct 26 20:16:00 2009
> @@ -0,0 +1,83 @@
> +package org.apache.maven.repository;
> +
> +/*
> + * 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.
> + */
> +
> +import org.apache.maven.artifact.handler.ArtifactHandler;
> +
> +/**
> + * Assists unit testing.
> + *
> + * @author Benjamin Bentmann
> + */
> +class TestArtifactHandler
> + implements ArtifactHandler
> +{
> +
> + private String type;
> +
> + private String extension;
> +
> + public TestArtifactHandler( String type )
> + {
> + this( type, type );
> + }
> +
> + public TestArtifactHandler( String type, String extension )
> + {
> + this.type = type;
> + this.extension = extension;
> + }
> +
> + public String getClassifier()
> + {
> + return null;
> + }
> +
> + public String getDirectory()
> + {
> + return getPackaging() + "s";
> + }
> +
> + public String getExtension()
> + {
> + return extension;
> + }
> +
> + public String getLanguage()
> + {
> + return "java";
> + }
> +
> + public String getPackaging()
> + {
> + return type;
> + }
> +
> + public boolean isAddedToClasspath()
> + {
> + return true;
> + }
> +
> + public boolean isIncludesDependencies()
> + {
> + return false;
> + }
> +
> +}
>
> Propchange: maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/repository/TestArtifactHandler.java
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Propchange: maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/repository/TestArtifactHandler.java
> ------------------------------------------------------------------------------
> svn:keywords = Author Date Id Revision
>
> Added: maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/repository/TestRepositorySystem.java
> URL:
http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/repository/TestRepositorySystem.java?rev=829934&view=auto> ==============================================================================
> --- maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/repository/TestRepositorySystem.java (added)
> +++ maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/repository/TestRepositorySystem.java Mon Oct 26 20:16:00 2009
> @@ -0,0 +1,290 @@
> +package org.apache.maven.repository;
> +
> +/*
> + * 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.
> + */
> +
> +import java.io.File;
> +import java.io.IOException;
> +import java.util.ArrayList;
> +import java.util.LinkedHashMap;
> +import java.util.List;
> +import java.util.Map;
> +
> +import org.apache.maven.artifact.Artifact;
> +import org.apache.maven.artifact.DefaultArtifact;
> +import org.apache.maven.artifact.InvalidRepositoryException;
> +import org.apache.maven.artifact.repository.ArtifactRepository;
> +import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
> +import org.apache.maven.artifact.repository.MavenArtifactRepository;
> +import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
> +import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
> +import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
> +import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
> +import org.apache.maven.model.Dependency;
> +import org.apache.maven.model.Model;
> +import org.apache.maven.model.Plugin;
> +import org.apache.maven.model.Repository;
> +import org.apache.maven.model.io.ModelReader;
> +import org.apache.maven.project.artifact.ArtifactWithDependencies;
> +import org.apache.maven.settings.Mirror;
> +import org.apache.maven.settings.Proxy;
> +import org.apache.maven.settings.Server;
> +import org.codehaus.plexus.component.annotations.Component;
> +import org.codehaus.plexus.component.annotations.Requirement;
> +import org.codehaus.plexus.util.FileUtils;
> +
> +/**
> + * @author Benjamin Bentmann
> + */
> +@Component( role = RepositorySystem.class )
> +public class TestRepositorySystem
> + implements RepositorySystem
> +{
> +
> + @Requirement
> + private ModelReader modelReader;
> +
> + public ArtifactRepository buildArtifactRepository( Repository repository )
> + throws InvalidRepositoryException
> + {
> + return new MavenArtifactRepository( repository.getId(), repository.getUrl(), new DefaultRepositoryLayout(),
> + new ArtifactRepositoryPolicy(), new ArtifactRepositoryPolicy() );
> + }
> +
> + public Artifact createArtifact( String groupId, String artifactId, String version, String packaging )
> + {
> + return createArtifact( groupId, artifactId, version, null, packaging );
> + }
> +
> + public Artifact createArtifact( String groupId, String artifactId, String version, String scope, String type )
> + {
> + return new DefaultArtifact( groupId, artifactId, version, scope, type, null, new TestArtifactHandler( type ) );
> + }
> +
> + public ArtifactRepository createArtifactRepository( String id, String url,
> + ArtifactRepositoryLayout repositoryLayout,
> + ArtifactRepositoryPolicy snapshots,
> + ArtifactRepositoryPolicy releases )
> + {
> + return new MavenArtifactRepository( id, url, repositoryLayout, snapshots, releases );
> + }
> +
> + public Artifact createArtifactWithClassifier( String groupId, String artifactId, String version, String type,
> + String classifier )
> + {
> + return new DefaultArtifact( groupId, artifactId, version, null, type, classifier,
> + new TestArtifactHandler( type ) );
> + }
> +
> + public ArtifactRepository createDefaultLocalRepository()
> + throws InvalidRepositoryException
> + {
> + return createLocalRepository( new File( System.getProperty( "basedir", "" ), "target/local-repo" ).getAbsoluteFile() );
> + }
> +
> + public ArtifactRepository createDefaultRemoteRepository()
> + throws InvalidRepositoryException
> + {
> + return new MavenArtifactRepository( DEFAULT_REMOTE_REPO_ID, "file://"
> + + new File( System.getProperty( "basedir", "" ), "src/test/remote-repo" ).toURI().getPath(),
> + new DefaultRepositoryLayout(), new ArtifactRepositoryPolicy(),
> + new ArtifactRepositoryPolicy() );
> + }
> +
> + public Artifact createDependencyArtifact( Dependency dependency )
> + {
> + Artifact artifact =
> + new DefaultArtifact( dependency.getGroupId(), dependency.getArtifactId(), dependency.getVersion(),
> + dependency.getScope(), dependency.getType(), dependency.getClassifier(),
> + new TestArtifactHandler( dependency.getType() ) );
> +
> + if ( Artifact.SCOPE_SYSTEM.equals( dependency.getScope() ) )
> + {
> + artifact.setFile( new File( dependency.getSystemPath() ) );
> + artifact.setResolved( true );
> + }
> +
> + return artifact;
> + }
> +
> + public ArtifactRepository createLocalRepository( File localRepository )
> + throws InvalidRepositoryException
> + {
> + return new MavenArtifactRepository( DEFAULT_LOCAL_REPO_ID, "file://" + localRepository.toURI().getPath(),
> + new DefaultRepositoryLayout(), new ArtifactRepositoryPolicy(),
> + new ArtifactRepositoryPolicy() );
> + }
> +
> + public Artifact createPluginArtifact( Plugin plugin )
> + {
> + return new DefaultArtifact( plugin.getGroupId(), plugin.getArtifactId(), plugin.getVersion(), null,
> + "maven-plugin", null, new TestArtifactHandler( "maven-plugin", "jar" ) );
> + }
> +
> + public Artifact createProjectArtifact( String groupId, String artifactId, String version )
> + {
> + return createArtifact( groupId, artifactId, version, "pom" );
> + }
> +
> + public List<ArtifactRepository> getEffectiveRepositories( List<ArtifactRepository> repositories )
> + {
> + return repositories;
> + }
> +
> + public Mirror getMirror( ArtifactRepository repository, List<Mirror> mirrors )
> + {
> + return null;
> + }
> +
> + public void injectAuthentication( List<ArtifactRepository> repositories, List<Server> servers )
> + {
> + }
> +
> + public void injectMirror( List<ArtifactRepository> repositories, List<Mirror> mirrors )
> + {
> + }
> +
> + public void injectProxy( List<ArtifactRepository> repositories, List<Proxy> proxies )
> + {
> + }
> +
> + public void publish( ArtifactRepository repository, File source, String remotePath,
> + ArtifactTransferListener transferListener )
> + throws ArtifactTransferFailedException
> + {
> + // TODO Auto-generated method stub
> +
> + }
> +
> + public ArtifactResolutionResult resolve( ArtifactResolutionRequest request )
> + {
> + ArtifactResolutionResult result = new ArtifactResolutionResult();
> +
> + if ( request.isResolveRoot() )
> + {
> + try
> + {
> + resolve( request.getArtifact(), request );
> + result.addArtifact( request.getArtifact() );
> + }
> + catch ( IOException e )
> + {
> + result.addMissingArtifact( request.getArtifact() );
> + }
> + }
> +
> + if ( request.isResolveTransitively() )
> + {
> + Map<String, Artifact> artifacts = new LinkedHashMap<String, Artifact>();
> +
> + if ( request.getArtifactDependencies() != null )
> + {
> + for ( Artifact artifact : request.getArtifactDependencies() )
> + {
> + artifacts.put( artifact.getDependencyConflictId(), artifact );
> + }
> + }
> +
> + List<Dependency> dependencies = new ArrayList<Dependency>();
> + if ( request.getArtifact() instanceof ArtifactWithDependencies )
> + {
> + dependencies = ( (ArtifactWithDependencies) request.getArtifact() ).getDependencies();
> + }
> + else
> + {
> + Artifact pomArtifact =
> + createProjectArtifact( request.getArtifact().getGroupId(), request.getArtifact().getArtifactId(),
> + request.getArtifact().getVersion() );
> + File pomFile =
> + new File( request.getLocalRepository().getBasedir(),
> + request.getLocalRepository().pathOf( pomArtifact ) );
> +
> + try
> + {
> + Model model = modelReader.read( pomFile, null );
> +
> + dependencies = model.getDependencies();
> + }
> + catch ( IOException e )
> + {
> + e.printStackTrace();
> + }
> + }
> +
> + for ( Dependency dependency : dependencies )
> + {
> + Artifact artifact = createDependencyArtifact( dependency );
> + if ( !artifacts.containsKey( artifact.getDependencyConflictId() ) )
> + {
> + artifacts.put( artifact.getDependencyConflictId(), artifact );
> + }
> + }
> +
> + for ( Artifact artifact : artifacts.values() )
> + {
> + try
> + {
> + resolve( artifact, request );
> + result.addArtifact( artifact );
> + }
> + catch ( IOException e )
> + {
> + result.addMissingArtifact( artifact );
> + }
> + }
> + }
> +
> + return result;
> + }
> +
> + private void resolve( Artifact artifact, ArtifactResolutionRequest request )
> + throws IOException
> + {
> + if ( Artifact.SCOPE_SYSTEM.equals( artifact.getScope() ) )
> + {
> + return;
> + }
> +
> + ArtifactRepository localRepo = request.getLocalRepository();
> +
> + File localFile = new File( localRepo.getBasedir(), localRepo.pathOf( artifact ) );
> +
> + artifact.setFile( localFile );
> +
> + if ( !localFile.exists() )
> + {
> + ArtifactRepository remoteRepo = request.getRemoteRepositories().get( 0 );
> +
> + File remoteFile = new File( remoteRepo.getBasedir(), remoteRepo.pathOf( artifact ) );
> +
> + FileUtils.copyFile( remoteFile, localFile );
> + }
> +
> + artifact.setResolved( true );
> + }
> +
> + public void retrieve( ArtifactRepository repository, File destination, String remotePath,
> + ArtifactTransferListener transferListener )
> + throws ArtifactTransferFailedException, ArtifactDoesNotExistException
> + {
> + // TODO Auto-generated method stub
> +
> + }
> +
> +}
>
> Propchange: maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/repository/TestRepositorySystem.java
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Propchange: maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/repository/TestRepositorySystem.java
> ------------------------------------------------------------------------------
> svn:keywords = Author Date Id Revision
>
> Modified: maven/maven-3/trunk/maven-embedder/pom.xml
> URL:
http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-embedder/pom.xml?rev=829934&r1=829933&r2=829934&view=diff> ==============================================================================
> --- maven/maven-3/trunk/maven-embedder/pom.xml (original)
> +++ maven/maven-3/trunk/maven-embedder/pom.xml Mon Oct 26 20:16:00 2009
> @@ -23,7 +23,7 @@
> <dependencies>
> <dependency>
> <groupId>org.apache.maven</groupId>
> - <artifactId>maven-model</artifactId>
> + <artifactId>maven-settings</artifactId>
> </dependency>
> <dependency>
> <groupId>org.apache.maven</groupId>
> @@ -31,21 +31,19 @@
> </dependency>
> <dependency>
> <groupId>org.apache.maven</groupId>
> - <artifactId>maven-compat</artifactId>
> + <artifactId>maven-plugin-api</artifactId>
> </dependency>
> <dependency>
> <groupId>org.apache.maven</groupId>
> - <artifactId>maven-plugin-api</artifactId>
> + <artifactId>maven-model-builder</artifactId>
> </dependency>
> - <!--
> <dependency>
> - <groupId>org.apache.maven</groupId>
> - <artifactId>maven-repository</artifactId>
> + <groupId>org.codehaus.plexus</groupId>
> + <artifactId>plexus-utils</artifactId>
> </dependency>
> - -->
> <dependency>
> - <groupId>org.apache.maven</groupId>
> - <artifactId>maven-model-builder</artifactId>
> + <groupId>org.codehaus.plexus</groupId>
> + <artifactId>plexus-classworlds</artifactId>
> </dependency>
> <dependency>
> <groupId>org.codehaus.plexus</groupId>
> @@ -59,6 +57,10 @@
> <groupId>org.sonatype.plexus</groupId>
> <artifactId>plexus-sec-dispatcher</artifactId>
> </dependency>
> + <dependency>
> + <groupId>org.sonatype.plexus</groupId>
> + <artifactId>plexus-cipher</artifactId>
> + </dependency>
> <!-- CLI -->
> <dependency>
> <groupId>commons-cli</groupId>
>
> Modified: maven/maven-3/trunk/maven-plugin-api/pom.xml
> URL:
http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-plugin-api/pom.xml?rev=829934&r1=829933&r2=829934&view=diff> ==============================================================================
> --- maven/maven-3/trunk/maven-plugin-api/pom.xml (original)
> +++ maven/maven-3/trunk/maven-plugin-api/pom.xml Mon Oct 26 20:16:00 2009
> @@ -35,6 +35,10 @@
> <dependencies>
> <dependency>
> <groupId>org.apache.maven</groupId>
> + <artifactId>maven-model</artifactId>
> + </dependency>
> + <dependency>
> + <groupId>org.apache.maven</groupId>
> <artifactId>maven-artifact</artifactId>
> <exclusions>
> <exclusion>
>
> Modified: maven/maven-3/trunk/pom.xml
> URL:
http://svn.apache.org/viewvc/maven/maven-3/trunk/pom.xml?rev=829934&r1=829933&r2=829934&view=diff> ==============================================================================
> --- maven/maven-3/trunk/pom.xml (original)
> +++ maven/maven-3/trunk/pom.xml Mon Oct 26 20:16:00 2009
> @@ -48,6 +48,7 @@
> <plexusUtilsVersion>2.0.1</plexusUtilsVersion>
> <wagonVersion>1.0-beta-6</wagonVersion>
> <securityDispatcherVersion>1.3</securityDispatcherVersion>
> + <cipherVersion>1.4</cipherVersion>
> <modelloVersion>1.1</modelloVersion>
> <jxpathVersion>1.3</jxpathVersion>
> <maven.test.redirectTestOutputToFile>true</maven.test.redirectTestOutputToFile>
> @@ -317,6 +318,11 @@
> </dependency>
> <dependency>
> <groupId>org.sonatype.plexus</groupId>
> + <artifactId>plexus-cipher</artifactId>
> + <version>${cipherVersion}</version>
> + </dependency>
> + <dependency>
> + <groupId>org.sonatype.plexus</groupId>
> <artifactId>plexus-plugin-manager</artifactId>
> <version>${plexusPluginManagerVersion}</version>
> </dependency>
>
>
>