brett       2005/03/21 23:23:17

  Modified:    maven-core/src/main/java/org/apache/maven/artifact/factory
                        ArtifactFactory.java DefaultArtifactFactory.java
               maven-core/src/main/java/org/apache/maven/artifact
                        MavenMetadataSource.java
               maven-core/src/main/java/org/apache/maven/project
                        DefaultMavenProjectBuilder.java MavenProject.java
               
maven-artifact/src/main/java/org/apache/maven/artifact/construction
                        ArtifactConstructionSupport.java
               
maven-artifact/src/main/java/org/apache/maven/artifact/repository/layout
                        AbstractArtifactRepositoryLayout.java
               maven-artifact/src/main/java/org/apache/maven/artifact/resolver
                        DefaultArtifactResolver.java
               maven-artifact/src/main/java/org/apache/maven/artifact
                        Artifact.java DefaultArtifact.java
               maven-artifact/src/test/java/org/apache/maven/artifact
                        ArtifactComponentTestCase.java
  Log:
  remove extension from artifact - it is the sole reponsibility of the artifact 
handler. This prevents the error of plugins getting the extension "maven-plugin"
  
  Revision  Changes    Path
  1.6       +1 -1      
maven-components/maven-core/src/main/java/org/apache/maven/artifact/factory/ArtifactFactory.java
  
  Index: ArtifactFactory.java
  ===================================================================
  RCS file: 
/home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/artifact/factory/ArtifactFactory.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ArtifactFactory.java      16 Mar 2005 07:36:01 -0000      1.5
  +++ ArtifactFactory.java      22 Mar 2005 07:23:15 -0000      1.6
  @@ -34,5 +34,5 @@
       Artifact createArtifact( Dependency dependency, ArtifactRepository 
localRepository, String inheritedScope );
   
       Artifact createArtifact( String groupId, String artifactId, String 
version, String scope, String type,
  -                             String extension, String inheritedScope );
  +                             String inheritedScope );
   }
  
  
  
  1.11      +1 -1      
maven-components/maven-core/src/main/java/org/apache/maven/artifact/factory/DefaultArtifactFactory.java
  
  Index: DefaultArtifactFactory.java
  ===================================================================
  RCS file: 
/home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/artifact/factory/DefaultArtifactFactory.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- DefaultArtifactFactory.java       18 Mar 2005 22:02:09 -0000      1.10
  +++ DefaultArtifactFactory.java       22 Mar 2005 07:23:15 -0000      1.11
  @@ -53,7 +53,7 @@
       public Artifact createArtifact( Dependency dependency, 
ArtifactRepository localRepository, String inheritedScope )
       {
           return createArtifact( dependency.getGroupId(), 
dependency.getArtifactId(), dependency.getVersion(),
  -                               dependency.getScope(), dependency.getType(), 
dependency.getType(), inheritedScope );
  +                               dependency.getScope(), dependency.getType(), 
inheritedScope );
       }
   
   }
  
  
  
  1.23      +2 -2      
maven-components/maven-core/src/main/java/org/apache/maven/artifact/MavenMetadataSource.java
  
  Index: MavenMetadataSource.java
  ===================================================================
  RCS file: 
/home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/artifact/MavenMetadataSource.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- MavenMetadataSource.java  16 Mar 2005 06:56:03 -0000      1.22
  +++ MavenMetadataSource.java  22 Mar 2005 07:23:15 -0000      1.23
  @@ -88,7 +88,7 @@
                   Artifact metadataArtifact = artifactFactory.createArtifact( 
artifact.getGroupId(),
                                                                               
artifact.getArtifactId(),
                                                                               
artifact.getVersion(), artifact.getScope(),
  -                                                                            
"pom", "pom", null );
  +                                                                            
"pom", null );
   
                   artifactResolver.resolve( metadataArtifact, 
remoteRepositories, localRepository );
   
  
  
  
  1.56      +38 -31    
maven-components/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
  
  Index: DefaultMavenProjectBuilder.java
  ===================================================================
  RCS file: 
