mirror of https://github.com/apache/maven.git
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:
parent
3dc7a5cc88
commit
954bc26584
|
@ -24,14 +24,11 @@
|
|||
<artifactId>maven-artifact</artifactId>
|
||||
<version>2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.wagon</groupId>
|
||||
<artifactId>wagon-http-lightweight</artifactId>
|
||||
<artifactId>wagon-file</artifactId>
|
||||
<version>1.0-alpha-2</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
-->
|
||||
</dependencies>
|
||||
</model>
|
||||
|
|
|
@ -16,6 +16,19 @@ package org.apache.maven.archetype;
|
|||
* 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.FileWriter;
|
||||
import java.io.InputStream;
|
||||
|
@ -27,20 +40,6 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
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>
|
||||
* @version $Id$
|
||||
|
@ -53,14 +52,14 @@ public class DefaultArchetype
|
|||
// ----------------------------------------------------------------------
|
||||
|
||||
private VelocityComponent velocity;
|
||||
|
||||
|
||||
private ArtifactResolver artifactResolver;
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
private ArtifactConstructionSupport artifactConstructionSupport = new ArtifactConstructionSupport();
|
||||
|
||||
private ArtifactFactory artifactFactory;
|
||||
|
||||
// groupId = maven
|
||||
// artifactId = maven-foo-archetype
|
||||
|
@ -74,8 +73,8 @@ public class DefaultArchetype
|
|||
// Download the archetype
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
Artifact archetypeArtifact =
|
||||
artifactConstructionSupport.createArtifact( archetypeGroupId, archetypeArtifactId, archetypeVersion, Artifact.SCOPE_RUNTIME, "jar" );
|
||||
Artifact archetypeArtifact = artifactFactory.createArtifact( archetypeGroupId, archetypeArtifactId,
|
||||
archetypeVersion, Artifact.SCOPE_RUNTIME, "jar" );
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -114,7 +113,8 @@ public class DefaultArchetype
|
|||
|
||||
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 ) );
|
||||
|
@ -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
|
||||
{
|
||||
File f;
|
||||
|
|
|
@ -10,6 +10,9 @@
|
|||
<requirement>
|
||||
<role>org.apache.maven.artifact.resolver.ArtifactResolver</role>
|
||||
</requirement>
|
||||
<requirement>
|
||||
<role>org.apache.maven.artifact.factory.ArtifactFactory</role>
|
||||
</requirement>
|
||||
</requirements>
|
||||
</component>
|
||||
</components>
|
||||
|
|
Loading…
Reference in New Issue