maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jvan...@apache.org
Subject svn commit: r475957 - in /maven/archetype/trunk/maven-archetype: ./ maven-archetype-core/ maven-archetype-core/src/main/java/org/apache/maven/archetype/ maven-archetype-core/src/main/resources/ maven-archetype-creator/
Date Thu, 16 Nov 2006 22:46:53 GMT
Author: jvanzyl
Date: Thu Nov 16 14:46:52 2006
New Revision: 475957

URL: http://svn.apache.org/viewvc?view=rev&rev=475957
Log:
o use the CDC for all plexus components
o use the new maven-downloader component to grab archetypes
o update to wagon-file 1.0-alpha-6

Removed:
    maven/archetype/trunk/maven-archetype/maven-archetype-core/src/main/resources/
Modified:
    maven/archetype/trunk/maven-archetype/maven-archetype-core/pom.xml
    maven/archetype/trunk/maven-archetype/maven-archetype-core/src/main/java/org/apache/maven/archetype/DefaultArchetype.java
    maven/archetype/trunk/maven-archetype/maven-archetype-creator/pom.xml
    maven/archetype/trunk/maven-archetype/pom.xml

Modified: maven/archetype/trunk/maven-archetype/maven-archetype-core/pom.xml
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/maven-archetype/maven-archetype-core/pom.xml?view=diff&rev=475957&r1=475956&r2=475957
==============================================================================
--- maven/archetype/trunk/maven-archetype/maven-archetype-core/pom.xml (original)
+++ maven/archetype/trunk/maven-archetype/maven-archetype-core/pom.xml Thu Nov 16 14:46:52
2006
@@ -33,7 +33,7 @@
     <dependency>
       <groupId>org.apache.maven.wagon</groupId>
       <artifactId>wagon-file</artifactId>
-      <version>1.0-alpha-4</version>
+      <version>1.0-alpha-6</version>
       <scope>test</scope>
     </dependency>
     <dependency>
@@ -47,16 +47,6 @@
       <version>2.0</version>
     </dependency>
     <dependency>
-      <groupId>org.apache.maven</groupId>
-      <artifactId>maven-artifact-manager</artifactId>
-      <version>2.0</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.maven</groupId>
-      <artifactId>maven-artifact</artifactId>
-      <version>2.0</version>
-    </dependency>
-    <dependency>
       <groupId>org.codehaus.plexus</groupId>
       <artifactId>plexus-container-default</artifactId>
       <version>1.0-alpha-9</version>
@@ -65,6 +55,11 @@
       <groupId>dom4j</groupId>
       <artifactId>dom4j</artifactId>
       <version>1.6.1</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.shared</groupId>
+      <artifactId>maven-downloader</artifactId>
+      <version>1.0-SNAPSHOT</version>
     </dependency>
   </dependencies>
 </project>

Modified: maven/archetype/trunk/maven-archetype/maven-archetype-core/src/main/java/org/apache/maven/archetype/DefaultArchetype.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/maven-archetype/maven-archetype-core/src/main/java/org/apache/maven/archetype/DefaultArchetype.java?view=diff&rev=475957&r1=475956&r2=475957
==============================================================================
--- maven/archetype/trunk/maven-archetype/maven-archetype-core/src/main/java/org/apache/maven/archetype/DefaultArchetype.java
(original)
+++ maven/archetype/trunk/maven-archetype/maven-archetype-core/src/main/java/org/apache/maven/archetype/DefaultArchetype.java
Thu Nov 16 14:46:52 2006
@@ -19,18 +19,16 @@
 import org.apache.maven.archetype.descriptor.ArchetypeDescriptor;
 import org.apache.maven.archetype.descriptor.ArchetypeDescriptorBuilder;
 import org.apache.maven.archetype.descriptor.TemplateDescriptor;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.factory.ArtifactFactory;
 import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
-import org.apache.maven.artifact.resolver.ArtifactResolutionException;
-import org.apache.maven.artifact.resolver.ArtifactResolver;
 import org.apache.maven.model.Build;
 import org.apache.maven.model.Model;
 import org.apache.maven.model.Parent;
 import org.apache.maven.model.Resource;
 import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
 import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
+import org.apache.maven.shared.downloader.DownloadException;
+import org.apache.maven.shared.downloader.DownloadNotFoundException;
+import org.apache.maven.shared.downloader.Downloader;
 import org.apache.velocity.VelocityContext;
 import org.apache.velocity.context.Context;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
@@ -66,6 +64,7 @@
 import java.util.Set;
 
 /**
+ * @plexus.component
  * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
  * @version $Id$
  */
@@ -85,42 +84,50 @@
     // Components
     // ----------------------------------------------------------------------
 
+    /**
+     * @plexus.requirement
+     */
     private VelocityComponent velocity;
 