/home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java,v
  retrieving revision 1.55
  retrieving revision 1.56
  diff -u -r1.55 -r1.56
  --- DefaultMavenProjectBuilder.java   21 Mar 2005 08:18:33 -0000      1.55
  +++ DefaultMavenProjectBuilder.java   22 Mar 2005 07:23:16 -0000      1.56
  @@ -109,7 +109,8 @@
           return build( project, localRepository, true, true );
       }
   
  -    public MavenProject build( File project, ArtifactRepository 
localRepository ) throws ProjectBuildingException
  +    public MavenProject build( File project, ArtifactRepository 
localRepository )
  +        throws ProjectBuildingException
       {
           return build( project, localRepository, false, true );
       }
  @@ -121,7 +122,8 @@
       }
   
       private MavenProject build( File projectDescriptor, ArtifactRepository 
localRepository,
  -                               boolean resolveDependencies, boolean 
sourceProject ) throws ProjectBuildingException
  +                                boolean resolveDependencies, boolean 
sourceProject )
  +        throws ProjectBuildingException
       {
           try
           {
  @@ -156,7 +158,8 @@
       }
   
       private MavenProject processProjectLogic( MavenProject project, 
ArtifactRepository localRepository,
  -                                             List remoteRepositories, 
boolean resolveDependencies, boolean sourceProject )
  +                                              List remoteRepositories, 
boolean resolveDependencies,
  +                                              boolean sourceProject )
           throws ProjectBuildingException, ModelInterpolationException, 
