You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by br...@apache.org on 2007/08/29 04:43:59 UTC
svn commit: r570618 [13/14] - in /maven/sandbox/trunk/archetypeng: ./
archetype-common/ archetype-common/src/ archetype-common/src/main/
archetype-common/src/main/java/ archetype-common/src/main/java/org/
archetype-common/src/main/java/org/apache/ arch...
Added: maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/registry/AddGroupsMojo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/registry/AddGroupsMojo.java?rev=570618&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/registry/AddGroupsMojo.java (added)
+++ maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/registry/AddGroupsMojo.java Tue Aug 28 19:43:33 2007
@@ -0,0 +1,130 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.mojos.registry;
+
+import org.apache.maven.archetype.common.ArchetypeRegistryManager;
+import org.apache.maven.archetype.registry.ArchetypeRegistry;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+import org.codehaus.plexus.util.StringUtils;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * Adds one or more groups in the registry.
+ * The registered repositories are searched to find archetypes of registered groups.
+ * @author rafale
+ * @requiresProject false
+ * @goal add-groups
+ */
+public class AddGroupsMojo
+extends AbstractMojo
+{
+ /**
+ * @component
+ */
+ ArchetypeRegistryManager archetypeRegistryManager;
+
+ /**
+ * The group to add to the registry.
+ *
+ * This option is mutually exclusive with groups.
+ * @parameter expression="${group}"
+ */
+ String group;
+
+ /**
+ * The groups to add to the registry: group1,group2,....
+ *
+ * This option is mutually exclusive with group.
+ * @parameter expression="${groups}"
+ */
+ String groups;
+
+ /**
+ * The location of the registry file.
+ * @parameter expression="${user.home}/.m2/archetype.xml"
+ */
+ private File archetypeRegistryFile;
+
+ public void execute ()
+ throws MojoExecutionException, MojoFailureException
+ {
+ if ( StringUtils.isEmpty ( group ) && StringUtils.isEmpty ( groups ) )
+ {
+ throw new MojoFailureException ( "-Dgroup or -Dgroups must be set" );
+ }
+ else if ( StringUtils.isNotEmpty ( group ) && StringUtils.isNotEmpty ( groups ) )
+ {
+ throw new MojoFailureException ( "Only one of -Dgroup or -Dgroups can be set" );
+ }
+
+ try
+ {
+ List groupsToAdd = new ArrayList ();
+ if ( StringUtils.isNotEmpty ( group ) )
+ {
+ groupsToAdd.add ( group );
+ }
+ else
+ {
+ groupsToAdd.addAll ( Arrays.asList ( StringUtils.split ( groups, "," ) ) );
+ }
+
+ ArchetypeRegistry registry;
+ try
+ {
+ registry = archetypeRegistryManager.readArchetypeRegistry(archetypeRegistryFile);
+ }
+ catch (FileNotFoundException ex)
+ {
+ registry = archetypeRegistryManager.getDefaultArchetypeRegistry();
+ }
+
+ Iterator groupsToAddIterator = groupsToAdd.iterator ();
+ while ( groupsToAddIterator.hasNext () )
+ {
+ String groupToAdd = (String) groupsToAddIterator.next ();
+ if ( registry.getArchetypeGroups ().contains ( groupToAdd ) )
+ {
+ getLog ().debug ( "Group " + groupToAdd + " already exists" );
+ }
+ else
+ {
+ registry.addArchetypeGroup ( groupToAdd.trim () );
+ getLog ().debug ( "Group " + groupToAdd + " added" );
+ }
+ }
+ archetypeRegistryManager.writeArchetypeRegistry ( archetypeRegistryFile, registry );
+ }
+ catch ( Exception ex )
+ {
+ throw new MojoExecutionException ( ex.getMessage (), ex );
+ }
+ }
+}
Added: maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/registry/AddLanguagesMojo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/registry/AddLanguagesMojo.java?rev=570618&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/registry/AddLanguagesMojo.java (added)
+++ maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/registry/AddLanguagesMojo.java Tue Aug 28 19:43:33 2007
@@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.mojos.registry;
+
+import org.apache.maven.archetype.common.ArchetypeRegistryManager;
+import org.apache.maven.archetype.registry.ArchetypeRegistry;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+import org.codehaus.plexus.util.StringUtils;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * @author rafale
+ * @requiresProject false
+ * @goal add-languages
+ */
+public class AddLanguagesMojo
+extends AbstractMojo
+{
+ /**
+ * @component
+ */
+ ArchetypeRegistryManager archetypeRegistryManager;
+
+ /**
+ * @parameter expression="${language}"
+ */
+ String language;
+
+ /**
+ * @parameter expression="${languages}"
+ */
+ String languages;
+
+ /**
+ * @parameter expression="${user.home}/.m2/archetype.xml"
+ */
+ private File archetypeRegistryFile;
+
+ public void execute ()
+ throws MojoExecutionException, MojoFailureException
+ {
+ if ( StringUtils.isEmpty ( language ) && StringUtils.isEmpty ( languages ) )
+ {
+ throw new MojoFailureException ( "-Dlanguage or -Dlanguages must be set" );
+ }
+ else if ( StringUtils.isNotEmpty ( language ) && StringUtils.isNotEmpty ( languages ) )
+ {
+ throw new MojoFailureException ( "Only one of -Dlanguage or -Dlanguages can be set" );
+ }
+
+ try
+ {
+ List languagesToAdd = new ArrayList ();
+ if ( StringUtils.isNotEmpty ( language ) )
+ {
+ languagesToAdd.add ( language );
+ }
+ else
+ {
+ languagesToAdd.addAll ( Arrays.asList ( StringUtils.split ( languages, "," ) ) );
+ }
+
+ ArchetypeRegistry registry;
+ try
+ {
+ registry = archetypeRegistryManager.readArchetypeRegistry(archetypeRegistryFile);
+ }
+ catch (FileNotFoundException ex)
+ {
+ registry = archetypeRegistryManager.getDefaultArchetypeRegistry();
+ }
+
+ Iterator languagesToAddIterator = languagesToAdd.iterator ();
+ while ( languagesToAddIterator.hasNext () )
+ {
+ String languageToAdd = (String) languagesToAddIterator.next ();
+ if ( registry.getLanguages ().contains ( languageToAdd ) )
+ {
+ getLog ().debug ( "Language " + languageToAdd + " already exists" );
+ }
+ else
+ {
+ registry.addLanguage ( languageToAdd.trim () );
+ getLog ().debug ( "Language " + languageToAdd + " added" );
+ }
+ }
+ archetypeRegistryManager.writeArchetypeRegistry ( archetypeRegistryFile, registry );
+ }
+ catch ( Exception ex )
+ {
+ throw new MojoExecutionException ( ex.getMessage (), ex );
+ }
+ }
+}
Added: maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/registry/AddRepositoriesMojo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/registry/AddRepositoriesMojo.java?rev=570618&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/registry/AddRepositoriesMojo.java (added)
+++ maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/registry/AddRepositoriesMojo.java Tue Aug 28 19:43:33 2007
@@ -0,0 +1,169 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.mojos.registry;
+
+import org.apache.maven.archetype.common.ArchetypeRegistryManager;
+import org.apache.maven.archetype.registry.ArchetypeRegistry;
+import org.apache.maven.archetype.registry.ArchetypeRepository;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+import org.codehaus.plexus.util.StringUtils;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * Adds one or more repositories in the registry.
+ * The registered repositories are searched to find archetypes of registered groups.
+ * @author rafale
+ * @requiresProject false
+ * @goal add-repositories
+ */
+public class AddRepositoriesMojo
+extends AbstractMojo
+{
+ /**
+ * @component
+ */
+ ArchetypeRegistryManager archetypeRegistryManager;
+
+ /**
+ * The repositories to add to the registry: repo1Id=repo1Url,repo2Id=repo2Url,...
+ *
+ * This option is mutually exclusive with repositoryId and repositoryUrl.
+ * @parameter expression="${repositories}"
+ */
+ String repositories;
+
+ /**
+ * The Id of the repository to add to the registry.
+ *
+ * This option is mutually exclusive with repositories
+ * @parameter expression="${repositoryId}"
+ */
+ String repositoryId;
+
+ /**
+ * The URL of the repository to add to the registry.
+ *
+ * This option is mutually exclusive with repositories
+ * @parameter expression="${repositoryUrl}"
+ */
+ String repositoryUrl;
+
+ /**
+ * The location of the registry file.
+ * @parameter expression="${user.home}/.m2/archetype.xml"
+ */
+ private File archetypeRegistryFile;
+
+ public void execute ()
+ throws MojoExecutionException, MojoFailureException
+ {
+ if ( StringUtils.isEmpty ( repositoryId ) && StringUtils.isEmpty ( repositories ) )
+ {
+ throw new MojoFailureException (
+ " (-DrepositoryId and -DrepositoryUrl) or -Drepositories must be set"
+ );
+ }
+ else if (
+ StringUtils.isNotEmpty ( repositoryId )
+ && StringUtils.isNotEmpty ( repositories )
+ )
+ {
+ throw new MojoFailureException (
+ "Only one of (-DrepositoryId and -DrepositoryUrl) or -Drepositories can be set"
+ );
+ }
+
+ try
+ {
+ List repositoriesToAdd = new ArrayList ();
+ if ( StringUtils.isNotEmpty ( repositoryId )
+ && StringUtils.isNotEmpty ( repositoryUrl )
+ )
+ {
+ ArchetypeRepository repository = new ArchetypeRepository ();
+
+ repository.setId ( repositoryId );
+ repository.setUrl ( repositoryUrl );
+
+ repositoriesToAdd.add ( repository );
+ }
+ else
+ {
+ Iterator repositoriesDefinitions =
+ Arrays.asList ( StringUtils.split ( repositories, "," ) ).iterator ();
+ while ( repositoriesDefinitions.hasNext () )
+ {
+ String repositoryDefinition = (String) repositoriesDefinitions.next ();
+
+ String[] repositoryDefinitionParts =
+ StringUtils.split ( repositoryDefinition, "=" );
+
+ ArchetypeRepository repository = new ArchetypeRepository ();
+
+ repository.setId ( repositoryDefinitionParts[0] );
+ repository.setUrl ( repositoryDefinitionParts[1] );
+
+ repositoriesToAdd.add ( repository );
+ }
+ }
+
+ ArchetypeRegistry registry;
+ try
+ {
+ registry = archetypeRegistryManager.readArchetypeRegistry(archetypeRegistryFile);
+ }
+ catch (FileNotFoundException ex)
+ {
+ registry = archetypeRegistryManager.getDefaultArchetypeRegistry();
+ }
+
+ Iterator repositoriesToAddIterator = repositoriesToAdd.iterator ();
+ while ( repositoriesToAddIterator.hasNext () )
+ {
+ ArchetypeRepository repositoryToAdd =
+ (ArchetypeRepository) repositoriesToAddIterator.next ();
+ if ( registry.getArchetypeRepositories ().contains ( repositoryToAdd ) )
+ {
+ getLog ().debug ( "Repository " + repositoryToAdd + " already exists" );
+ }
+ else
+ {
+ registry.addArchetypeRepository ( repositoryToAdd );
+ getLog ().debug ( "Repository " + repositoryToAdd + " added" );
+ }
+ }
+ archetypeRegistryManager.writeArchetypeRegistry ( archetypeRegistryFile, registry );
+ }
+ catch ( Exception ex )
+ {
+ throw new MojoExecutionException ( ex.getMessage (), ex );
+ }
+ }
+}
Added: maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/registry/RemoveExtensionsMojo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/registry/RemoveExtensionsMojo.java?rev=570618&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/registry/RemoveExtensionsMojo.java (added)
+++ maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/registry/RemoveExtensionsMojo.java Tue Aug 28 19:43:33 2007
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.mojos.registry;
+
+import org.apache.maven.archetype.common.ArchetypeRegistryManager;
+import org.apache.maven.archetype.registry.ArchetypeRegistry;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+import org.codehaus.plexus.util.StringUtils;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * @author rafale
+ * @requiresProject false
+ * @goal remove-extensions
+ */
+public class RemoveExtensionsMojo
+extends AbstractMojo
+{
+ /**
+ * @component
+ */
+ ArchetypeRegistryManager archetypeRegistryManager;
+
+ /**
+ * @parameter expression="${extension}"
+ */
+ String extension;
+
+ /**
+ * @parameter expression="${extensions}"
+ */
+ String extensions;
+
+ /**
+ * @parameter expression="${user.home}/.m2/archetype.xml"
+ */
+ private File archetypeRegistryFile;
+
+ public void execute ()
+ throws MojoExecutionException, MojoFailureException
+ {
+ if ( StringUtils.isEmpty ( extension ) && StringUtils.isEmpty ( extensions ) )
+ {
+ throw new MojoFailureException ( "-Dextension or -Dextensions must be set" );
+ }
+ else if ( StringUtils.isNotEmpty ( extension ) && StringUtils.isNotEmpty ( extensions ) )
+ {
+ throw new MojoFailureException ( "Only one of -Dextension or -Dextensions can be set" );
+ }
+
+ try
+ {
+ List extensionsToRemove = new ArrayList ();
+ if ( StringUtils.isNotEmpty ( extension ) )
+ {
+ extensionsToRemove.add ( extension );
+ }
+ else
+ {
+ extensionsToRemove.addAll (
+ Arrays.asList ( StringUtils.split ( extensions, "," ) )
+ );
+ }
+
+ ArchetypeRegistry registry;
+ try
+ {
+ registry = archetypeRegistryManager.readArchetypeRegistry(archetypeRegistryFile);
+ }
+ catch (FileNotFoundException ex)
+ {
+ registry = archetypeRegistryManager.getDefaultArchetypeRegistry();
+ }
+
+ Iterator extensionsToRemoveIterator = extensionsToRemove.iterator ();
+ while ( extensionsToRemoveIterator.hasNext () )
+ {
+ String extensionToRemove = (String) extensionsToRemoveIterator.next ();
+ if ( registry.getFilteredExtensions ().contains ( extensionToRemove ) )
+ {
+ registry.removeFilteredExtension ( extensionToRemove );
+ getLog ().debug ( "Extension " + extensionToRemove + " removed" );
+ }
+ else
+ {
+ getLog ().debug ( "Extension " + extensionToRemove + " doesn't exist" );
+ }
+ }
+ archetypeRegistryManager.writeArchetypeRegistry ( archetypeRegistryFile, registry );
+ }
+ catch ( Exception ex )
+ {
+ throw new MojoExecutionException ( ex.getMessage (), ex );
+ }
+ }
+}
Added: maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/registry/RemoveGroupsMojo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/registry/RemoveGroupsMojo.java?rev=570618&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/registry/RemoveGroupsMojo.java (added)
+++ maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/registry/RemoveGroupsMojo.java Tue Aug 28 19:43:33 2007
@@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.mojos.registry;
+
+import org.apache.maven.archetype.common.ArchetypeRegistryManager;
+import org.apache.maven.archetype.registry.ArchetypeRegistry;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+import org.codehaus.plexus.util.StringUtils;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * @author rafale
+ * @requiresProject false
+ * @goal remove-groups
+ */
+public class RemoveGroupsMojo
+extends AbstractMojo
+{
+ /**
+ * @component
+ */
+ ArchetypeRegistryManager archetypeRegistryManager;
+
+ /**
+ * @parameter expression="${group}"
+ */
+ String group;
+
+ /**
+ * @parameter expression="${groups}"
+ */
+ String groups;
+
+ /**
+ * @parameter expression="${user.home}/.m2/archetype.xml"
+ */
+ private File archetypeRegistryFile;
+
+ public void execute ()
+ throws MojoExecutionException, MojoFailureException
+ {
+ if ( StringUtils.isEmpty ( group ) && StringUtils.isEmpty ( groups ) )
+ {
+ throw new MojoFailureException ( "-Dgroup or -Dgroups must be set" );
+ }
+ else if ( StringUtils.isNotEmpty ( group ) && StringUtils.isNotEmpty ( groups ) )
+ {
+ throw new MojoFailureException ( "Only one of -Dgroup or -Dgroups can be set" );
+ }
+
+ try
+ {
+ List groupsToRemove = new ArrayList ();
+ if ( StringUtils.isNotEmpty ( group ) )
+ {
+ groupsToRemove.add ( group );
+ }
+ else
+ {
+ groupsToRemove.addAll ( Arrays.asList ( StringUtils.split ( groups, "," ) ) );
+ }
+
+ ArchetypeRegistry registry;
+ try
+ {
+ registry = archetypeRegistryManager.readArchetypeRegistry(archetypeRegistryFile);
+ }
+ catch (FileNotFoundException ex)
+ {
+ registry = archetypeRegistryManager.getDefaultArchetypeRegistry();
+ }
+
+ Iterator groupsToRemoveIterator = groupsToRemove.iterator ();
+ while ( groupsToRemoveIterator.hasNext () )
+ {
+ String groupToRemove = (String) groupsToRemoveIterator.next ();
+ if ( registry.getArchetypeGroups ().contains ( groupToRemove ) )
+ {
+ registry.removeArchetypeGroup ( groupToRemove );
+ getLog ().debug ( "Group " + groupToRemove + " removed" );
+ }
+ else
+ {
+ getLog ().debug ( "Group " + groupToRemove + " doesn't exist" );
+ }
+ }
+ archetypeRegistryManager.writeArchetypeRegistry ( archetypeRegistryFile, registry );
+ }
+ catch ( Exception ex )
+ {
+ throw new MojoExecutionException ( ex.getMessage (), ex );
+ }
+ }
+}
Added: maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/registry/RemoveLanguagesMojo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/registry/RemoveLanguagesMojo.java?rev=570618&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/registry/RemoveLanguagesMojo.java (added)
+++ maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/registry/RemoveLanguagesMojo.java Tue Aug 28 19:43:33 2007
@@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.mojos.registry;
+
+import org.apache.maven.archetype.common.ArchetypeRegistryManager;
+import org.apache.maven.archetype.registry.ArchetypeRegistry;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+import org.codehaus.plexus.util.StringUtils;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * @author rafale
+ * @requiresProject false
+ * @goal remove-languages
+ */
+public class RemoveLanguagesMojo
+extends AbstractMojo
+{
+ /**
+ * @component
+ */
+ ArchetypeRegistryManager archetypeRegistryManager;
+
+ /**
+ * @parameter expression="${language}"
+ */
+ String language;
+
+ /**
+ * @parameter expression="${languages}"
+ */
+ String languages;
+
+ /**
+ * @parameter expression="${user.home}/.m2/archetype.xml"
+ */
+ private File archetypeRegistryFile;
+
+ public void execute ()
+ throws MojoExecutionException, MojoFailureException
+ {
+ if ( StringUtils.isEmpty ( language ) && StringUtils.isEmpty ( languages ) )
+ {
+ throw new MojoFailureException ( "-Dlanguage or -Dlanguages must be set" );
+ }
+ else if ( StringUtils.isNotEmpty ( language ) && StringUtils.isNotEmpty ( languages ) )
+ {
+ throw new MojoFailureException ( "Only one of -Dlanguage or -Dlanguages can be set" );
+ }
+
+ try
+ {
+ List languagesToRemove = new ArrayList ();
+ if ( StringUtils.isNotEmpty ( language ) )
+ {
+ languagesToRemove.add ( language );
+ }
+ else
+ {
+ languagesToRemove.addAll ( Arrays.asList ( StringUtils.split ( languages, "," ) ) );
+ }
+
+ ArchetypeRegistry registry;
+ try
+ {
+ registry = archetypeRegistryManager.readArchetypeRegistry(archetypeRegistryFile);
+ }
+ catch (FileNotFoundException ex)
+ {
+ registry = archetypeRegistryManager.getDefaultArchetypeRegistry();
+ }
+
+ Iterator languagesToRemoveIterator = languagesToRemove.iterator ();
+ while ( languagesToRemoveIterator.hasNext () )
+ {
+ String languageToRemove = (String) languagesToRemoveIterator.next ();
+ if ( registry.getLanguages ().contains ( languageToRemove ) )
+ {
+ registry.removeLanguage ( languageToRemove );
+ getLog ().debug ( "Language " + languageToRemove + " removed" );
+ }
+ else
+ {
+ getLog ().debug ( "Language " + languageToRemove + " doesn't exist" );
+ }
+ }
+ archetypeRegistryManager.writeArchetypeRegistry ( archetypeRegistryFile, registry );
+ }
+ catch ( Exception ex )
+ {
+ throw new MojoExecutionException ( ex.getMessage (), ex );
+ }
+ }
+}
Added: maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/registry/RemoveRepositoriesMojo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/registry/RemoveRepositoriesMojo.java?rev=570618&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/registry/RemoveRepositoriesMojo.java (added)
+++ maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/registry/RemoveRepositoriesMojo.java Tue Aug 28 19:43:33 2007
@@ -0,0 +1,147 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.mojos.registry;
+
+import org.apache.maven.archetype.common.ArchetypeRegistryManager;
+import org.apache.maven.archetype.registry.ArchetypeRegistry;
+import org.apache.maven.archetype.registry.ArchetypeRepository;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+import org.codehaus.plexus.util.StringUtils;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * @author rafale
+ * @requiresProject false
+ * @goal remove-repositories
+ */
+public class RemoveRepositoriesMojo
+extends AbstractMojo
+{
+ /**
+ * @component
+ */
+ ArchetypeRegistryManager archetypeRegistryManager;
+
+ /**
+ * @parameter expression="${repositories}"
+ */
+ String repositories;
+
+ /**
+ * @parameter expression="${repositoryId}"
+ */
+ String repositoryId;
+
+ /**
+ * @parameter expression="${user.home}/.m2/archetype.xml"
+ */
+ private File archetypeRegistryFile;
+
+ public void execute ()
+ throws MojoExecutionException, MojoFailureException
+ {
+ if ( StringUtils.isEmpty ( repositoryId ) && StringUtils.isEmpty ( repositories ) )
+ {
+ throw new MojoFailureException ( " -DrepositoryId or -Drepositories must be set" );
+ }
+ else if (
+ StringUtils.isNotEmpty ( repositoryId )
+ && StringUtils.isNotEmpty ( repositories )
+ )
+ {
+ throw new MojoFailureException (
+ "Only one of -DrepositoryId or -Drepositories can be set"
+ );
+ }
+
+ try
+ {
+ List repositoriesToRemove = new ArrayList ();
+ if ( StringUtils.isNotEmpty ( repositoryId ) )
+ {
+ ArchetypeRepository repository = new ArchetypeRepository ();
+
+ repository.setId ( repositoryId );
+ repository.setUrl ( "EMPTY" );
+
+ repositoriesToRemove.add ( repository );
+ }
+ else
+ {
+ Iterator repositoriesDefinitions =
+ Arrays.asList ( StringUtils.split ( repositories, "," ) ).iterator ();
+ while ( repositoriesDefinitions.hasNext () )
+ {
+ String repositoryDefinition = (String) repositoriesDefinitions.next ();
+
+ ArchetypeRepository repository = new ArchetypeRepository ();
+
+ repository.setId ( repositoryDefinition );
+ repository.setUrl ( "EMPTY" );
+
+ repositoriesToRemove.add ( repository );
+ }
+ }
+
+ ArchetypeRegistry registry;
+ try
+ {
+ registry = archetypeRegistryManager.readArchetypeRegistry(archetypeRegistryFile);
+ }
+ catch (FileNotFoundException ex)
+ {
+ registry = archetypeRegistryManager.getDefaultArchetypeRegistry();
+ }
+
+ Iterator repositoriesToRemoveIterator = repositoriesToRemove.iterator ();
+ while ( repositoriesToRemoveIterator.hasNext () )
+ {
+ ArchetypeRepository repositoryToRemove =
+ (ArchetypeRepository) repositoriesToRemoveIterator.next ();
+ if ( registry.getArchetypeRepositories ().contains ( repositoryToRemove ) )
+ {
+ registry.removeArchetypeRepository ( repositoryToRemove );
+ getLog ().debug ( "Repository " + repositoryToRemove.getId () + " removed" );
+ }
+ else
+ {
+ getLog ().debug (
+ "Repository " + repositoryToRemove.getId () + " doesn't exist"
+ );
+ }
+ }
+ archetypeRegistryManager.writeArchetypeRegistry ( archetypeRegistryFile, registry );
+ }
+ catch ( Exception ex )
+ {
+ throw new MojoExecutionException ( ex.getMessage (), ex );
+ }
+ }
+}
Added: maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/registry/ShowExtensionsMojo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/registry/ShowExtensionsMojo.java?rev=570618&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/registry/ShowExtensionsMojo.java (added)
+++ maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/registry/ShowExtensionsMojo.java Tue Aug 28 19:43:33 2007
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.mojos.registry;
+
+import org.apache.maven.archetype.common.ArchetypeRegistryManager;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+
+import java.util.Iterator;
+import org.apache.maven.archetype.registry.ArchetypeRegistry;
+
+/**
+ * @author rafale
+ * @requiresProject false
+ * @goal show-extensions
+ */
+public class ShowExtensionsMojo
+extends AbstractMojo
+{
+ /**
+ * @component
+ */
+ ArchetypeRegistryManager archetypeRegistryManager;
+
+ /**
+ * @parameter expression="${user.home}/.m2/archetype.xml"
+ */
+ private File archetypeRegistryFile;
+
+ public void execute ()
+ throws MojoExecutionException, MojoFailureException
+ {
+ try
+ {
+ ArchetypeRegistry registry;
+ try
+ {
+ registry = archetypeRegistryManager.readArchetypeRegistry(archetypeRegistryFile);
+ }
+ catch (FileNotFoundException ex)
+ {
+ registry = archetypeRegistryManager.getDefaultArchetypeRegistry();
+ }
+
+ Iterator extensions = registry.getFilteredExtensions ().iterator ();
+
+ getLog ().info ( "Filtered extensions defined in " + archetypeRegistryFile );
+ while ( extensions.hasNext () )
+ {
+ getLog ().info ( " - " + extensions.next () );
+ }
+ }
+ catch ( Exception ex )
+ {
+ throw new MojoExecutionException ( ex.getMessage (), ex );
+ }
+ }
+}
Added: maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/registry/ShowGroupsMojo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/registry/ShowGroupsMojo.java?rev=570618&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/registry/ShowGroupsMojo.java (added)
+++ maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/registry/ShowGroupsMojo.java Tue Aug 28 19:43:33 2007
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.mojos.registry;
+
+import org.apache.maven.archetype.common.ArchetypeRegistryManager;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+
+import java.util.Iterator;
+import org.apache.maven.archetype.registry.ArchetypeRegistry;
+
+/**
+ * Show the registered groups.
+ * @author rafale
+ * @requiresProject false
+ * @goal show-groups
+ */
+public class ShowGroupsMojo
+extends AbstractMojo
+{
+ /**
+ * @component
+ */
+ ArchetypeRegistryManager archetypeRegistryManager;
+
+ /**
+ * The location of the registry file.
+ * @parameter expression="${user.home}/.m2/archetype.xml"
+ */
+ private File archetypeRegistryFile;
+
+ public void execute ()
+ throws MojoExecutionException, MojoFailureException
+ {
+ try
+ {
+ ArchetypeRegistry registry;
+ try
+ {
+ registry = archetypeRegistryManager.readArchetypeRegistry(archetypeRegistryFile);
+ }
+ catch (FileNotFoundException ex)
+ {
+ registry = archetypeRegistryManager.getDefaultArchetypeRegistry();
+ }
+
+ Iterator groups = registry.getArchetypeGroups ().iterator ();
+
+ getLog ().info ( "Archetype groups defined in " + archetypeRegistryFile );
+ while ( groups.hasNext () )
+ {
+ getLog ().info ( " - " + groups.next () );
+ }
+ }
+ catch ( Exception ex )
+ {
+ throw new MojoExecutionException ( ex.getMessage (), ex );
+ }
+ }
+}
Added: maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/registry/ShowLanguagesMojo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/registry/ShowLanguagesMojo.java?rev=570618&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/registry/ShowLanguagesMojo.java (added)
+++ maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/registry/ShowLanguagesMojo.java Tue Aug 28 19:43:33 2007
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.mojos.registry;
+
+import org.apache.maven.archetype.common.ArchetypeRegistryManager;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+
+import java.util.Iterator;
+import org.apache.maven.archetype.registry.ArchetypeRegistry;
+
+/**
+ * @author rafale
+ * @requiresProject false
+ * @goal show-languages
+ */
+public class ShowLanguagesMojo
+extends AbstractMojo
+{
+ /**
+ * @component
+ */
+ ArchetypeRegistryManager archetypeRegistryManager;
+
+ /**
+ * @parameter expression="${user.home}/.m2/archetype.xml"
+ */
+ private File archetypeRegistryFile;
+
+ public void execute ()
+ throws MojoExecutionException, MojoFailureException
+ {
+ try
+ {
+ ArchetypeRegistry registry;
+ try
+ {
+ registry = archetypeRegistryManager.readArchetypeRegistry(archetypeRegistryFile);
+ }
+ catch (FileNotFoundException ex)
+ {
+ registry = archetypeRegistryManager.getDefaultArchetypeRegistry();
+ }
+
+ Iterator languages = registry.getLanguages ().iterator ();
+
+ getLog ().info ( "Languages defined in " + archetypeRegistryFile );
+ while ( languages.hasNext () )
+ {
+ getLog ().info ( " - " + languages.next () );
+ }
+ }
+ catch ( Exception ex )
+ {
+ throw new MojoExecutionException ( ex.getMessage (), ex );
+ }
+ }
+}
Added: maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/registry/ShowRepositoriesMojo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/registry/ShowRepositoriesMojo.java?rev=570618&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/registry/ShowRepositoriesMojo.java (added)
+++ maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/registry/ShowRepositoriesMojo.java Tue Aug 28 19:43:33 2007
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.mojos.registry;
+
+import org.apache.maven.archetype.common.ArchetypeRegistryManager;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+
+import java.util.Iterator;
+import org.apache.maven.archetype.registry.ArchetypeRegistry;
+
+/**
+ * Show the registered repositories.
+ * @author rafale
+ * @requiresProject false
+ * @goal show-repositories
+ */
+public class ShowRepositoriesMojo
+extends AbstractMojo
+{
+ /**
+ * @component
+ */
+ ArchetypeRegistryManager archetypeRegistryManager;
+
+ /**
+ * The location of the registry file.
+ * @parameter expression="${user.home}/.m2/archetype.xml"
+ */
+ private File archetypeRegistryFile;
+
+ public void execute ()
+ throws MojoExecutionException, MojoFailureException
+ {
+ try
+ {
+ ArchetypeRegistry registry;
+ try
+ {
+ registry = archetypeRegistryManager.readArchetypeRegistry(archetypeRegistryFile);
+ }
+ catch (FileNotFoundException ex)
+ {
+ registry = archetypeRegistryManager.getDefaultArchetypeRegistry();
+ }
+
+ Iterator repositories = registry.getArchetypeRepositories ().iterator ();
+
+ getLog ().info ( "Archetype repositories defined in " + archetypeRegistryFile );
+ while ( repositories.hasNext () )
+ {
+ getLog ().info ( " - " + repositories.next () );
+ }
+ }
+ catch ( Exception ex )
+ {
+ throw new MojoExecutionException ( ex.getMessage (), ex );
+ }
+ }
+}
Added: maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/resources/META-INF/maven/lifecycle.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/resources/META-INF/maven/lifecycle.xml?rev=570618&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/resources/META-INF/maven/lifecycle.xml (added)
+++ maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/resources/META-INF/maven/lifecycle.xml Tue Aug 28 19:43:33 2007
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you 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.
+-->
+<lifecycles>
+ <lifecycle>
+ <id>generate</id>
+ <phases>
+ <phase>
+ <id>validate</id>
+ <executions>
+ <execution>
+ <goals>
+ <goal>select-archetype</goal>
+ </goals>
+ </execution>
+ </executions>
+ </phase>
+ <phase>
+ <id>initialize</id>
+ <executions>
+ <execution>
+ <goals>
+ <goal>configure-generation</goal>
+ </goals>
+ </execution>
+ </executions>
+ </phase>
+ <phase>
+ <id>generate-sources</id>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate-project</goal>
+ </goals>
+ </execution>
+ </executions>
+ </phase>
+ <phase>
+ <id>verify</id>
+ <executions>
+ <execution>
+ <goals>
+ <goal>clean</goal>
+ </goals>
+ </execution>
+ </executions>
+ </phase>
+ </phases>
+ </lifecycle>
+ <lifecycle>
+ <id>create</id>
+ <phases>
+ <phase>
+ <id>initialize</id>
+ <executions>
+ <execution>
+ <goals>
+ <goal>configure-creation</goal>
+ </goals>
+ </execution>
+ </executions>
+ </phase>
+ <phase>
+ <id>generate-sources</id>
+ <executions>
+ <execution>
+ <goals>
+ <goal>create-archetype</goal>
+ </goals>
+ </execution>
+ </executions>
+ </phase>
+ <!--phase>
+ <id>package</id>
+ <executions>
+ <execution>
+ <goals>
+ <goal>package-archetype</goal>
+ </goals>
+ </execution>
+ </executions>
+ </phase-->
+ <phase>
+ <id>verify</id>
+ <executions>
+ <execution>
+ <goals>
+ <goal>clean</goal>
+ </goals>
+ </execution>
+ </executions>
+ </phase>
+ </phases>
+ </lifecycle>
+ <lifecycle>
+ <id>maven-archetype</id>
+ <phases>
+ <phase>
+ <id>initialize</id>
+ <executions>
+ <execution>
+ <goals>
+ <goal>clean</goal>
+ </goals>
+ </execution>
+ </executions>
+ </phase>
+ </phases>
+ </lifecycle>
+</lifecycles>
Added: maven/sandbox/trunk/archetypeng/archetype-registry/pom.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-registry/pom.xml?rev=570618&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-registry/pom.xml (added)
+++ maven/sandbox/trunk/archetypeng/archetype-registry/pom.xml Tue Aug 28 19:43:33 2007
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you 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.
+-->
+<project
+ xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.maven.archetype</groupId>
+ <artifactId>maven-archetype</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>archetype-registry</artifactId>
+
+ <name>Maven ArchetypeNG Archetype Registry</name>
+ <packaging>jar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-utils</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.modello</groupId>
+ <artifactId>modello-maven-plugin</artifactId>
+ <version>1.0-alpha-14</version>
+
+ <executions>
+ <execution>
+ <id>archetype-registry</id>
+ <goals>
+ <goal>xpp3-writer</goal>
+ <goal>java</goal>
+ <goal>xpp3-reader</goal>
+ <goal>xsd</goal>
+ </goals>
+ <configuration>
+ <version>1.0.0</version>
+ <model>src/main/mdo/archetype-registry.mdo</model>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: maven/sandbox/trunk/archetypeng/archetype-registry/src/main/mdo/archetype-registry.mdo
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-registry/src/main/mdo/archetype-registry.mdo?rev=570618&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-registry/src/main/mdo/archetype-registry.mdo (added)
+++ maven/sandbox/trunk/archetypeng/archetype-registry/src/main/mdo/archetype-registry.mdo Tue Aug 28 19:43:33 2007
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you 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.
+-->
+<model>
+ <id>archetype-registry</id>
+ <name>ArchetypeRegistry</name>
+
+ <defaults>
+ <default>
+ <key>package</key>
+ <value>org.apache.maven.archetype.registry</value>
+ </default>
+ </defaults>
+
+ <classes>
+ <class rootElement="true" xml.tagName="archetype-registry" >
+ <name>ArchetypeRegistry</name>
+ <fields>
+ <field>
+ <name>ArchetypeGroups</name>
+ <association>
+ <type>String</type>
+ <multiplicity>*</multiplicity>
+ </association>
+ </field>
+ <field>
+ <name>ArchetypeRepositories</name>
+ <association>
+ <type>ArchetypeRepository</type>
+ <multiplicity>*</multiplicity>
+ </association>
+ </field>
+ <field>
+ <name>Languages</name>
+ <association>
+ <type>String</type>
+ <multiplicity>*</multiplicity>
+ </association>
+ </field>
+ <field>
+ <name>FilteredExtensions</name>
+ <association>
+ <type>String</type>
+ <multiplicity>*</multiplicity>
+ </association>
+ </field>
+ </fields>
+ </class>
+
+ <class>
+ <name>ArchetypeRepository</name>
+ <fields>
+ <field xml.attribute="true" >
+ <name>id</name>
+ <type>String</type>
+ <required>true</required>
+ </field>
+ <field>
+ <name>url</name>
+ <type>String</type>
+ <required>true</required>
+ </field>
+ </fields>
+ <codeSegments>
+ <codeSegment>
+ <code><![CDATA[
+ public String toString ()
+ {
+ return getId () + " (" + getUrl () + ")";
+
+ }
+
+ public int hashCode ()
+ {
+ return getId ().hashCode ();
+ }
+
+ public boolean equals (Object other)
+ {
+ if ( other == null ||
+ !(other instanceof ArchetypeRepository ) )
+ {
+ return false;
+ }
+
+ return getId ().equals ( ((ArchetypeRepository) other).getId () );
+ }
+ ]]></code>
+ </codeSegment>
+ </codeSegments>
+ </class>
+ </classes>
+</model>
Added: maven/sandbox/trunk/archetypeng/pom.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/pom.xml?rev=570618&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/pom.xml (added)
+++ maven/sandbox/trunk/archetypeng/pom.xml Tue Aug 28 19:43:33 2007
@@ -0,0 +1,356 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you 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.
+-->
+<project
+ xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-parent</artifactId>
+ <version>5</version>
+ <relativePath>../pom/maven/pom.xml</relativePath>
+ </parent>
+
+ <groupId>org.apache.maven.archetype</groupId>
+ <!--TODO: move to org.codehaus.mojo -->
+ <artifactId>maven-archetype</artifactId>
+ <version>1.0-SNAPSHOT</version>
+
+ <name>Maven ArchetypeNG</name>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>archetype-descriptor</module>
+ <module>archetype-registry</module>
+ <module>archetype-common</module>
+ <module>archetype-generator</module>
+ <module>archetype-creator</module>
+ <module>archetype-plugin</module>
+ <module>archetype-packaging</module>
+ </modules>
+
+ <licenses>
+ <license>
+ <name>The Apache Software License, Version 2.0</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ <issueManagement>
+ <system>jira</system>
+ <url>http://jira.codehaus.org/browse/ARCHETYPE</url>
+ </issueManagement>
+ <inceptionYear>2007</inceptionYear>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.archetype</groupId>
+ <artifactId>archetype-descriptor</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.archetype</groupId>
+ <artifactId>archetype-registry</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.archetype</groupId>
+ <artifactId>archetype-generator</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.archetype</groupId>
+ <artifactId>marchetype-creator</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.archetype</groupId>
+ <artifactId>archetype-common</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>2.0.7</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-artifact</artifactId>
+ <version>2.0.7</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-artifact-manager</artifactId>
+ <version>2.0.7</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-model</artifactId>
+ <version>2.0.7</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-project</artifactId>
+ <version>2.0.7</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-archiver</artifactId>
+ <version>2.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-repository-metadata</artifactId>
+ <version>2.0.7</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-descriptor</artifactId>
+ <version>2.0.7</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.archetype</groupId>
+ <artifactId>maven-archetype-core</artifactId>
+ <version>1.0-alpha-4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-utils</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-container-default</artifactId>
+ <version>1.0-alpha-9</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-interactivity-api</artifactId>
+ <version>1.0-alpha-4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-core</artifactId>
+ <version>2.0.7</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.shared</groupId>
+ <artifactId>maven-downloader</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-velocity</artifactId>
+ <version>1.1.3</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>1.3.1</version>
+ </dependency>
+ <dependency>
+ <groupId>dom4j</groupId>
+ <artifactId>dom4j</artifactId>
+ <version>1.6.1</version>
+ </dependency>
+ <dependency>
+ <groupId>jdom</groupId>
+ <artifactId>jdom</artifactId>
+ <version>1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>velocity</groupId>
+ <artifactId>velocity</artifactId>
+ <version>1.4</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sourceforge.jchardet</groupId>
+ <artifactId>jchardet</artifactId>
+ <version>1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.shared</groupId>
+ <artifactId>maven-plugin-testing-harness</artifactId>
+ <version>1.0-beta-1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-report-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <reportSets>
+ <reportSet></reportSet>
+ </reportSets>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-pmd-plugin</artifactId>
+ <reportSets>
+ <reportSet></reportSet>
+ </reportSets>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>cobertura-maven-plugin</artifactId>
+ <reportSets>
+ <reportSet></reportSet>
+ </reportSets>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jxr-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <links>
+ <link>http://java.sun.com/j2ee/1.4/docs/api</link>
+ <link>http://java.sun.com/j2se/1.5.0/docs/api</link>
+ <link>http://jakarta.apache.org/commons/collections/apidocs-COLLECTIONS_3_0/</link>
+ <link>http://jakarta.apache.org/commons/dbcp/apidocs/</link>
+ <link>http://jakarta.apache.org/commons/fileupload/apidocs/</link>
+ <link>http://jakarta.apache.org/commons/httpclient/apidocs/</link>
+ <link>http://jakarta.apache.org/commons/logging/apidocs/</link>
+ <link>http://jakarta.apache.org/commons/pool/apidocs/</link>
+ <link>http://www.junit.org/junit/javadoc/</link>
+ <link>http://logging.apache.org/log4j/docs/api/</link>
+ <link>http://jakarta.apache.org/regexp/apidocs/</link>
+ <link>http://jakarta.apache.org/velocity/api/</link>
+ </links>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>taglist-maven-plugin</artifactId>
+ <reportSets>
+ <reportSet></reportSet>
+ </reportSets>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-plugin-plugin</artifactId>
+ <reportSets>
+ <reportSet></reportSet>
+ </reportSets>
+ </plugin>
+ </plugins>
+ </reporting>
+
+ <profiles>
+ <profile>
+ <id>rafale-jalopy</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>triemax</groupId>
+ <artifactId>jalopy-maven</artifactId>
+ <version>1.8-144</version>
+ <configuration>
+ <javadoc>false</javadoc>
+ <logLevel>warn</logLevel>
+ <profile>default</profile>
+ <convention>file:///home/users/rafale/projects/RafaleCodeConvention.xml</convention>
+ <includes>
+ <include>**/*.java</include>
+ </includes>
+ <excludes>
+ <exclude>**/testdata/**</exclude>
+ </excludes>
+ <environment>
+ </environment>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>process-classes</phase>
+ <goals>
+ <goal>format</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <!--
+ You will need to install the runtime jar to compile
+ mvn install:install-file
+ -DgroupId=com.sun -DartifactId=rt -Dversion=1.4.2
+ -Dpackaging=jar -Dfile=/usr/local/j2sdk1.4.2_12/jre/lib/rt.jar
+ -->
+ <configuration>
+ <source>1.4</source>
+ <target>1.4</target>
+ <!--
+ <compilerArguments>
+ <bootclasspath>
+ ${settings.localRepository}/com/sun/rt/1.4.2/rt-1.4.2.jar
+ </bootclasspath>
+ </compilerArguments>
+ -->
+ </configuration>
+ <!--
+ <dependencies>
+ <dependency>
+ <groupId>com.sun</groupId>
+ <artifactId>rt</artifactId>
+ <version>1.4.2</version>
+ </dependency>
+ </dependencies>
+ -->
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-maven-plugin</artifactId>
+ <version>1.3.3</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>descriptor</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: maven/sandbox/trunk/archetypeng/src/site/apt/archetype-handcraft.apt
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/src/site/apt/archetype-handcraft.apt?rev=570618&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/src/site/apt/archetype-handcraft.apt (added)
+++ maven/sandbox/trunk/archetypeng/src/site/apt/archetype-handcraft.apt Tue Aug 28 19:43:33 2007
@@ -0,0 +1,328 @@
+ -----
+ Archetypeng - Archetype handcraft
+ -----
+ The Maven Team
+ -----
+
+Handcrafting archetype
+
+* Archetype
+
+ An archetype is a kind of Maven 2 project which defines its packaging to
+ maven-plugin and which follow a particular directory convention.
+
++--
+|-- pom.xml
+`-- src
+ `-- main
+ `-- resources
+ |-- META-INF
+ | `-- maven
+ | `-- archetype.xml
+ `-- archetype-resources
+ |-- pom.xml
+ `-- src ...
++--
+
+ There is two kind of archetypes: partial or complete. Complete archetypes
+ are used to generate new Maven 2 project, a class library for example.
+ Partial archetypes are used to add a new functionality to a project's build,
+ the use of the modello plugin for example.
+
+ An archetype defines at least 3 files in its tree.
+
+ * The archetype pom is located at the root of the project.
+ It defines the archetype's groupId, artifactId, version and name.
+
+ The name and version of the archetype are used during the selection step
+ of the generation.
+
+ Here is an example of archetype pom.
+
++--
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+ <groupId>org.codehaus.mojo.archetypeng.test</groupId>
+ <artifactId>test-start-archetype</artifactId>
+ <packaging>maven-plugin</packaging>
+ <version>1.0-SNAPSHOT</version>
+</project>
++--
+
+ * The archetype descriptor is located in the src/main/resources/META-INF/maven
+ directory and named archetype.xml.
+
+ The descriptor defines the kind of archetype (complete or partial),
+ the archetype properties and the templates.
+
+ Here is an example of archetype descriptor.
+
++--
+<?xml version="1.0" encoding="UTF-8"?>
+<archetype>
+ <name>test-start-archetype</name>
+ <site-group />
+ <required-properties>
+ <required-property>
+ <key>aProperty</key>
+ <default-value>String searched in the sources</default-value>
+ </required-property>
+ </required-properties>
+ <sources-groups>
+ <sources-group>
+ <language>java</language>
+ <templates>
+ <template>App.java</template>
+ </templates>
+ </sources-group>
+ </sources-groups>
+ <test-sources-groups>
+ <test-sources-group>
+ <language>java</language>
+ <templates>
+ <template>AppTest.java</template>
+ </templates>
+ </test-sources-group>
+ </test-sources-groups>
+</archetype>
++--
+
+ * The templates are located in the src/main/resources/archetype-resources
+ directory which is the templates root directory.
+
+ There must be at least one template named pom.xml located at the root of
+ the template directory. This is the generated project's pom.
+
+ The other templates are the sources, resources and site templates.
+
+
+* The descriptor explained
+
+ The archetype descriptor leads the project generation by defining each of
+ the properties used for the template merge. It also defines each of the
+ templates which will be merged with the configured properties to generate
+ the sources of the generated project.
+
+ The archetype.xml file contains the following elements :
+
+ * name: The name of the archetype.
+
++--
+<archetype>
+...
+ <name>test-start-archetype</name>
+...
+</archetype>
++--
+
+ * partial: If the archetype is complete or partial. It is set to true if the
+ archetype is partial. It can be omited and defaults to a complete archetype.
+
++--
+<archetype>
+...
+ <partial>true</partial>
+...
+</archetype>
++--
+
+ * required-properties: The list of the required properties.
+
+ Here is a required property named propertyWithDefaultValue defining a
+ default value containing "the default value". During generation of the
+ archetype, when a template contains this property, it will be replaced by
+ the default value unless it is overrided.
+
++--
+<archetype>
+...
+ <required-properties>
+ ...
+ <required-property>
+ <key>propertyWithDefaultValue</key>
+ <default-value>the default value</default-value>
+ </required-property>
+ ...
+ </required-properties>
+...
+</archetype>
++--
+
+ The default-value element can be omited and that property must be set
+ during the configuration step of the generation.
+
+ The required-properties can be omited if the archetype defines no required
+ properties.
+
+ Archetypes always define four common required properties without defaut
+ values. These common properties are: groupId, artifactId, version and
+ package. The groupId, artifactId and version will be the ones of the
+ generated project. The package will be used in the sources templates.
+
+ All the properties (common and archetype specific) are velocity
+ properties. The properties must be named without a dot, because velocity
+ uses the dot for getting inner properties. See in the
+ {{{http://velocity.apache.org/engine/releases/velocity-1.5/vtl-reference-guide.html}VTL}}
+ guide for more information.
+
+ * sources-groups: The list of the sources templates grouped by language.
+
+ The sources-groups can be omited if the archetype don't have sources.
+
+ Here the extract of the descriptor for a sources group for the c language.
+ The templates of this group uses the ISO-8859-1 encoding. And it also
+ contains one template file named App.c.
+
++--
+<archetype>
+...
+ <sources-groups>
+ ...
+ <sources-group>
+ <language>c</language>
+ <encoding>ISO-8859-1</encoding>
+ <templates>
+ ...
+ <template>App.c</template>
+ ...
+ </templates>
+ </sources-group>
+ ...
+ </sources-groups>
+...
+</archetype>
++--
+
+ A sources-group must define at least one template.
+
+ The language can be omited to default to java.
+
+ The encoding can be omited to default to UTF-8.
+
+ The sources templates files must be located in the directory
+ src/main/{language} from the templates directory.
+
+ A template can be defined in a subdirectory like subfolder/AlternateApp.c.
+
+ The sources files are generated in the with the same name of the template
+ file name. They are generated from the generated project's root directory
+ in the directory src/main/{language}/{package as subdirectories}/{template defined sudirectory}.
+
+ Having the same name as templates, allow to have some xml or properties
+ files generated using the package as subdirectory replacement.
+
+ * test-sources-groups: The list of the test sources templates grouped by
+ language.
+
+ Test sources groups works the same as the sources groups but differ in
+ that the templates must be located in src/test/{language} from the
+ templates directory and the project's files are generated to
+ src/test/{language}/{package as subdirectories}/{template defined sudirectory}.
+
++--
+<archetype>
+...
+ <test-sources-groups>
+ ...
+ <test-sources-group>
+ <templates>
+ ...
+ <template>AppTest.java</template>
+ ...
+ </templates>
+ </test-sources-group>
+ ...
+ </test-sources-groups>
+...
+</archetype>
++--
+
+ * resources-groups: The list of resources templates grouped by directory.
+
+ The resources-groups can be omited if the archetype don't have resources.
+
+ Here the extract of the descriptor for a resources group for the mdo
+ directory.
+ The templates of this group uses the default UTF-8 encoding.
+
++--
+<archetype>
+...
+ <resources-groups>
+ ...
+ <resources-group>
+ <directory>mdo</directory>
+ <templates>
+ ...
+ <template>App.mdo</template>
+ ...
+ </templates>
+ </resources-group>
+ ...
+ </resources-groups>
+...
+</archetype>
++--
+
+ A resources-group must define at least one template.
+
+ The directory can be omited to default to <resources>.
+
+ The encoding can be omited to default to UTF-8.
+
+ The resources templates files must be located in the directory
+ src/main/{directory} from the templates directory.
+
+ A template can be defined in a subdirectory like subfolder/logging.properties.
+
+ The resources files are generated in the with the same name of the template
+ file name. They are generated from the generated project's root directory
+ in the directory src/main/{directory}/{template defined sudirectory}.
+
+ * test-resources-groups: The list of the test resources templates grouped by
+ directory.
+
+ Test resources groups works the same as the resources groups but differ in
+ that the templates must be located in src/test/{directory} from the
+ templates directory and the project's files are generated to
+ src/test/{directory}/{template defined sudirectory}.
+
++--
+<archetype>
+...
+ <test-resources-groups>
+ ...
+ <test-resources-group>
+ <templates>
+ ...
+ <template>AppTest.properties</template>
+ ...
+ </templates>
+ </test-resources-group>
+ ...
+ </test-resources-groups>
+...
+</archetype>
++--
+
+ * site-group: The list of site templates.
+
+ Site group works the same as the resources groups but differ in that the
+ templates must be located in src/site from the templates directory, that
+ they dont have a directory and the project's files are generated to
+ src/site/{template defined sudirectory}.
+
++--
+<archetype>
+...
+ <site-group>
+ <templates>
+ ...
+ <template>site.xml</template>
+ <template>apt/test.apt</template>
+ ...
+ </templates>
+ </site-group>
+...
+</archetype>
++--