maven-m2-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdca...@apache.org
Subject cvs commit: maven-components/maven-model maven.mdo
Date Wed, 06 Apr 2005 01:28:30 GMT
jdcasey     2005/04/05 18:28:30

  Modified:    maven-core/src/main/java/org/apache/maven/project
                        DefaultMavenProjectBuilder.java
               maven-script/maven-script-marmalade pom.xml
               maven-core/src/main/resources/org/apache/maven/project
                        pom-4.0.0.xml
               sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean
                        RepositoryCleaner.java
               maven-mboot2/src/main/java/download ArtifactDownloader.java
               maven-core/src/main/java/org/apache/maven/project/inheritance
                        DefaultModelInheritanceAssembler.java
               sandbox/repoclean pom.xml
               maven-model maven.mdo
  Log:
  o Changed the repository to test.maven.codehaus.org for testing of the new repository and
layout.
  o Added <layout/> element to <repository/> elements in the maven.mdo
  o Added pluginRepository configuration to the super-POM.
  o Tested it all.
  
  Revision  Changes    Path
  1.62      +45 -35    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.61
  retrieving revision 1.62
  diff -u -r1.61 -r1.62
  --- DefaultMavenProjectBuilder.java	4 Apr 2005 21:32:52 -0000	1.61
  +++ DefaultMavenProjectBuilder.java	6 Apr 2005 01:28:29 -0000	1.62
  @@ -129,7 +129,7 @@
           try
           {
               Model superModel = getSuperModel();
  -
  +            
               LinkedList lineage = new LinkedList();
   
               List aggregatedRemoteWagonRepositories = buildArtifactRepositories( superModel.getRepositories()
);
  @@ -146,7 +146,7 @@
   
                   previous = current;
               }
  -
  +            
               project = processProjectLogic( project, localRepository, aggregatedRemoteWagonRepositories,
                                              resolveDependencies, sourceProject );
   
  @@ -334,24 +334,24 @@
   
           List repos = new ArrayList();
   
  -        // TODO: Replace with repository layout detection. This is a nasty hack.
  -        String remoteRepoLayoutId = "legacy";
  -
  -        ArtifactRepositoryLayout remoteRepoLayout = null;
  -        try
  -        {
  -            remoteRepoLayout = (ArtifactRepositoryLayout) container.lookup( ArtifactRepositoryLayout.ROLE,
  -                                                                            remoteRepoLayoutId
);
  -        }
  -        catch ( ComponentLookupException e )
  -        {
  -            throw new ProjectBuildingException( "Cannot find repository layout for: \'"
+ remoteRepoLayoutId + "\'.",
  -                                                e );
  -        }
           for ( Iterator i = repositories.iterator(); i.hasNext(); )
           {
               Repository mavenRepo = (Repository) i.next();
   
  +            String layout = mavenRepo.getLayout();
  +
  +            ArtifactRepositoryLayout remoteRepoLayout = null;
  +            try
  +            {
  +                remoteRepoLayout = (ArtifactRepositoryLayout) container.lookup( ArtifactRepositoryLayout.ROLE,
  +                                                                                layout
);
  +            }
  +            catch ( ComponentLookupException e )
  +            {
  +                throw new ProjectBuildingException( "Cannot find layout implementation
corresponding to: \'" + layout + "\' for remote repository with id: \'" + mavenRepo.getId()
+ "\'.",
  +                                                    e );
  +            }
  +            
               ArtifactRepository artifactRepo = artifactRepositoryFactory.createArtifactRepository(
mavenRepo, settings,
                                                                                         
           remoteRepoLayout );
   
  @@ -367,38 +367,48 @@
           throws Exception
       {
           List remotePluginRepositories = new ArrayList();
  -
  -        // TODO: needs to be configured from the POM element
  -
  +        
           MavenSettings settings = mavenSettingsBuilder.buildSettings();
   
  -        Repository pluginRepo = new Repository();
  -        pluginRepo.setId( "plugin-repository" );
  -        pluginRepo.setUrl( "http://repo1.maven.org/maven2" );
  -
  -        // TODO: [jc] change this to detect the repository layout type somehow...
  -        String repoLayoutId = "legacy";
  -
  -        ArtifactRepositoryLayout repositoryLayout = (ArtifactRepositoryLayout) container.lookup(
  -            ArtifactRepositoryLayout.ROLE, repoLayoutId );
  +        for ( Iterator it = pluginRepositories.iterator(); it.hasNext(); )
  +        {
  +            Repository mavenRepo = (Repository) it.next();
  +            
  +            String layout = mavenRepo.getLayout();
   
  -        ArtifactRepository pluginRepository = artifactRepositoryFactory.createArtifactRepository(
pluginRepo, settings,
  -                                                                                      
           repositoryLayout );
  +            ArtifactRepositoryLayout repositoryLayout = null;
  +            try
  +            {
  +                repositoryLayout = (ArtifactRepositoryLayout) container.lookup( ArtifactRepositoryLayout.ROLE,
  +                                                                                layout
);
  +            }
  +            catch ( ComponentLookupException e )
  +            {
  +                throw new ProjectBuildingException( "Cannot find layout implementation
corresponding to: \'" + layout + "\' for remote repository with id: \'" + mavenRepo.getId()
+ "\'.",
  +                                                    e );
  +            }
  +            
  +            ArtifactRepository pluginRepository = artifactRepositoryFactory.createArtifactRepository(
mavenRepo, settings,
  +                                                                                      
               repositoryLayout );
   
  -        remotePluginRepositories.add( pluginRepository );
  +            remotePluginRepositories.add( pluginRepository );
   
  +        }
  +        
           return remotePluginRepositories;
       }
   
       private ArtifactRepository buildDistributionManagementRepository( Repository dmRepo
)
           throws Exception
       {
  -        // TODO: needs to be configured from the POM element
  -
  +        if(dmRepo == null)
  +        {
  +            return null;
  +        }
  +        
           MavenSettings settings = mavenSettingsBuilder.buildSettings();
   
  -        // TODO: [jc] change this to detect the repository layout type somehow...
  -        String repoLayoutId = "legacy";
  +        String repoLayoutId = dmRepo.getLayout();
   
           ArtifactRepositoryLayout repositoryLayout = (ArtifactRepositoryLayout) container.lookup(
               ArtifactRepositoryLayout.ROLE, repoLayoutId );
  
  
  
  1.8       +5 -0      maven-components/maven-script/maven-script-marmalade/pom.xml
  
  Index: pom.xml
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-script/maven-script-marmalade/pom.xml,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- pom.xml	5 Apr 2005 04:11:03 -0000	1.7
  +++ pom.xml	6 Apr 2005 01:28:29 -0000	1.8
  @@ -23,6 +23,11 @@
       </dependency>
       <dependency>
         <groupId>plexus</groupId>
  +      <artifactId>plexus-utils</artifactId>
  +      <version>1.0-alpha-2</version>
  +    </dependency>
  +    <dependency>
  +      <groupId>plexus</groupId>
         <artifactId>plexus-marmalade-factory</artifactId>
         <version>1.0-alpha-2</version>
       </dependency>
  
  
  
  1.12      +11 -1     maven-components/maven-core/src/main/resources/org/apache/maven/project/pom-4.0.0.xml
  
  Index: pom-4.0.0.xml
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/resources/org/apache/maven/project/pom-4.0.0.xml,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- pom-4.0.0.xml	4 Apr 2005 21:32:53 -0000	1.11
  +++ pom-4.0.0.xml	6 Apr 2005 01:28:29 -0000	1.12
  @@ -6,9 +6,19 @@
       <repository>
         <id>central</id>
         <name>Maven Repository Switchboard</name>
  -      <url>http://repo1.maven.org/maven2</url>
  +      <url>http://test.maven.codehaus.org/maven2</url>
  +      <layout>default</layout>
       </repository>
     </repositories>
  +  
  +  <pluginRepositories>
  +    <pluginRepository>
  +      <id>central</id>
  +      <name>Maven Plugin Repository</name>
  +      <url>http://test.maven.codehaus.org/maven2</url>
  +      <layout>default</layout>
  +    </pluginRepository>
  +  </pluginRepositories>
   
     <build>
       <!-- This all may just fold into plugin parameters -->
  
  
  
  1.9       +53 -0     maven-components/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/RepositoryCleaner.java
  
  Index: RepositoryCleaner.java
  ===================================================================
  RCS file: /home/cvs/maven-components/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/RepositoryCleaner.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- RepositoryCleaner.java	5 Apr 2005 02:47:43 -0000	1.8
  +++ RepositoryCleaner.java	6 Apr 2005 01:28:29 -0000	1.9
  @@ -30,6 +30,8 @@
   import org.codehaus.plexus.context.Context;
   import org.codehaus.plexus.logging.AbstractLogEnabled;
   import org.codehaus.plexus.logging.Logger;
  +import org.codehaus.plexus.mailsender.MailMessage;
  +import org.codehaus.plexus.mailsender.MailSender;
   import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
   import org.codehaus.plexus.util.IOUtil;
   
  @@ -38,9 +40,11 @@
   import java.io.File;
   import java.io.FileInputStream;
   import java.io.FileOutputStream;
  +import java.io.FileReader;
   import java.io.IOException;
   import java.io.InputStream;
   import java.io.OutputStream;
  +import java.util.Date;
   import java.util.Iterator;
   import java.util.List;
   
  @@ -55,6 +59,8 @@
       public static final String ROLE = RepositoryCleaner.class.getName();
   
       private ArtifactDigestVerifier artifactDigestVerifier;
  +    
  +    private MailSender mailSender;
   
       private ArtifactConstructionSupport artifactConstructionSupport = new ArtifactConstructionSupport();
   
  @@ -68,6 +74,8 @@
           File sourceRepositoryBase = normalizeSourceRepositoryBase( configuration.getSourceRepositoryPath()
);
   
           File targetRepositoryBase = normalizeTargetRepositoryBase( configuration.getTargetRepositoryPath()
);
  +        
  +        boolean mailReport = false;
   
           // do not proceed if we cannot produce reports, or if the repository is
           // invalid.
  @@ -162,6 +170,11 @@
                   {
                       logger.warn( "Warning encountered while rewriting one or more artifacts
from source repository to target repository." );
                   }
  +                
  +                if(repoReporter.hasError())
  +                {
  +                    mailReport = true;
  +                }
               }
               finally
               {
  @@ -170,6 +183,46 @@
                       repoReporter.close();
                   }
               }
  +            
  +            if(mailReport)
  +            {
  +                String reportContents = readReportFile(repoReporter.getReportFile());
  +                
  +                MailMessage message = new MailMessage();
  +                message.setContent(reportContents);
  +                message.setSubject("[REPOCLEAN] Error converting repository.");
  +                message.setFromName("Repoclean");
  +                message.setFromAddress("jdcasey@codehaus.org");
  +                message.setSendDate(new Date());
  +                message.addTo("Maven-2 Developers List", "m2-dev@maven.apache.org");
  +                
  +                mailSender.send(message);
  +            }
  +        }
  +        
  +    }
  +
  +    private String readReportFile( File reportFile ) throws IOException
  +    {
  +        FileReader reader = null;
  +        try
  +        {
  +            reader = new FileReader(reportFile);
  +            
  +            StringBuffer reportContent = new StringBuffer();
  +            char[] buffer = new char[512];
  +            int read = -1;
  +            
  +            while((read = reader.read(buffer)) > -1)
  +            {
  +                reportContent.append(buffer, 0, read);
  +            }
  +            
  +            return reportContent.toString();
  +        }
  +        finally
  +        {
  +            IOUtil.close(reader);
           }
       }
   
  
  
  
  1.13      +2 -1      maven-components/maven-mboot2/src/main/java/download/ArtifactDownloader.java
  
  Index: ArtifactDownloader.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-mboot2/src/main/java/download/ArtifactDownloader.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ArtifactDownloader.java	5 Apr 2005 04:11:03 -0000	1.12
  +++ ArtifactDownloader.java	6 Apr 2005 01:28:29 -0000	1.13
  @@ -117,7 +117,8 @@
           if ( repositories.isEmpty() )
           {
               // TODO: use super POM?
  -            Repository repository = new Repository( "http://repo1.maven.org/maven2", Repository.LAYOUT_LEGACY
);
  +            Repository repository = new Repository( "http://test.maven.codehaus.org/maven2",
Repository.LAYOUT_DEFAULT );
  +//            Repository repository = new Repository( "http://repo1.maven.org/maven2",
Repository.LAYOUT_LEGACY );
               remoteRepos.add( repository );
           }
       }
  
  
  
  1.27      +18 -0     maven-components/maven-core/src/main/java/org/apache/maven/project/inheritance/DefaultModelInheritanceAssembler.java
  
  Index: DefaultModelInheritanceAssembler.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/project/inheritance/DefaultModelInheritanceAssembler.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- DefaultModelInheritanceAssembler.java	22 Mar 2005 11:42:23 -0000	1.26
  +++ DefaultModelInheritanceAssembler.java	6 Apr 2005 01:28:29 -0000	1.27
  @@ -27,9 +27,12 @@
   import org.apache.maven.model.Repository;
   import org.apache.maven.model.Scm;
   import org.apache.maven.util.Xpp3DomUtils;
  +import org.codehaus.plexus.logging.AbstractLogEnabled;
   import org.codehaus.plexus.util.StringUtils;
   import org.codehaus.plexus.util.xml.Xpp3Dom;
   
  +import java.util.ArrayList;
  +import java.util.Collections;
   import java.util.Iterator;
   import java.util.List;
   import java.util.Map;
  @@ -43,6 +46,7 @@
    * model.
    */
   public class DefaultModelInheritanceAssembler
  +    extends AbstractLogEnabled
       implements ModelInheritanceAssembler
   {
       public void assembleModelInheritance( Model child, Model parent )
  @@ -151,6 +155,20 @@
               }
           }
   
  +        // Plugin Repositories :: aggregate
  +        List parentPluginRepositories = parent.getPluginRepositories();
  +        List childPluginRepositories = child.getPluginRepositories();
  +        
  +        for ( Iterator iterator = parentPluginRepositories.iterator(); iterator.hasNext();
)
  +        {
  +            Repository repository = (Repository) iterator.next();
  +
  +            if ( !childPluginRepositories.contains( repository ) )
  +            {
  +                child.addPluginRepository( repository );
  +            }
  +        }
  +        
           // Plugins are not aggregated
   
           // Reports :: aggregate
  
  
  
  1.6       +12 -0     maven-components/sandbox/repoclean/pom.xml
  
  Index: pom.xml
  ===================================================================
  RCS file: /home/cvs/maven-components/sandbox/repoclean/pom.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- pom.xml	1 Apr 2005 16:03:43 -0000	1.5
  +++ pom.xml	6 Apr 2005 01:28:29 -0000	1.6
  @@ -14,6 +14,18 @@
       </dependency>
       <dependency>
         <groupId>plexus</groupId>
  +      <artifactId>plexus-mail-sender-api</artifactId>
  +      <version>1.0-alpha-1-SNAPSHOT</version>
  +      <scope>compile</scope>
  +    </dependency>
  +    <dependency>
  +      <groupId>plexus</groupId>
  +      <artifactId>plexus-mail-sender-simple</artifactId>
  +      <version>1.0-alpha-1-SNAPSHOT</version>
  +      <scope>compile</scope>
  +    </dependency>
  +    <dependency>
  +      <groupId>plexus</groupId>
         <artifactId>plexus-utils</artifactId>
         <version>1.0-alpha-2</version>
         <scope>compile</scope>
  
  
  
  1.96      +7 -0      maven-components/maven-model/maven.mdo
  
  Index: maven.mdo
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-model/maven.mdo,v
  retrieving revision 1.95
  retrieving revision 1.96
  diff -u -r1.95 -r1.96
  --- maven.mdo	30 Mar 2005 03:30:08 -0000	1.95
  +++ maven.mdo	6 Apr 2005 01:28:29 -0000	1.96
  @@ -1860,6 +1860,13 @@
             <type>String</type>
             <defaultValue>daily</defaultValue>
           </field>
  +        <field>
  +          <name>layout</name>
  +          <version>4.0.0</version>
  +          <description>The type of layout this repository uses for locating and storing
aritfacts - can be "legacy" or "default".</description>
  +          <type>String</type>
  +          <defaultValue>default</defaultValue>
  +        </field>
         </fields>
         <codeSegments>
           <codeSegment>
  
  
  

Mime
View raw message