ArtifactResolutionException
       {
           Model model = project.getModel();
  @@ -196,9 +199,9 @@
           {
               try
               {
  -                project
  -                       .setDistributionManagementArtifactRepository( 
buildDistributionManagementRepository( dm
  -                                                                             
                                 .getRepository() ) );
  +                project.setDistributionManagementArtifactRepository(
  +                    buildDistributionManagementRepository(
  +                        dm.getRepository() ) );
               }
               catch ( Exception e )
               {
  @@ -249,7 +252,7 @@
       }
   
       private MavenProject assembleLineage( File projectDescriptor, 
ArtifactRepository localRepository,
  -                                         LinkedList lineage, List 
aggregatedRemoteWagonRepositories )
  +                                          LinkedList lineage, List 
aggregatedRemoteWagonRepositories )
           throws ProjectBuildingException
       {
           Model model = readModel( projectDescriptor );
  @@ -261,7 +264,8 @@
       }
   
       private MavenProject assembleLineage( Model model, ArtifactRepository 
localRepository, LinkedList lineage,
  -                                         List 
aggregatedRemoteWagonRepositories ) throws ProjectBuildingException
  +                                          List 
aggregatedRemoteWagonRepositories )
  +        throws ProjectBuildingException
       {
           MavenProject project = new MavenProject( model );
   
  @@ -293,8 +297,8 @@
               // as we go in order to do this.
               // 
----------------------------------------------------------------------
   
  -            aggregatedRemoteWagonRepositories
  -                                             .addAll( 
buildArtifactRepositories( project.getModel().getRepositories() ) );
  +            aggregatedRemoteWagonRepositories.addAll(
  +                buildArtifactRepositories( 
project.getModel().getRepositories() ) );
   
               MavenProject parent;
               Model cachedModel = getCachedModel( parentModel.getGroupId(), 
parentModel.getArtifactId(),
  @@ -315,7 +319,8 @@
           return project;
       }
   
  -    private List buildArtifactRepositories( List repositories ) throws 
ProjectBuildingException
  +    private List buildArtifactRepositories( List repositories )
  +        throws ProjectBuildingException
       {
           MavenSettings settings = null;
   
  @@ -341,7 +346,8 @@
           }
           catch ( ComponentLookupException e )
           {
  -            throw new ProjectBuildingException( "Cannot find repository 
layout for: \'" + remoteRepoLayoutId + "\'.", e );
  +            throw new ProjectBuildingException( "Cannot find repository 
layout for: \'" + remoteRepoLayoutId + "\'.",
  +                                                e );
           }
           for ( Iterator i = repositories.iterator(); i.hasNext(); )
           {
  @@ -358,7 +364,8 @@
           return repos;
       }
   
  -    private List buildPluginRepositories( List pluginRepositories ) throws 
Exception
  +    private List buildPluginRepositories( List pluginRepositories )
  +        throws Exception
       {
           List remotePluginRepositories = new ArrayList();
   
  @@ -373,10 +380,8 @@
           // TODO: [jc] change this to detect the repository layout type 
somehow...
           String repoLayoutId = "legacy";
   
  -        ArtifactRepositoryLayout repositoryLayout = 
(ArtifactRepositoryLayout) container
  -                                                                             
           .lookup(
  -                                                                             
                    ArtifactRepositoryLayout.ROLE,
  -                                                                             
                    repoLayoutId );
  +        ArtifactRepositoryLayout repositoryLayout = 
(ArtifactRepositoryLayout) container.lookup(
  +            ArtifactRepositoryLayout.ROLE, repoLayoutId );
   
           ArtifactRepository pluginRepository = 
artifactRepositoryFactory.createArtifactRepository( pluginRepo, settings,
                                                                                
                     repositoryLayout );
  @@ -386,7 +391,8 @@
           return remotePluginRepositories;
       }
   
  -    private ArtifactRepository buildDistributionManagementRepository( 
Repository dmRepo ) throws Exception
  +    private ArtifactRepository buildDistributionManagementRepository( 
Repository dmRepo )
  +        throws Exception
       {
           // TODO: needs to be configured from the POM element
   
  @@ -395,10 +401,8 @@
           // TODO: [jc] change this to detect the repository layout type 
somehow...
           String repoLayoutId = "legacy";
   
  -        ArtifactRepositoryLayout repositoryLayout = 
(ArtifactRepositoryLayout) container
  -                                                                             
           .lookup(
  -                                                                             
                    ArtifactRepositoryLayout.ROLE,
  -                                                                             
                    repoLayoutId );
  +        ArtifactRepositoryLayout repositoryLayout = 
(ArtifactRepositoryLayout) container.lookup(
  +            ArtifactRepositoryLayout.ROLE, repoLayoutId );
   
           ArtifactRepository dmArtifactRepository = 
artifactRepositoryFactory.createArtifactRepository( dmRepo, settings,
                                                                                
                         repositoryLayout );
  @@ -406,7 +410,8 @@
           return dmArtifactRepository;
       }
   
  -    private Model readModel( File file ) throws ProjectBuildingException
  +    private Model readModel( File file )
  +        throws ProjectBuildingException
       {
           try
           {
  @@ -419,12 +424,12 @@
           catch ( Exception e )
           {
               throw new ProjectBuildingException(
  -                                                "Error while reading model 
from file '" + file.getAbsolutePath() + "'.",
  -                                                e );
  +                "Error while reading model from file '" + 
file.getAbsolutePath() + "'.", e );
           }
       }
   
  -    private Model readModel( URL url ) throws ProjectBuildingException
  +    private Model readModel( URL url )
  +        throws ProjectBuildingException
       {
           try
           {
  @@ -444,7 +449,7 @@
           throws ProjectBuildingException
       {
           Artifact artifact = artifactFactory.createArtifact( 
parent.getGroupId(), parent.getArtifactId(),
  -                                                            
parent.getVersion(), null, "pom", "pom", null );
  +                                                            
parent.getVersion(), null, "pom", null );
   
           try
           {
  @@ -453,8 +458,8 @@
           catch ( ArtifactResolutionException e )
           {
               // @todo use parent.toString() if modello could generate it, or 
specify in a code segment
  -            throw new ProjectBuildingException( "Missing parent POM: " + 
parent.getGroupId() + ":"
  -                + parent.getArtifactId() + "-" + parent.getVersion(), e );
  +            throw new ProjectBuildingException( "Missing parent POM: " + 
parent.getGroupId() + ":" +
  +                                                parent.getArtifactId() + "-" 
+ parent.getVersion(), e );
           }
   
           return artifact.getFile();
  @@ -507,14 +512,16 @@
       //
       // ----------------------------------------------------------------------
   
  -    private Model getSuperModel() throws ProjectBuildingException
  +    private Model getSuperModel()
  +        throws ProjectBuildingException
       {
           URL url = DefaultMavenProjectBuilder.class.getResource( "pom-" + 
MavenConstants.MAVEN_MODEL_VERSION + ".xml" );
   
           return readModel( url );
       }
   
  -    public void contextualize( Context context ) throws Exception
  +    public void contextualize( Context context )
  +        throws Exception
       {
           this.container = (PlexusContainer) context.get( 
PlexusConstants.PLEXUS_KEY );
       }
  
  
  
  1.33      +9 -8      
maven-components/maven-core/src/main/java/org/apache/maven/project/MavenProject.java
  
  Index: MavenProject.java
  ===================================================================
  RCS file: 
/home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/project/MavenProject.java,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- MavenProject.java 21 Mar 2005 08:18:33 -0000      1.32
  +++ MavenProject.java 22 Mar 2005 07:23:16 -0000      1.33
  @@ -254,8 +254,8 @@
               if ( isAddedToClasspath( a ) )
               {
                   // TODO: let the scope handler deal with this
  -                if ( Artifact.SCOPE_TEST.equals( a.getScope() ) || 
Artifact.SCOPE_COMPILE.equals( a.getScope() )
  -                    || Artifact.SCOPE_RUNTIME.equals( a.getScope() ) )
  +                if ( Artifact.SCOPE_TEST.equals( a.getScope() ) || 
Artifact.SCOPE_COMPILE.equals( a.getScope() ) ||
  +                    Artifact.SCOPE_RUNTIME.equals( a.getScope() ) )
                   {
                       list.add( a.getPath() );
                   }
  @@ -609,7 +609,8 @@
        * <li>do a topo sort on the graph that remains.</li>
        * </ul>
        */
  -    public static List getSortedProjects( List projects ) throws 
CycleDetectedException
  +    public static List getSortedProjects( List projects )
  +        throws CycleDetectedException
       {
           DAG dag = new DAG();
   
  @@ -685,13 +686,14 @@
               {
                   Artifact existing = (Artifact) artifacts.get( id );
                   boolean updateScope = false;
  -                if ( Artifact.SCOPE_RUNTIME.equals( a.getScope() ) && 
Artifact.SCOPE_TEST.equals( existing.getScope() ) )
  +                if ( Artifact.SCOPE_RUNTIME.equals( a.getScope() ) &&
  +                    Artifact.SCOPE_TEST.equals( existing.getScope() ) )
                   {
                       updateScope = true;
                   }
   
  -                if ( Artifact.SCOPE_COMPILE.equals( a.getScope() )
  -                    && !Artifact.SCOPE_COMPILE.equals( existing.getScope() ) 
)
  +                if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) &&
  +                    !Artifact.SCOPE_COMPILE.equals( existing.getScope() ) )
                   {
                       updateScope = true;
                   }
  @@ -703,8 +705,7 @@
                       Artifact artifact = 
artifactConstructionSupport.createArtifact( existing.getGroupId(),
                                                                                
       existing.getArtifactId(),
                                                                                
       existing.getVersion(),
  -                                                                             
       a.getScope(), existing.getType(),
  -                                                                             
       existing.getExtension() );
  +                                                                             
       a.getScope(), existing.getType() );
   
                       artifacts.put( id, artifact );
                   }
  
  
  
  1.2       +6 -11     
maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/construction/ArtifactConstructionSupport.java
  
  Index: ArtifactConstructionSupport.java
  ===================================================================
  RCS file: 
/home/cvs/maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/construction/ArtifactConstructionSupport.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ArtifactConstructionSupport.java  18 Mar 2005 22:02:09 -0000      1.1
  +++ ArtifactConstructionSupport.java  22 Mar 2005 07:23:16 -0000      1.2
  @@ -25,19 +25,14 @@
    */
   public class ArtifactConstructionSupport
   {
  -    
  +
       public Artifact createArtifact( String groupId, String artifactId, 
String version, String scope, String type )
       {
  -        return createArtifact( groupId, artifactId, version, scope, type, 
type, null );
  -    }
  -    
  -    public Artifact createArtifact( String groupId, String artifactId, 
String version, String scope, String type, String extension )
  -    {
  -        return createArtifact( groupId, artifactId, version, scope, type, 
extension, null );
  +        return createArtifact( groupId, artifactId, version, scope, type, 
null );
       }
  -    
  +
       public Artifact createArtifact( String groupId, String artifactId, 
String version, String scope, String type,
  -                                    String extension, String inheritedScope )
  +                                    String inheritedScope )
       {
           // TODO: can refactor, use scope handler
   
  @@ -65,7 +60,7 @@
           {
               desiredScope = Artifact.SCOPE_TEST;
           }
  -        
  -        return new DefaultArtifact( groupId, artifactId, version, 
desiredScope, type, extension );
  +
  +        return new DefaultArtifact( groupId, artifactId, version, 
desiredScope, type );
       }
   }
  
  
  
  1.2       +5 -4      
maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/repository/layout/AbstractArtifactRepositoryLayout.java
  
  Index: AbstractArtifactRepositoryLayout.java
  ===================================================================
  RCS file: 
/home/cvs/maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/repository/layout/AbstractArtifactRepositoryLayout.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AbstractArtifactRepositoryLayout.java     21 Mar 2005 08:18:33 -0000      
1.1
  +++ AbstractArtifactRepositoryLayout.java     22 Mar 2005 07:23:17 -0000      
1.2
  @@ -36,7 +36,8 @@
   
       protected abstract String groupIdAsPath( String groupId );
   
  -    public String pathOf( Artifact artifact ) throws 
ArtifactPathFormatException
  +    public String pathOf( Artifact artifact )
  +        throws ArtifactPathFormatException
       {
           String path = layoutPattern();
   
  @@ -64,13 +65,13 @@
           }
           catch ( ArtifactHandlerNotFoundException e )
           {
  -            throw new ArtifactPathFormatException( "Cannot find 
ArtifactHandler for artifact: \'" + artifact.getId()
  -                + "\'.", e );
  +            throw new ArtifactPathFormatException( "Cannot find 
ArtifactHandler for artifact: \'" + artifact.getId() +
  +                                                   "\'.", e );
           }
   
           path = StringUtils.replace( path, "${directory}", 
artifactHandler.directory() );
   
  -        path = StringUtils.replace( path, "${extension}", 
artifact.getExtension() );
  +        path = StringUtils.replace( path, "${extension}", 
artifactHandler.extension() );
   
           return path;
       }
  
  
  
  1.21      +20 -21    
maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java
  
  Index: DefaultArtifactResolver.java
  ===================================================================
  RCS file: 
/home/cvs/maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- DefaultArtifactResolver.java      21 Mar 2005 08:18:33 -0000      1.20
  +++ DefaultArtifactResolver.java      22 Mar 2005 07:23:17 -0000      1.21
  @@ -65,8 +65,8 @@
           try
           {
               Logger logger = getLogger();
  -            logger.debug( "Resolving: " + artifact.getId() + " from:\n" + 
"{localRepository: " + localRepository
  -                + "}\n" + "{remoteRepositories: " + remoteRepositories + "}" 
);
  +            logger.debug( "Resolving: " + artifact.getId() + " from:\n" + 
"{localRepository: " + localRepository +
  +                          "}\n" + "{remoteRepositories: " + 
remoteRepositories + "}" );
   
               setLocalRepositoryPath( artifact, localRepository );
   
  @@ -95,9 +95,8 @@
       {
           StringBuffer sb = new StringBuffer();
   
  -        sb.append( "The artifact is not present locally as:" ).append( LS 
).append( LS ).append( artifact.getPath() )
  -          .append( LS ).append( LS ).append( "or in any of the specified 
remote repositories:" ).append( LS )
  -          .append( LS );
  +        sb.append( "The artifact is not present locally as:" ).append( LS 
).append( LS ).append( artifact.getPath() ).append(
  +            LS ).append( LS ).append( "or in any of the specified remote 
repositories:" ).append( LS ).append( LS );
   
           for ( Iterator i = remoteRepositories.iterator(); i.hasNext(); )
           {
  @@ -135,8 +134,8 @@
       // ----------------------------------------------------------------------
   
       public ArtifactResolutionResult resolveTransitively( Set artifacts, List 
remoteRepositories,
  -                                                        ArtifactRepository 
localRepository,
  -                                                        
ArtifactMetadataSource source, ArtifactFilter filter )
  +                                                         ArtifactRepository 
localRepository,
  +                                                         
ArtifactMetadataSource source, ArtifactFilter filter )
           throws ArtifactResolutionException
       {
           ArtifactResolutionResult artifactResolutionResult;
  @@ -159,16 +158,16 @@
       }
   
       public ArtifactResolutionResult resolveTransitively( Set artifacts, List 
remoteRepositories,
  -                                                        ArtifactRepository 
localRepository,
  -                                                        
ArtifactMetadataSource source )
  +                                                         ArtifactRepository 
localRepository,
  +                                                         
ArtifactMetadataSource source )
           throws ArtifactResolutionException
       {
           return resolveTransitively( artifacts, remoteRepositories, 
localRepository, source, null );
       }
   
       public ArtifactResolutionResult resolveTransitively( Artifact artifact, 
List remoteRepositories,
  -                                                        ArtifactRepository 
localRepository,
  -                                                        
ArtifactMetadataSource source )
  +                                                         ArtifactRepository 
localRepository,
  +                                                         
ArtifactMetadataSource source )
           throws ArtifactResolutionException
       {
           return resolveTransitively( Collections.singleton( artifact ), 
remoteRepositories, localRepository, source );
  @@ -179,8 +178,9 @@
       // ----------------------------------------------------------------------
   
       private ArtifactResolutionResult collect( Set artifacts, 
ArtifactRepository localRepository,
  -                                             List remoteRepositories, 
ArtifactMetadataSource source,
  -                                             ArtifactFilter filter ) throws 
TransitiveArtifactResolutionException
  +                                              List remoteRepositories, 
ArtifactMetadataSource source,
  +                                              ArtifactFilter filter )
  +        throws TransitiveArtifactResolutionException
       {
           ArtifactResolutionResult result = new ArtifactResolutionResult();
   
  @@ -215,14 +215,14 @@
   
                       // TODO: scope handler
                       boolean updateScope = false;
  -                    if ( Artifact.SCOPE_RUNTIME.equals( 
newArtifact.getScope() )
  -                        && Artifact.SCOPE_TEST.equals( 
knownArtifact.getScope() ) )
  +                    if ( Artifact.SCOPE_RUNTIME.equals( 
newArtifact.getScope() ) &&
  +                        Artifact.SCOPE_TEST.equals( knownArtifact.getScope() 
) )
                       {
                           updateScope = true;
                       }
   
  -                    if ( Artifact.SCOPE_COMPILE.equals( 
newArtifact.getScope() )
  -                        && !Artifact.SCOPE_COMPILE.equals( 
knownArtifact.getScope() ) )
  +                    if ( Artifact.SCOPE_COMPILE.equals( 
newArtifact.getScope() ) &&
  +                        !Artifact.SCOPE_COMPILE.equals( 
knownArtifact.getScope() ) )
                       {
                           updateScope = true;
                       }
  @@ -235,8 +235,7 @@
                                                                                
           knownArtifact.getArtifactId(),
                                                                                
           knownVersion,
                                                                                
           newArtifact.getScope(),
  -                                                                             
           knownArtifact.getType(),
  -                                                                             
           knownArtifact.getExtension() );
  +                                                                             
           knownArtifact.getType() );
                           resolvedArtifacts.put( artifact.getConflictId(), 
artifact );
                       }
                   }
  @@ -261,8 +260,8 @@
                       }
                       catch ( ArtifactMetadataRetrievalException e )
                       {
  -                        throw new TransitiveArtifactResolutionException( 
"Error retrieving metadata [" + newArtifact
  -                            + "] : ", e );
  +                        throw new TransitiveArtifactResolutionException( 
"Error retrieving metadata [" + newArtifact +
  +                                                                         "] 
: ", e );
                       }
   
                       // the pom for given dependency exisit we will add it to 
the
  
  
  
  1.5       +0 -2      
maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/Artifact.java
  
  Index: Artifact.java
  ===================================================================
  RCS file: 
/home/cvs/maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/Artifact.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Artifact.java     21 Mar 2005 08:18:33 -0000      1.4
  +++ Artifact.java     22 Mar 2005 07:23:17 -0000      1.5
  @@ -42,8 +42,6 @@
       // only providing this since classifier is *very* optional...
       boolean hasClassifier();
   
  -    String getExtension();
  -
       // ----------------------------------------------------------------------
   
       void setPath( String path );
  
  
  
  1.15      +8 -26     
maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/DefaultArtifact.java
  
  Index: DefaultArtifact.java
  ===================================================================
  RCS file: 
/home/cvs/maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/DefaultArtifact.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- DefaultArtifact.java      22 Mar 2005 06:51:16 -0000      1.14
  +++ DefaultArtifact.java      22 Mar 2005 07:23:17 -0000      1.15
  @@ -44,26 +44,17 @@
   
       private final String scope;
   
  -    private final String extension;
  -
       private String path;
   
       /**
        * @todo this should be replaced by type handler
  -     */
  -    public DefaultArtifact( String groupId, String artifactId, String 
version, String scope, String type,
  -                            String extension )
  -    {
  -        this( groupId, artifactId, version, scope, type, null, extension );
  -    }
  -
  -    /**
        * !!! WARNING !!! Never put <classifier/> in the POM. It is for mojo use
        * only. Classifier is for specifying derived artifacts, like ejb-client.
        */
       public DefaultArtifact( String groupId, String artifactId, String 
version, String scope, String type,
  -                            String classifier, String extension )
  +                            String classifier )
       {
  +        // These should help us catch coding errors until this code gets a 
whole lot clearer
           if ( type == null )
           {
               throw new NullPointerException( "Artifact type cannot be null." 
);
  @@ -80,20 +71,16 @@
           this.scope = scope;
   
           this.classifier = classifier;
  +    }
   
  -        if ( extension == null )
  -        {
  -            this.extension = type;
  -        }
  -        else
  -        {
  -            this.extension = extension;
  -        }
  +    public DefaultArtifact( String groupId, String artifactId, String 
version, String scope, String type )
  +    {
  +        this( groupId, artifactId, version, scope, type, null );
       }
   
       public DefaultArtifact( String groupId, String artifactId, String 
version, String type )
       {
  -        this( groupId, artifactId, version, null, type, null, type );
  +        this( groupId, artifactId, version, null, type, null );
       }
   
       public String getClassifier()
  @@ -131,11 +118,6 @@
           return type;
       }
   
  -    public String getExtension()
  -    {
  -        return extension;
  -    }
  -
       // ----------------------------------------------------------------------
       //
       // ----------------------------------------------------------------------
  
  
  
  1.9       +40 -20    