-    private ArtifactResolver artifactResolver;
+    /**
+     * @plexus.requirement
+     */
+    private Downloader downloader;
 
     // ----------------------------------------------------------------------
     // Implementation
     // ----------------------------------------------------------------------
 
-    private ArtifactFactory artifactFactory;
-
     // groupId = maven
     // artifactId = maven-foo-archetype
     // version = latest
 
-    public void createArchetype( String archetypeGroupId, String archetypeArtifactId, String
archetypeVersion,
-                                 ArtifactRepository localRepository, List remoteRepositories,
Map parameters )
+    public void createArchetype( String archetypeGroupId,
+                                 String archetypeArtifactId,
+                                 String archetypeVersion,
+                                 ArtifactRepository localRepository,
+                                 List remoteRepositories,
+                                 Map parameters )
         throws ArchetypeNotFoundException, ArchetypeDescriptorException, ArchetypeTemplateProcessingException
     {
         // ----------------------------------------------------------------------
         // Download the archetype
         // ----------------------------------------------------------------------
 
-        Artifact archetypeArtifact = artifactFactory.createArtifact( archetypeGroupId, archetypeArtifactId,
-                                                                     archetypeVersion, Artifact.SCOPE_RUNTIME,
"jar" );
+        File archetype;
 
         try
         {
-            artifactResolver.resolve( archetypeArtifact, remoteRepositories, localRepository
);
+            archetype = downloader.download( archetypeGroupId, archetypeArtifactId, archetypeVersion,
localRepository,
+                                             remoteRepositories );
         }
-        catch ( ArtifactResolutionException e )
+        catch ( DownloadException e )
         {
-            throw new ArchetypeDescriptorException( "Error attempting to download archetype:
" + e.getMessage(), e );
+            throw new ArchetypeDescriptorException( "Error attempting to download archetype.",
e );
         }
-        catch ( ArtifactNotFoundException e )
+        catch ( DownloadNotFoundException e )
         {
-            throw new ArchetypeNotFoundException( "Archetype does not exist: " + e.getMessage(),
e );
+            throw new ArchetypeNotFoundException( "Archetype does not exist.", e );
         }
 
         // ---------------------------------------------------------------------
@@ -170,7 +177,7 @@
         {
             URL[] urls = new URL[1];
 
-            urls[0] = archetypeArtifact.getFile().toURL();
+            urls[0] = archetype.toURL();
 
             archetypeJarLoader = new URLClassLoader( urls );
 
@@ -400,7 +407,9 @@
 
     }
 
-    static boolean addModuleToParentPom( String artifactId, Reader fileReader, Writer fileWriter
)
+    static boolean addModuleToParentPom( String artifactId,
+                                         Reader fileReader,
+                                         Writer fileWriter )
         throws DocumentException, IOException, ArchetypeTemplateProcessingException
     {
         SAXReader reader = new SAXReader();
@@ -466,8 +475,12 @@
         return !found;
     }
 
-    private void processTemplates( File pomFile, String outputDirectory, Context context,
-                                   ArchetypeDescriptor descriptor, String packageName, Model
parentModel )
+    private void processTemplates( File pomFile,
+                                   String outputDirectory,
+                                   Context context,
+                                   ArchetypeDescriptor descriptor,
+                                   String packageName,
+                                   Model parentModel )
         throws ArchetypeTemplateProcessingException
     {
         if ( !pomFile.exists() )
@@ -723,14 +736,19 @@
         }
     }
 
-    private void processTemplate( String outputDirectory, Context context, String template,
-                                  TemplateDescriptor descriptor, boolean packageInFileName,
String packageName )
+    private void processTemplate( String outputDirectory,
+                                  Context context,
+                                  String template,
+                                  TemplateDescriptor descriptor,
+                                  boolean packageInFileName,
+                                  String packageName )
         throws ArchetypeTemplateProcessingException
     {
         processTemplate( outputDirectory, context, template, descriptor, packageInFileName,
packageName, null );
     }
 
-    private String getOutputDirectory( String outputDirectory, String testResourceDirectory
)
+    private String getOutputDirectory( String outputDirectory,
+                                       String testResourceDirectory )
     {
         return outputDirectory +
             ( testResourceDirectory.startsWith( "/" ) ? testResourceDirectory : "/" + testResourceDirectory
);
@@ -740,8 +758,11 @@
     //
     // ----------------------------------------------------------------------
 
-    protected void processSources( String outputDirectory, Context context, ArchetypeDescriptor
descriptor,
-                                   String packageName, String sourceDirectory )
+    protected void processSources( String outputDirectory,
+                                   Context context,
+                                   ArchetypeDescriptor descriptor,
+                                   String packageName,
+                                   String sourceDirectory )
         throws ArchetypeTemplateProcessingException
     {
         for ( Iterator i = descriptor.getSources().iterator(); i.hasNext(); )
@@ -753,8 +774,11 @@
         }
     }
 
-    protected void processTestSources( String outputDirectory, Context context, ArchetypeDescriptor
descriptor,
-                                       String packageName, String testSourceDirectory )
+    protected void processTestSources( String outputDirectory,
+                                       Context context,
+                                       ArchetypeDescriptor descriptor,
+                                       String packageName,
+                                       String testSourceDirectory )
         throws ArchetypeTemplateProcessingException
     {
         for ( Iterator i = descriptor.getTestSources().iterator(); i.hasNext(); )
@@ -766,7 +790,9 @@
         }
     }
 
