update to latest maven-artifact

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@169221 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-05-09 02:13:33 +00:00
parent 3dc7a5cc88
commit 954bc26584
3 changed files with 27 additions and 26 deletions

View File

@ -24,14 +24,11 @@
<artifactId>maven-artifact</artifactId> <artifactId>maven-artifact</artifactId>
<version>2.0-SNAPSHOT</version> <version>2.0-SNAPSHOT</version>
</dependency> </dependency>
<!--
<dependency> <dependency>
<groupId>org.apache.maven.wagon</groupId> <groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-http-lightweight</artifactId> <artifactId>wagon-file</artifactId>
<version>1.0-alpha-2</version> <version>1.0-alpha-2</version>
<type>jar</type> <scope>test</scope>
<scope>compile</scope>
</dependency> </dependency>
-->
</dependencies> </dependencies>
</model> </model>

View File

@ -16,6 +16,19 @@ package org.apache.maven.archetype;
* limitations under the License. * limitations under the License.
*/ */
import org.apache.maven.archetype.descriptor.ArchetypeDescriptor;
import org.apache.maven.archetype.descriptor.ArchetypeDescriptorBuilder;
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.ArtifactResolutionException;
import org.apache.maven.artifact.resolver.ArtifactResolver;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.context.Context;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.velocity.VelocityComponent;
import java.io.File; import java.io.File;
import java.io.FileWriter; import java.io.FileWriter;
import java.io.InputStream; import java.io.InputStream;
@ -27,20 +40,6 @@ import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.apache.maven.archetype.descriptor.ArchetypeDescriptor;
import org.apache.maven.archetype.descriptor.ArchetypeDescriptorBuilder;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.construction.ArtifactConstructionSupport;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
import org.apache.maven.artifact.resolver.ArtifactResolver;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.context.Context;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.velocity.VelocityComponent;
/** /**
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a> * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
* @version $Id$ * @version $Id$
@ -60,7 +59,7 @@ public class DefaultArchetype
// Implementation // Implementation
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
private ArtifactConstructionSupport artifactConstructionSupport = new ArtifactConstructionSupport(); private ArtifactFactory artifactFactory;
// groupId = maven // groupId = maven
// artifactId = maven-foo-archetype // artifactId = maven-foo-archetype
@ -74,8 +73,8 @@ public class DefaultArchetype
// Download the archetype // Download the archetype
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
Artifact archetypeArtifact = Artifact archetypeArtifact = artifactFactory.createArtifact( archetypeGroupId, archetypeArtifactId,
artifactConstructionSupport.createArtifact( archetypeGroupId, archetypeArtifactId, archetypeVersion, Artifact.SCOPE_RUNTIME, "jar" ); archetypeVersion, Artifact.SCOPE_RUNTIME, "jar" );
try try
{ {
@ -114,7 +113,8 @@ public class DefaultArchetype
if ( is == null ) if ( is == null )
{ {
throw new ArchetypeDescriptorException( "The " + ARCHETYPE_DESCRIPTOR + " descriptor cannot be found." ); throw new ArchetypeDescriptorException( "The " + ARCHETYPE_DESCRIPTOR +
" descriptor cannot be found." );
} }
descriptor = (ArchetypeDescriptor) builder.build( new InputStreamReader( is ) ); descriptor = (ArchetypeDescriptor) builder.build( new InputStreamReader( is ) );
@ -197,7 +197,8 @@ public class DefaultArchetype
} }
} }
protected void processTemplate( String outputDirectory, Context context, String template, boolean packageInFileName, String packageName ) protected void processTemplate( String outputDirectory, Context context, String template, boolean packageInFileName,
String packageName )
throws Exception throws Exception
{ {
File f; File f;

View File

@ -10,6 +10,9 @@
<requirement> <requirement>
<role>org.apache.maven.artifact.resolver.ArtifactResolver</role> <role>org.apache.maven.artifact.resolver.ArtifactResolver</role>
</requirement> </requirement>
<requirement>
<role>org.apache.maven.artifact.factory.ArtifactFactory</role>
</requirement>
</requirements> </requirements>
</component> </component>
</components> </components>