maven-components/maven-artifact/src/test/java/org/apache/maven/artifact/ArtifactComponentTestCase.java
  
  Index: ArtifactComponentTestCase.java
  ===================================================================
  RCS file: 
/home/cvs/maven-components/maven-artifact/src/test/java/org/apache/maven/artifact/ArtifactComponentTestCase.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ArtifactComponentTestCase.java    21 Mar 2005 08:18:33 -0000      1.8
  +++ ArtifactComponentTestCase.java    22 Mar 2005 07:23:17 -0000      1.9
  @@ -38,7 +38,8 @@
   {
       protected ArtifactHandlerManager artifactHandlerManager;
   
  -    protected void setUp() throws Exception
  +    protected void setUp()
  +        throws Exception
       {
           super.setUp();
   
  @@ -47,9 +48,13 @@
   
       protected abstract String component();
   
  -    /** Return an existing file, not a directory - causes creation to fail. 
  -     * @throws Exception*/
  -    protected ArtifactRepository badLocalRepository() throws Exception
  +    /**
  +     * Return an existing file, not a directory - causes creation to fail.
  +     *
  +     * @throws Exception
  +     */
  +    protected ArtifactRepository badLocalRepository()
  +        throws Exception
       {
           String path = "target/test-classes/repositories/" + component() + 
"/bad-local-repository";
   
  @@ -65,7 +70,8 @@
           return localRepository;
       }
   
  -    protected ArtifactRepository localRepository() throws Exception
  +    protected ArtifactRepository localRepository()
  +        throws Exception
       {
           String path = "target/test-classes/repositories/" + component() + 
"/local-repository";
   
  @@ -79,7 +85,8 @@
           return localRepository;
       }
   
  -    protected ArtifactRepository remoteRepository() throws Exception
  +    protected ArtifactRepository remoteRepository()
  +        throws Exception
       {
           String path = "target/test-classes/repositories/" + component() + 
"/remote-repository";
   
  @@ -93,7 +100,8 @@
           return repository;
       }
   
  -    protected ArtifactRepository badRemoteRepository() throws Exception
  +    protected ArtifactRepository badRemoteRepository()
  +        throws Exception
       {
           ArtifactRepositoryLayout repoLayout = (ArtifactRepositoryLayout) 
lookup( ArtifactRepositoryLayout.ROLE,
                                                                                
    "legacy" );
  @@ -103,7 +111,8 @@
           return repository;
       }
   
  -    protected void assertRemoteArtifactPresent( Artifact artifact ) throws 
Exception
  +    protected void assertRemoteArtifactPresent( Artifact artifact )
  +        throws Exception
       {
           ArtifactRepository remoteRepo = remoteRepository();
   
  @@ -117,7 +126,8 @@
           }
       }
   
  -    protected void assertLocalArtifactPresent( Artifact artifact ) throws 
Exception
  +    protected void assertLocalArtifactPresent( Artifact artifact )
  +        throws Exception
       {
           ArtifactRepository localRepo = localRepository();
   
  @@ -131,7 +141,8 @@
           }
       }
   
  -    protected void assertRemoteArtifactNotPresent( Artifact artifact ) 