-    protected void processResources( String outputDirectory, Context context, ArchetypeDescriptor
descriptor,
+    protected void processResources( String outputDirectory,
+                                     Context context,
+                                     ArchetypeDescriptor descriptor,
                                      String packageName )
         throws ArchetypeTemplateProcessingException
     {
@@ -779,7 +805,9 @@
         }
     }
 
-    protected void processTestResources( String outputDirectory, Context context, ArchetypeDescriptor
descriptor,
+    protected void processTestResources( String outputDirectory,
+                                         Context context,
+                                         ArchetypeDescriptor descriptor,
                                          String packageName )
         throws ArchetypeTemplateProcessingException
     {
@@ -792,7 +820,9 @@
         }
     }
 
-    protected void processSiteResources( String outputDirectory, Context context, ArchetypeDescriptor
descriptor,
+    protected void processSiteResources( String outputDirectory,
+                                         Context context,
+                                         ArchetypeDescriptor descriptor,
                                          String packageName )
         throws ArchetypeTemplateProcessingException
     {
@@ -805,8 +835,12 @@
         }
     }
 
-    protected void processTemplate( String outputDirectory, Context context, String template,
-                                    TemplateDescriptor descriptor, boolean packageInFileName,
String packageName,
+    protected void processTemplate( String outputDirectory,
+                                    Context context,
+                                    String template,
+                                    TemplateDescriptor descriptor,
+                                    boolean packageInFileName,
+                                    String packageName,
                                     String sourceDirectory )
         throws ArchetypeTemplateProcessingException
     {
@@ -909,7 +943,8 @@
     {
     }
 
-    private InputStream getStream( String name, ClassLoader loader )
+    private InputStream getStream( String name,
+                                   ClassLoader loader )
     {
         if ( loader == null )
         {

Modified: maven/archetype/trunk/maven-archetype/maven-archetype-creator/pom.xml
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/maven-archetype/maven-archetype-creator/pom.xml?view=diff&rev=475957&r1=475956&r2=475957
==============================================================================
--- maven/archetype/trunk/maven-archetype/maven-archetype-creator/pom.xml (original)
+++ maven/archetype/trunk/maven-archetype/maven-archetype-creator/pom.xml Thu Nov 16 14:46:52
2006
@@ -51,33 +51,10 @@
       <artifactId>plexus-archiver</artifactId>
       <version>1.0-alpha-5</version>
     </dependency>
-    <!--
-    <dependency>
-      <groupId>org.codehaus.swizzle</groupId>
-      <artifactId>swizzle</artifactId>
-      <version>1.0-SNAPSHOT</version>
-    </dependency>
-    -->
     <dependency>
       <groupId>oro</groupId>
       <artifactId>oro</artifactId>
       <version>2.0.8</version>
     </dependency>
   </dependencies>
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.codehaus.plexus</groupId>
-        <artifactId>plexus-maven-plugin</artifactId>
-        <version>1.1</version>
-        <executions>
-          <execution>
-            <goals>
-              <goal>descriptor</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
 </project>

Modified: maven/archetype/trunk/maven-archetype/pom.xml
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/maven-archetype/pom.xml?view=diff&rev=475957&r1=475956&r2=475957
==============================================================================
--- maven/archetype/trunk/maven-archetype/pom.xml (original)
+++ maven/archetype/trunk/maven-archetype/pom.xml Thu Nov 16 14:46:52 2006
@@ -29,6 +29,22 @@
       </dependency>      
     </dependencies>
   </dependencyManagement>
+  <build>                                                                         
                                                                  
+    <plugins>                                                                     
                                                                  
+      <plugin>                                                                    
                                                                  
+        <groupId>org.codehaus.plexus</groupId>                              
                                                                        
+        <artifactId>plexus-maven-plugin</artifactId>                        
                                                                        
+        <version>1.1</version>                                              
                                                                        
+        <executions>                                                              
                                                                  
+          <execution>                                                             
                                                                  
+            <goals>                                                               
                                                                  
+              <goal>descriptor</goal>                                       
                                                                        
+            </goals>                                                              
                                                                  
+          </execution>                                                            
                                                                  
+        </executions>                                                             
                                                                  
+      </plugin>                                                                   
                                                                  
+    </plugins>                                                                    
                                                                  
+  </build>       
   <modules>
     <module>maven-archetype-core</module>
     <module>maven-archetype-creator</module>    



Mime
View raw message