maven-m2-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tryg...@apache.org
Subject cvs commit: maven-components/maven-archetype/maven-archetype-plugin/src/main/java/org/apache/maven/plugin/archetype MavenArchetypePlugin.java
Date Thu, 06 Jan 2005 13:03:10 GMT
trygvis     2005/01/06 05:03:10

  Modified:    maven-archetype/maven-archetype-core/src/main/java/org/apache/maven/archetype
                        Archetype.java ArchetypeDescriptorException.java
                        ArchetypeNotFoundException.java
                        ArchetypeTemplateProcessingException.java
                        DefaultArchetype.java
               maven-archetype/maven-archetype-core/src/main/java/org/apache/maven/archetype/descriptor
                        ArchetypeDescriptor.java
                        ArchetypeDescriptorBuilder.java
                        ArchetypeDescriptorGenerator.java
               maven-archetype/maven-archetype-core/src/test/java/org/apache/maven/archetype
                        ArchetypeTest.java
               maven-archetype/maven-archetype-core/src/test/java/org/apache/maven/archetype/descriptor
                        ArchetypeDescriptorBuilderTest.java
               maven-archetype/maven-archetype-plugin/src/main/java/org/apache/maven/plugin/archetype
                        MavenArchetypePlugin.java
  Log:
  o Adding group id and version when creating a archetype.
  o Adding licenses.
  
  Revision  Changes    Path
  1.2       +20 -7     maven-components/maven-archetype/maven-archetype-core/src/main/java/org/apache/maven/archetype/Archetype.java
  
  Index: Archetype.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-archetype/maven-archetype-core/src/main/java/org/apache/maven/archetype/Archetype.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Archetype.java	29 Dec 2004 06:20:52 -0000	1.1
  +++ Archetype.java	6 Jan 2005 13:03:10 -0000	1.2
  @@ -1,13 +1,25 @@
  -/*
  - * Copyright (c) 2004 Your Corporation. All Rights Reserved.
  - */
   package org.apache.maven.archetype;
   
  -import org.apache.maven.artifact.repository.ArtifactRepository;
  +/*
  + * Copyright 2001-2004 The Apache Software Foundation.
  + *
  + * Licensed under the Apache License, Version 2.0 (the "License");
  + * you may not use this file except in compliance with the License.
  + * You may obtain a copy of the License at
  + *
  + *      http://www.apache.org/licenses/LICENSE-2.0
  + *
  + * Unless required by applicable law or agreed to in writing, software
  + * distributed under the License is distributed on an "AS IS" BASIS,
  + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  + * See the License for the specific language governing permissions and
  + * limitations under the License.
  + */
   
   import java.util.Map;
   import java.util.Set;
  -import java.io.File;
  +
  +import org.apache.maven.artifact.repository.ArtifactRepository;
   
   /**
    * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
  @@ -23,6 +35,7 @@
   
       String ARCHETYPE_POM = "pom.xml";
   
  -    void createArchetype( String archetypeId, ArtifactRepository localRepository, Set remoteRepositories,
Map parameters )
  +    void createArchetype( String archetypeGroupId, String archetypeArtifactId, String archetypeVersion,
  +                          ArtifactRepository localRepository, Set remoteRepositories, Map
parameters )
           throws ArchetypeNotFoundException, ArchetypeDescriptorException, ArchetypeTemplateProcessingException;
   }
  
  
  
  1.2       +16 -3     maven-components/maven-archetype/maven-archetype-core/src/main/java/org/apache/maven/archetype/ArchetypeDescriptorException.java
  
  Index: ArchetypeDescriptorException.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-archetype/maven-archetype-core/src/main/java/org/apache/maven/archetype/ArchetypeDescriptorException.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ArchetypeDescriptorException.java	29 Dec 2004 06:20:52 -0000	1.1
  +++ ArchetypeDescriptorException.java	6 Jan 2005 13:03:10 -0000	1.2
  @@ -1,7 +1,20 @@
  +package org.apache.maven.archetype;
  +
   /*
  - * Copyright (c) 2004 Your Corporation. All Rights Reserved.
  + * Copyright 2001-2004 The Apache Software Foundation.
  + *
  + * Licensed under the Apache License, Version 2.0 (the "License");
  + * you may not use this file except in compliance with the License.
  + * You may obtain a copy of the License at
  + *
  + *      http://www.apache.org/licenses/LICENSE-2.0
  + *
  + * Unless required by applicable law or agreed to in writing, software
  + * distributed under the License is distributed on an "AS IS" BASIS,
  + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  + * See the License for the specific language governing permissions and
  + * limitations under the License.
    */
  -package org.apache.maven.archetype;
   
   /**
    * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
  
  
  
  1.2       +16 -3     maven-components/maven-archetype/maven-archetype-core/src/main/java/org/apache/maven/archetype/ArchetypeNotFoundException.java
  
  Index: ArchetypeNotFoundException.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-archetype/maven-archetype-core/src/main/java/org/apache/maven/archetype/ArchetypeNotFoundException.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ArchetypeNotFoundException.java	29 Dec 2004 06:20:52 -0000	1.1
  +++ ArchetypeNotFoundException.java	6 Jan 2005 13:03:10 -0000	1.2
  @@ -1,7 +1,20 @@
  +package org.apache.maven.archetype;
  +
   /*
  - * Copyright (c) 2004 Your Corporation. All Rights Reserved.
  + * Copyright 2001-2004 The Apache Software Foundation.
  + *
  + * Licensed under the Apache License, Version 2.0 (the "License");
  + * you may not use this file except in compliance with the License.
  + * You may obtain a copy of the License at
  + *
  + *      http://www.apache.org/licenses/LICENSE-2.0
  + *
  + * Unless required by applicable law or agreed to in writing, software
  + * distributed under the License is distributed on an "AS IS" BASIS,
  + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  + * See the License for the specific language governing permissions and
  + * limitations under the License.
    */
  -package org.apache.maven.archetype;
   
   /**
    * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
  
  
  
  1.2       +16 -3     maven-components/maven-archetype/maven-archetype-core/src/main/java/org/apache/maven/archetype/ArchetypeTemplateProcessingException.java
  
  Index: ArchetypeTemplateProcessingException.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-archetype/maven-archetype-core/src/main/java/org/apache/maven/archetype/ArchetypeTemplateProcessingException.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ArchetypeTemplateProcessingException.java	29 Dec 2004 06:20:52 -0000	1.1
  +++ ArchetypeTemplateProcessingException.java	6 Jan 2005 13:03:10 -0000	1.2
  @@ -1,7 +1,20 @@
  +package org.apache.maven.archetype;
  +
   /*
  - * Copyright (c) 2004 Your Corporation. All Rights Reserved.
  + * Copyright 2001-2004 The Apache Software Foundation.
  + *
  + * Licensed under the Apache License, Version 2.0 (the "License");
  + * you may not use this file except in compliance with the License.
  + * You may obtain a copy of the License at
  + *
  + *      http://www.apache.org/licenses/LICENSE-2.0
  + *
  + * Unless required by applicable law or agreed to in writing, software
  + * distributed under the License is distributed on an "AS IS" BASIS,
  + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  + * See the License for the specific language governing permissions and
  + * limitations under the License.
    */
  -package org.apache.maven.archetype;
   
   /**
    * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
  
  
  
  1.2       +56 -22    maven-components/maven-archetype/maven-archetype-core/src/main/java/org/apache/maven/archetype/DefaultArchetype.java
  
  Index: DefaultArchetype.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-archetype/maven-archetype-core/src/main/java/org/apache/maven/archetype/DefaultArchetype.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultArchetype.java	29 Dec 2004 06:20:52 -0000	1.1
  +++ DefaultArchetype.java	6 Jan 2005 13:03:10 -0000	1.2
  @@ -1,27 +1,45 @@
   package org.apache.maven.archetype;
   
  -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.resolver.ArtifactResolver;
  -import org.apache.maven.artifact.manager.WagonManager;
  -import org.apache.maven.artifact.repository.ArtifactRepository;
  -import org.apache.velocity.VelocityContext;
  -import org.apache.velocity.context.Context;
  -import org.codehaus.plexus.util.FileUtils;
  -import org.codehaus.plexus.velocity.VelocityComponent;
  +/*
  + * Copyright 2001-2004 The Apache Software Foundation.
  + *
  + * Licensed under the Apache License, Version 2.0 (the "License");
  + * you may not use this file except in compliance with the License.
  + * You may obtain a copy of the License at
  + *
  + *      http://www.apache.org/licenses/LICENSE-2.0
  + *
  + * Unless required by applicable law or agreed to in writing, software
  + * distributed under the License is distributed on an "AS IS" BASIS,
  + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  + * See the License for the specific language governing permissions and
  + * limitations under the License.
  + */
   
   import java.io.File;
   import java.io.FileWriter;
   import java.io.InputStream;
   import java.io.InputStreamReader;
   import java.io.Writer;
  +import java.net.URL;
  +import java.net.URLClassLoader;
   import java.util.Iterator;
   import java.util.List;
   import java.util.Map;
   import java.util.Set;
  -import java.net.URLClassLoader;
  -import java.net.URL;
  +
  +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.manager.WagonManager;
  +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.velocity.VelocityComponent;
   
   /**
    * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
  @@ -48,20 +66,30 @@
       // artifactId = maven-foo-archetype
       // version = latest
   
  -    public void createArchetype( String archetypeId, ArtifactRepository localRepository,
Set remoteRepositories, Map parameters )
  +    public void createArchetype( String archetypeGroupId, String archetypeArtifactId, String
archetypeVersion,
  +                                 ArtifactRepository localRepository, Set remoteRepositories,
Map parameters )
           throws ArchetypeNotFoundException, ArchetypeDescriptorException, ArchetypeTemplateProcessingException
       {
  -        Artifact archetypeJar = wagonManager.createArtifact( "maven", "maven-archetype-"
+ archetypeId, "1.0-alpha-1-SNAPSHOT", "jar" );
  +        // ----------------------------------------------------------------------
  +        // Download the archetype
  +        // ----------------------------------------------------------------------
  +
  +        Artifact archetypeJar =
  +            wagonManager.createArtifact( archetypeGroupId, archetypeArtifactId, archetypeVersion,
"jar" );
   
           try
           {
               artifactResolver.resolve( archetypeJar, remoteRepositories, localRepository
);
           }
  -        catch ( Exception e )
  +        catch ( ArtifactResolutionException e )
           {
               throw new ArchetypeNotFoundException( "Cannot download archetype.", e );
           }
   
  +        // ----------------------------------------------------------------------
  +        //
  +        // ----------------------------------------------------------------------
  +
           String outputDirectory = (String) parameters.get( "outputDirectory" );
   
           String packageName = (String) parameters.get( "package" );
  @@ -109,25 +137,31 @@
               context.put( key, value );
           }
   
  -        try
  -        {
  -            ClassLoader old = Thread.currentThread().getContextClassLoader();
  +        ClassLoader old = Thread.currentThread().getContextClassLoader();
   
  -            Thread.currentThread().setContextClassLoader( archetypeJarLoader );
  +        Thread.currentThread().setContextClassLoader( archetypeJarLoader );
   
  +        try
  +        {
               processTemplate( outputDirectory, context, ARCHETYPE_POM, null );
   
               processSources( outputDirectory, context, descriptor.getSources(), packageName
);
   
               processSources( outputDirectory, context, descriptor.getTestSources(), packageName
);
  -
  -            Thread.currentThread().setContextClassLoader( old );
           }
           catch ( Exception e )
           {
               throw new ArchetypeTemplateProcessingException( "Error processing templates.",
e );
           }
  +        finally
  +        {
  +            Thread.currentThread().setContextClassLoader( old );
  +        }
       }
  +
  +    // ----------------------------------------------------------------------
  +    //
  +    // ----------------------------------------------------------------------
   
       protected void processSources( String outputDirectory, Context context, List sources,
String packageName )
           throws Exception
  
  
  
  1.2       +17 -1     maven-components/maven-archetype/maven-archetype-core/src/main/java/org/apache/maven/archetype/descriptor/ArchetypeDescriptor.java
  
  Index: ArchetypeDescriptor.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-archetype/maven-archetype-core/src/main/java/org/apache/maven/archetype/descriptor/ArchetypeDescriptor.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ArchetypeDescriptor.java	29 Dec 2004 06:20:52 -0000	1.1
  +++ ArchetypeDescriptor.java	6 Jan 2005 13:03:10 -0000	1.2
  @@ -1,5 +1,21 @@
   package org.apache.maven.archetype.descriptor;
   
  +/*
  + * Copyright 2001-2004 The Apache Software Foundation.
  + *
  + * Licensed under the Apache License, Version 2.0 (the "License");
  + * you may not use this file except in compliance with the License.
  + * You may obtain a copy of the License at
  + *
  + *      http://www.apache.org/licenses/LICENSE-2.0
  + *
  + * Unless required by applicable law or agreed to in writing, software
  + * distributed under the License is distributed on an "AS IS" BASIS,
  + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  + * See the License for the specific language governing permissions and
  + * limitations under the License.
  + */
  +
   import java.util.ArrayList;
   import java.util.List;
   
  @@ -21,7 +37,7 @@
   
           resources = new ArrayList();
   
  -        testSources = new ArrayList();        
  +        testSources = new ArrayList();
   
           testResources = new ArrayList();
       }
  
  
  
  1.2       +17 -1     maven-components/maven-archetype/maven-archetype-core/src/main/java/org/apache/maven/archetype/descriptor/ArchetypeDescriptorBuilder.java
  
  Index: ArchetypeDescriptorBuilder.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-archetype/maven-archetype-core/src/main/java/org/apache/maven/archetype/descriptor/ArchetypeDescriptorBuilder.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ArchetypeDescriptorBuilder.java	29 Dec 2004 06:20:52 -0000	1.1
  +++ ArchetypeDescriptorBuilder.java	6 Jan 2005 13:03:10 -0000	1.2
  @@ -1,5 +1,21 @@
   package org.apache.maven.archetype.descriptor;
   
  +/*
  + * Copyright 2001-2004 The Apache Software Foundation.
  + *
  + * Licensed under the Apache License, Version 2.0 (the "License");
  + * you may not use this file except in compliance with the License.
  + * You may obtain a copy of the License at
  + *
  + *      http://www.apache.org/licenses/LICENSE-2.0
  + *
  + * Unless required by applicable law or agreed to in writing, software
  + * distributed under the License is distributed on an "AS IS" BASIS,
  + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  + * See the License for the specific language governing permissions and
  + * limitations under the License.
  + */
  +
   import java.io.Reader;
   
   import org.codehaus.plexus.util.xml.Xpp3DomBuilder;
  
  
  
  1.2       +16 -3     maven-components/maven-archetype/maven-archetype-core/src/main/java/org/apache/maven/archetype/descriptor/ArchetypeDescriptorGenerator.java
  
  Index: ArchetypeDescriptorGenerator.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-archetype/maven-archetype-core/src/main/java/org/apache/maven/archetype/descriptor/ArchetypeDescriptorGenerator.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ArchetypeDescriptorGenerator.java	29 Dec 2004 06:20:52 -0000	1.1
  +++ ArchetypeDescriptorGenerator.java	6 Jan 2005 13:03:10 -0000	1.2
  @@ -1,7 +1,20 @@
  +package org.apache.maven.archetype.descriptor;
  +
   /*
  - * Copyright (c) 2004 Your Corporation. All Rights Reserved.
  + * Copyright 2001-2004 The Apache Software Foundation.
  + *
  + * Licensed under the Apache License, Version 2.0 (the "License");
  + * you may not use this file except in compliance with the License.
  + * You may obtain a copy of the License at
  + *
  + *      http://www.apache.org/licenses/LICENSE-2.0
  + *
  + * Unless required by applicable law or agreed to in writing, software
  + * distributed under the License is distributed on an "AS IS" BASIS,
  + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  + * See the License for the specific language governing permissions and
  + * limitations under the License.
    */
  -package org.apache.maven.archetype.descriptor;
   
   /**
    * Pass over the directory containing the sources of the archetype and create
  
  
  
  1.2       +21 -4     maven-components/maven-archetype/maven-archetype-core/src/test/java/org/apache/maven/archetype/ArchetypeTest.java
  
  Index: ArchetypeTest.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-archetype/maven-archetype-core/src/test/java/org/apache/maven/archetype/ArchetypeTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ArchetypeTest.java	29 Dec 2004 06:20:52 -0000	1.1
  +++ ArchetypeTest.java	6 Jan 2005 13:03:10 -0000	1.2
  @@ -1,5 +1,21 @@
   package org.apache.maven.archetype;
   
  +/*
  + * Copyright 2001-2004 The Apache Software Foundation.
  + *
  + * Licensed under the Apache License, Version 2.0 (the "License");
  + * you may not use this file except in compliance with the License.
  + * You may obtain a copy of the License at
  + *
  + *      http://www.apache.org/licenses/LICENSE-2.0
  + *
  + * Unless required by applicable law or agreed to in writing, software
  + * distributed under the License is distributed on an "AS IS" BASIS,
  + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  + * See the License for the specific language governing permissions and
  + * limitations under the License.
  + */
  +
   import org.codehaus.plexus.PlexusTestCase;
   import org.apache.maven.artifact.repository.ArtifactRepository;
   
  @@ -34,7 +50,7 @@
           parameters.put( "version", "1.0-alpha-1-SNAPSHOT" );
   
           parameters.put( "package", "org.apache.maven.quickstart" );
  -        
  +
           parameters.put( "outputDirectory",new File( getBasedir(), "target/archetype" ).getPath()
);
   
           // ----------------------------------------------------------------------
  @@ -45,7 +61,7 @@
   
           Properties mavenProperties = new Properties();
   
  -        mavenProperties.load( new FileInputStream( mavenPropertiesFile ) );           
    
  +        mavenProperties.load( new FileInputStream( mavenPropertiesFile ) );
   
           ArtifactRepository localRepository = new ArtifactRepository( "local", "file://"
+ mavenProperties.getProperty( "maven.repo.local" ) );
   
  @@ -55,6 +71,7 @@
   
           remoteRepositories.add( remoteRepository );
   
  -        archetype.createArchetype( "quickstart", localRepository, remoteRepositories, parameters);
  +        archetype.createArchetype( "maven", "maven-archetype-quickstart", "1.0-alpha-1-SNAPSHOT",
  +                                   localRepository, remoteRepositories, parameters);
       }
   }
  
  
  
  1.2       +17 -1     maven-components/maven-archetype/maven-archetype-core/src/test/java/org/apache/maven/archetype/descriptor/ArchetypeDescriptorBuilderTest.java
  
  Index: ArchetypeDescriptorBuilderTest.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-archetype/maven-archetype-core/src/test/java/org/apache/maven/archetype/descriptor/ArchetypeDescriptorBuilderTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ArchetypeDescriptorBuilderTest.java	29 Dec 2004 06:20:52 -0000	1.1
  +++ ArchetypeDescriptorBuilderTest.java	6 Jan 2005 13:03:10 -0000	1.2
  @@ -1,5 +1,21 @@
   package org.apache.maven.archetype.descriptor;
   
  +/*
  + * Copyright 2001-2004 The Apache Software Foundation.
  + *
  + * Licensed under the Apache License, Version 2.0 (the "License");
  + * you may not use this file except in compliance with the License.
  + * You may obtain a copy of the License at
  + *
  + *      http://www.apache.org/licenses/LICENSE-2.0
  + *
  + * Unless required by applicable law or agreed to in writing, software
  + * distributed under the License is distributed on an "AS IS" BASIS,
  + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  + * See the License for the specific language governing permissions and
  + * limitations under the License.
  + */
  +
   import junit.framework.TestCase;
   
   import java.io.StringReader;
  
  
  
  1.2       +54 -3     maven-components/maven-archetype/maven-archetype-plugin/src/main/java/org/apache/maven/plugin/archetype/MavenArchetypePlugin.java
  
  Index: MavenArchetypePlugin.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-archetype/maven-archetype-plugin/src/main/java/org/apache/maven/plugin/archetype/MavenArchetypePlugin.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MavenArchetypePlugin.java	29 Dec 2004 06:20:52 -0000	1.1
  +++ MavenArchetypePlugin.java	6 Jan 2005 13:03:10 -0000	1.2
  @@ -1,5 +1,21 @@
   package org.apache.maven.plugin.archetype;
   
  +/*
  + * Copyright 2001-2004 The Apache Software Foundation.
  + *
  + * Licensed under the Apache License, Version 2.0 (the "License");
  + * you may not use this file except in compliance with the License.
  + * You may obtain a copy of the License at
  + *
  + *      http://www.apache.org/licenses/LICENSE-2.0
  + *
  + * Unless required by applicable law or agreed to in writing, software
  + * distributed under the License is distributed on an "AS IS" BASIS,
  + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  + * See the License for the specific language governing permissions and
  + * limitations under the License.
  + */
  +
   import org.apache.maven.archetype.Archetype;
   import org.apache.maven.artifact.repository.ArtifactRepository;
   import org.apache.maven.plugin.AbstractPlugin;
  @@ -31,6 +47,33 @@
    *   description=""
    *
    * @parameter
  + *   name="archetypeGroupId"
  + *   type="String"
  + *   required="true"
  + *   validator=""
  + *   expression="#archetypeGroupId"
  + *   default="maven"
  + *   description=""
  + *
  + * @parameter
  + *   name="archetypeArtifactId"
  + *   type="String"
  + *   required="true"
  + *   validator=""
  + *   expression="#archetypeArtifactId"
  + *   default="maven"
  + *   description=""
  + *
  + * @parameter
  + *   name="archetypeVersion"
  + *   type="String"
  + *   required="true"
  + *   validator=""
  + *   expression="#archetypeVersion"
  + *   default="maven"
  + *   description=""
  + *
  + * @parameter
    *   name="groupId"
    *   type="String"
    *   required="true"
  @@ -73,7 +116,10 @@
           throws Exception
       {
           // ----------------------------------------------------------------------
  -        // archetypeId
  +        // archetypeGroupId
  +        // archetypeArtifactId
  +        // archetypeVersion
  +        //
           // localRepository
           // remoteRepository
           // parameters
  @@ -91,12 +137,17 @@
   
           remoteRepositories.add( remoteRepository );
   
  -        String archetypeId = (String) request.getParameter( "archetypeId" );
  +        String archetypeGroupId = (String) request.getParameter( "archetypeGroupId" );
  +
  +        String archetypeArtifactId = (String) request.getParameter( "archetypeArtifactId"
);
  +
  +        String archetypeVersion = (String) request.getParameter( "archetypeVersion" );
   
           Archetype archetype = (Archetype) request.getParameter( "archetype" );
   
           request.getParameters().put( "outputDirectory", System.getProperty( "user.dir"
) );
   
  -        archetype.createArchetype( "quickstart", localRepository, remoteRepositories, request.getParameters()
);
  +        archetype.createArchetype( archetypeGroupId, archetypeArtifactId, archetypeVersion,
  +                                   localRepository, remoteRepositories, request.getParameters()
);
       }
   }
  
  
  

Mime
View raw message