throws Exception
  +    protected void assertRemoteArtifactNotPresent( Artifact artifact )
  +        throws Exception
       {
           ArtifactRepository remoteRepo = remoteRepository();
   
  @@ -145,7 +156,8 @@
           }
       }
   
  -    protected void assertLocalArtifactNotPresent( Artifact artifact ) throws 
Exception
  +    protected void assertLocalArtifactNotPresent( Artifact artifact )
  +        throws Exception
       {
           ArtifactRepository localRepo = localRepository();
   
  @@ -163,7 +175,8 @@
       //
       // ----------------------------------------------------------------------
   
  -    protected List remoteRepositories() throws Exception
  +    protected List remoteRepositories()
  +        throws Exception
       {
           List remoteRepositories = new ArrayList();
   
  @@ -176,7 +189,8 @@
       // Test artifact generation for unit tests
       // ----------------------------------------------------------------------
   
  -    protected Artifact createLocalArtifact( String artifactId, String 
version ) throws Exception
  +    protected Artifact createLocalArtifact( String artifactId, String 
version )
  +        throws Exception
       {
           Artifact artifact = createArtifact( artifactId, version );
   
  @@ -185,7 +199,8 @@
           return artifact;
       }
   
  -    protected Artifact createRemoteArtifact( String artifactId, String 
version ) throws Exception
  +    protected Artifact createRemoteArtifact( String artifactId, String 
version )
  +        throws Exception
       {
           Artifact artifact = createArtifact( artifactId, version );
   
  @@ -194,17 +209,20 @@
           return artifact;
       }
   
  -    protected void createLocalArtifact( Artifact artifact ) throws Exception
  +    protected void createLocalArtifact( Artifact artifact )
  +        throws Exception
       {
           createArtifact( artifact, localRepository() );
       }
   
  -    protected void createRemoteArtifact( Artifact artifact ) throws Exception
  +    protected void createRemoteArtifact( Artifact artifact )
  +        throws Exception
       {
           createArtifact( artifact, remoteRepository() );
       }
   
  -    protected void createArtifact( Artifact artifact, ArtifactRepository 
repository ) throws Exception
  +    protected void createArtifact( Artifact artifact, ArtifactRepository 
repository )
  +        throws Exception
       {
           String path = repository.pathOf( artifact );
   
  @@ -234,15 +252,17 @@
   
       protected Artifact createArtifact( String groupId, String artifactId, 
String version, String type )
       {
  -        return new DefaultArtifact( groupId, artifactId, version, 
Artifact.SCOPE_COMPILE, type, type );
  +        return new DefaultArtifact( groupId, artifactId, version, 
Artifact.SCOPE_COMPILE, type );
       }
   
  -    protected void deleteLocalArtifact( Artifact artifact ) throws Exception
  +    protected void deleteLocalArtifact( Artifact artifact )
  +        throws Exception
       {
           deleteArtifact( artifact, localRepository() );
       }
   
  -    protected void deleteArtifact( Artifact artifact, ArtifactRepository 
repository ) throws Exception
  +    protected void deleteArtifact( Artifact artifact, ArtifactRepository 
repository )
  +        throws Exception
       {
           String path = repository.pathOf( artifact );
   
  
  
  

Reply via email to