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 [12/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-generator/src/test/resources/projects/generate-9/archetype.properties.sample
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-generator/src/test/resources/projects/generate-9/archetype.properties.sample?rev=570618&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-generator/src/test/resources/projects/generate-9/archetype.properties.sample (added)
+++ maven/sandbox/trunk/archetypeng/archetype-generator/src/test/resources/projects/generate-9/archetype.properties.sample Tue Aug 28 19:43:33 2007
@@ -0,0 +1,17 @@
+#
+#Tue Jan 23 23:34:16 CET 2007
+archetype.groupId=archetypes
+archetype.artifactId=partial
+archetype.version=1.0
+groupId=file-value
+artifactId=file-value
+version=file-value
+package=file.value.package
+property-without-default-1=file-value
+property-without-default-2=file-value
+property-without-default-3=file-value
+property-without-default-4=file-value
+property-with-default-1=file-value
+property-with-default-2=file-value
+property-with-default-3=file-value
+property-with-default-4=file-value

Added: maven/sandbox/trunk/archetypeng/archetype-generator/src/test/resources/projects/generate-9/file-value/pom.xml.sample
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-generator/src/test/resources/projects/generate-9/file-value/pom.xml.sample?rev=570618&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-generator/src/test/resources/projects/generate-9/file-value/pom.xml.sample (added)
+++ maven/sandbox/trunk/archetypeng/archetype-generator/src/test/resources/projects/generate-9/file-value/pom.xml.sample Tue Aug 28 19:43:33 2007
@@ -0,0 +1,68 @@
+<?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>test-generate-9-parent</artifactId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.apache.maven.archetype</groupId>
+    <artifactId>file-value</artifactId>
+    <version>1.0-SNAPSHOT</version>
+
+    <name>Maven ArchetypeNG Test Generate 9</name>
+    <packaging>jar</packaging>
+
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.maven</groupId>
+            <artifactId>maven-model</artifactId>
+            <version>1.0</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+            <version>1.0</version>
+            </plugin>
+        </plugins>
+    </build>
+
+    <reporting>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-info-reports-plugin</artifactId>
+            <version>1.0</version>
+            </plugin>
+        </plugins>
+    </reporting>
+</project>

Added: maven/sandbox/trunk/archetypeng/archetype-generator/src/test/resources/projects/generate-9/pom.xml.sample
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-generator/src/test/resources/projects/generate-9/pom.xml.sample?rev=570618&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-generator/src/test/resources/projects/generate-9/pom.xml.sample (added)
+++ maven/sandbox/trunk/archetypeng/archetype-generator/src/test/resources/projects/generate-9/pom.xml.sample Tue Aug 28 19:43:33 2007
@@ -0,0 +1,34 @@
+<?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>
+
+    <groupId>org.apache.maven.archetype</groupId>
+    <artifactId>test-generate-9-parent</artifactId>
+    <version>1.0-SNAPSHOT</version>
+
+    <name>Maven ArchetypeNG Test Generate 9 parent</name>
+    <packaging>pom</packaging>
+
+</project>

Added: maven/sandbox/trunk/archetypeng/archetype-generator/src/test/resources/projects/select-1/dummy
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-generator/src/test/resources/projects/select-1/dummy?rev=570618&view=auto
==============================================================================
    (empty)

Added: maven/sandbox/trunk/archetypeng/archetype-generator/src/test/resources/projects/select-10/archetype.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-generator/src/test/resources/projects/select-10/archetype.xml?rev=570618&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-generator/src/test/resources/projects/select-10/archetype.xml (added)
+++ maven/sandbox/trunk/archetypeng/archetype-generator/src/test/resources/projects/select-10/archetype.xml Tue Aug 28 19:43:33 2007
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?><archetype-registry>
+  <ArchetypeGroups>
+    <ArchetypeGroup>dont.exists.1</ArchetypeGroup>
+    <ArchetypeGroup>dont.exists.2</ArchetypeGroup>
+    <ArchetypeGroup>dont.exists.3</ArchetypeGroup>
+  </ArchetypeGroups>
+</archetype-registry>
\ No newline at end of file

Added: maven/sandbox/trunk/archetypeng/archetype-generator/src/test/resources/projects/select-2/archetype.properties.sample
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-generator/src/test/resources/projects/select-2/archetype.properties.sample?rev=570618&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-generator/src/test/resources/projects/select-2/archetype.properties.sample (added)
+++ maven/sandbox/trunk/archetypeng/archetype-generator/src/test/resources/projects/select-2/archetype.properties.sample Tue Aug 28 19:43:33 2007
@@ -0,0 +1,3 @@
+archetype.groupId=archetypes
+archetype.artifactId=basic
+archetype.version=1.0

Added: maven/sandbox/trunk/archetypeng/archetype-generator/src/test/resources/projects/select-3/dummy
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-generator/src/test/resources/projects/select-3/dummy?rev=570618&view=auto
==============================================================================
    (empty)

Added: maven/sandbox/trunk/archetypeng/archetype-generator/src/test/resources/projects/select-4/archetype.properties.sample
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-generator/src/test/resources/projects/select-4/archetype.properties.sample?rev=570618&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-generator/src/test/resources/projects/select-4/archetype.properties.sample (added)
+++ maven/sandbox/trunk/archetypeng/archetype-generator/src/test/resources/projects/select-4/archetype.properties.sample Tue Aug 28 19:43:33 2007
@@ -0,0 +1,3 @@
+archetype.groupId=archetypes
+archetype.artifactId=basic
+archetype.version=1.0

Added: maven/sandbox/trunk/archetypeng/archetype-generator/src/test/resources/projects/select-5/archetype.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-generator/src/test/resources/projects/select-5/archetype.xml?rev=570618&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-generator/src/test/resources/projects/select-5/archetype.xml (added)
+++ maven/sandbox/trunk/archetypeng/archetype-generator/src/test/resources/projects/select-5/archetype.xml Tue Aug 28 19:43:33 2007
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?><archetype-registry>
+  <ArchetypeGroups>
+    <ArchetypeGroup>dont.exists</ArchetypeGroup>
+    <ArchetypeGroup>archetypes</ArchetypeGroup>
+  </ArchetypeGroups>
+</archetype-registry>
\ No newline at end of file

Added: maven/sandbox/trunk/archetypeng/archetype-generator/src/test/resources/projects/select-6/dummy
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-generator/src/test/resources/projects/select-6/dummy?rev=570618&view=auto
==============================================================================
    (empty)

Added: maven/sandbox/trunk/archetypeng/archetype-generator/src/test/resources/projects/select-7/archetype.properties.sample
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-generator/src/test/resources/projects/select-7/archetype.properties.sample?rev=570618&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-generator/src/test/resources/projects/select-7/archetype.properties.sample (added)
+++ maven/sandbox/trunk/archetypeng/archetype-generator/src/test/resources/projects/select-7/archetype.properties.sample Tue Aug 28 19:43:33 2007
@@ -0,0 +1,3 @@
+archetype.groupId=archetypes
+archetype.artifactId=dont-exist
+archetype.version=1.0

Added: maven/sandbox/trunk/archetypeng/archetype-generator/src/test/resources/projects/select-8/archetype.properties.sample
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-generator/src/test/resources/projects/select-8/archetype.properties.sample?rev=570618&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-generator/src/test/resources/projects/select-8/archetype.properties.sample (added)
+++ maven/sandbox/trunk/archetypeng/archetype-generator/src/test/resources/projects/select-8/archetype.properties.sample Tue Aug 28 19:43:33 2007
@@ -0,0 +1,2 @@
+archetype.groupId=archetypes
+archetype.artifactId=basic

Added: maven/sandbox/trunk/archetypeng/archetype-generator/src/test/resources/projects/select-9/archetype.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-generator/src/test/resources/projects/select-9/archetype.xml?rev=570618&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-generator/src/test/resources/projects/select-9/archetype.xml (added)
+++ maven/sandbox/trunk/archetypeng/archetype-generator/src/test/resources/projects/select-9/archetype.xml Tue Aug 28 19:43:33 2007
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?><archetype-registry>
+  <ArchetypeGroups>
+    <ArchetypeGroup>dont.exists</ArchetypeGroup>
+    <ArchetypeGroup>archetypes</ArchetypeGroup>
+  </ArchetypeGroups>
+</archetype-registry>
\ No newline at end of file

Added: maven/sandbox/trunk/archetypeng/archetype-generator/src/test/resources/repositories/central/dummy
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-generator/src/test/resources/repositories/central/dummy?rev=570618&view=auto
==============================================================================
    (empty)

Added: maven/sandbox/trunk/archetypeng/archetype-generator/src/test/resources/repositories/local/dummy
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-generator/src/test/resources/repositories/local/dummy?rev=570618&view=auto
==============================================================================
    (empty)

Added: maven/sandbox/trunk/archetypeng/archetype-packaging/pom.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-packaging/pom.xml?rev=570618&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-packaging/pom.xml (added)
+++ maven/sandbox/trunk/archetypeng/archetype-packaging/pom.xml Tue Aug 28 19:43:33 2007
@@ -0,0 +1,38 @@
+<?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>archetypeng-packaging</artifactId>
+    <version>1.0-SNAPSHOT</version>
+
+    <name>Maven ArchetypeNG Packaging</name>
+
+</project>

Added: maven/sandbox/trunk/archetypeng/archetype-packaging/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-packaging/src/main/resources/META-INF/plexus/components.xml?rev=570618&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-packaging/src/main/resources/META-INF/plexus/components.xml (added)
+++ maven/sandbox/trunk/archetypeng/archetype-packaging/src/main/resources/META-INF/plexus/components.xml Tue Aug 28 19:43:33 2007
@@ -0,0 +1,32 @@
+<component-set>
+    <components>
+        <component>
+            <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
+            <role-hint>maven-archetype</role-hint>
+            <implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
+            <configuration>
+                <phases>
+                    <process-resources>org.apache.maven.plugins:maven-resources-plugin:resources</process-resources>
+                    <process-test-resources>org.apache.maven.plugins:maven-resources-plugin:testResources</process-test-resources>
+                    <package>org.apache.maven.plugins:maven-archetypeng-plugin:jar,
+                             org.apache.maven.plugins:maven-archetypeng-plugin:add-archetype-metadata</package><!--, AND METADATA LIKE MAVEN PLUGIN-->
+                    <integration-test>org.apache.maven.plugins:maven-archetypeng-plugin:integration-test</integration-test>
+                    <install>org.apache.maven.plugins:maven-install-plugin:install</install>
+                    <deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy>
+                </phases>
+            </configuration>
+        </component>
+
+        <component>
+            <role>org.apache.maven.artifact.handler.ArtifactHandler</role>
+            <role-hint>maven-archetype</role-hint>
+            <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
+            <configuration>
+                <type>maven-archetype</type>
+                <extension>jar</extension>
+                <packaging>maven-archetype</packaging>
+            </configuration>
+        </component>
+
+    </components>
+</component-set>

Added: maven/sandbox/trunk/archetypeng/archetype-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-plugin/pom.xml?rev=570618&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-plugin/pom.xml (added)
+++ maven/sandbox/trunk/archetypeng/archetype-plugin/pom.xml Tue Aug 28 19:43:33 2007
@@ -0,0 +1,108 @@
+<?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>
+
+    <groupId>org.apache.maven.plugins</groupId>
+    <!-- TODO: The purpose is to call mvn archetypeng:*
+               w/out the need to add a plugin group in settings -->
+    <artifactId>maven-archetypeng-plugin</artifactId>
+    <version>1.0-SNAPSHOT</version>
+
+    <name>Maven ArchetypeNG Plugin</name>
+    <packaging>maven-plugin</packaging>
+
+    <dependencies>
+        <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-settings</artifactId>
+            <version>2.0.7</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-archiver</artifactId>
+            <version>2.2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.maven.archetype</groupId>
+            <artifactId>archetype-common</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>archetype-creator</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-plugin-plugin</artifactId>
+                <configuration>
+                    <goalPrefix>archetypeng</goalPrefix>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+    <reporting>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-plugin-plugin</artifactId>
+                <version>2.2</version>
+                <reportSets>
+                    <reportSet>
+                        <reports>
+                            <report>report</report>
+                        </reports>
+                    </reportSet>
+                </reportSets>
+            </plugin>
+        </plugins>
+    </reporting>
+</project>

Added: maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/AddArchetypeMetadataMojo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/AddArchetypeMetadataMojo.java?rev=570618&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/AddArchetypeMetadataMojo.java (added)
+++ maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/AddArchetypeMetadataMojo.java Tue Aug 28 19:43:33 2007
@@ -0,0 +1,111 @@
+/*
+ * 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;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata;
+import org.apache.maven.artifact.repository.metadata.GroupRepositoryMetadata;
+import org.apache.maven.artifact.repository.metadata.Versioning;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+//import org.apache.maven.plugin.descriptor.PluginDescriptor;
+import org.apache.maven.project.MavenProject;
+
+/**
+ * Inject any plugin-specific artifact metadata to the project's artifact, for subsequent
+ * installation and deployment. The first use-case for this is to add the LATEST metadata (which is
+ * plugin-specific) for shipping alongside the plugin's artifact.
+ *
+ * @phase  package
+ * @goal   add-archetype-metadata
+ */
+public class AddArchetypeMetadataMojo
+extends AbstractMojo
+{
+    /**
+     * The prefix for the plugin goal.
+     *
+     * @parameter
+     */
+    private String goalPrefix;
+
+    /**
+     * The project artifact, which should have the LATEST metadata added to it.
+     *
+     * @parameter  expression="${project}"
+     * @required
+     * @readonly
+     */
+    private MavenProject project;
+
+    public void execute ()
+    throws MojoExecutionException
+    {
+        Artifact projectArtifact = project.getArtifact ();
+
+        Versioning versioning = new Versioning ();
+        versioning.setLatest ( projectArtifact.getVersion () );
+        versioning.updateTimestamp ();
+
+        ArtifactRepositoryMetadata metadata =
+            new ArtifactRepositoryMetadata ( projectArtifact, versioning );
+        projectArtifact.addMetadata ( metadata );
+
+        GroupRepositoryMetadata groupMetadata =
+            new GroupRepositoryMetadata ( project.getGroupId () );
+        groupMetadata.addPluginMapping (
+            getGoalPrefix (),
+            project.getArtifactId (),
+            project.getName ()
+        );
+
+        projectArtifact.addMetadata ( groupMetadata );
+    }
+
+    private String getGoalPrefix ()
+    {
+        if ( goalPrefix == null )
+        {
+//            goalPrefix = PluginDescriptor.getGoalPrefixFromArtifactId( project.getArtifactId() );
+            goalPrefix = "archetypeng";
+        }
+
+        return goalPrefix;
+    }
+}

Added: maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CleanMojo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CleanMojo.java?rev=570618&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CleanMojo.java (added)
+++ maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CleanMojo.java Tue Aug 28 19:43:33 2007
@@ -0,0 +1,47 @@
+/*
+ * 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;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+import java.io.File;
+
+/**
+ * @author           rafale
+ * @description      Clean archetype properties file.
+ * @requiresProject  false
+ * @goal             clean
+ */
+public class CleanMojo
+extends AbstractMojo
+{
+    /**
+     * @parameter  default-value="archetype.properties" expression="${archetype.properties}"
+     */
+    private File propertyFile;
+
+    public void execute ()
+    throws MojoExecutionException, MojoFailureException
+    {
+        propertyFile.delete ();
+    }
+}

Added: maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/ConfigureCreationMojo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/ConfigureCreationMojo.java?rev=570618&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/ConfigureCreationMojo.java (added)
+++ maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/ConfigureCreationMojo.java Tue Aug 28 19:43:33 2007
@@ -0,0 +1,109 @@
+/*
+ * 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;
+
+import org.apache.maven.archetype.common.ArchetypeRegistryManager;
+import org.apache.maven.archetype.creator.ArchetypeCreationConfigurator;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.settings.Settings;
+
+import java.io.File;
+
+import java.util.List;
+
+/**
+ * @author           rafale
+ * @description      Configure archetype's creation properties.
+ * @requiresProject  true
+ * @goal             configure-creation
+ */
+public class ConfigureCreationMojo
+extends AbstractMojo
+{
+    /**
+     * @component
+     */
+    ArchetypeRegistryManager archetypeRegistryManager;
+    /**
+     * @component
+     */
+    ArchetypeCreationConfigurator configurator;
+
+    /**
+     * @parameter  expression="${archetype.languages}"
+     */
+    private String archetypeLanguages;
+
+    /**
+     * @parameter  expression="${user.home}/.m2/archetype.xml"
+     */
+    private File archetypeRegistryFile;
+
+    /**
+     * @parameter  expression="${interactive}" default-value="false"
+     */
+    private boolean interactive;
+
+    /**
+     * @parameter  expression="${project}"
+     * @required
+     * @readonly
+     */
+    private MavenProject project;
+
+    /**
+     * @parameter  default-value="archetype.properties" expression="${archetype.properties}"
+     */
+    private File propertyFile = null;
+
+    /**
+     * @parameter  expression="${settings}"
+     * @required
+     * @readonly
+     */
+    private Settings settings;
+
+    public void execute ()
+    throws MojoExecutionException, MojoFailureException
+    {
+        try
+        {
+            List languages =
+                archetypeRegistryManager.getLanguages ( archetypeLanguages, archetypeRegistryFile );
+
+            configurator.configureArchetypeCreation (
+                project,
+                new Boolean ( interactive ),
+//                settings.getInteractiveMode (),
+                System.getProperties (),
+                propertyFile,
+                languages
+            );
+            getLog ().info ( "Archetype created in target/generated-sources/archetypeng" );
+        }
+        catch ( Exception ex )
+        {
+            throw new MojoExecutionException ( ex.getMessage (), ex );
+        }
+    }
+}

Added: maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/ConfigureGenerationMojo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/ConfigureGenerationMojo.java?rev=570618&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/ConfigureGenerationMojo.java (added)
+++ maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/ConfigureGenerationMojo.java Tue Aug 28 19:43:33 2007
@@ -0,0 +1,117 @@
+/*
+ * 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;
+
+import org.apache.maven.archetype.common.ArchetypeRegistryManager;
+import org.apache.maven.archetype.generator.ArchetypeGenerationConfigurator;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.settings.Settings;
+
+import java.io.File;
+
+import java.util.List;
+
+/**
+ * @author           rafale
+ * @description      Configure archetype's properties.
+ * @requiresProject  false
+ * @goal             configure-generation
+ */
+public class ConfigureGenerationMojo
+extends AbstractMojo
+{
+    /**
+     * @component
+     */
+    ArchetypeRegistryManager archetypeRegistryManager;
+
+    /**
+     * @component
+     */
+    ArchetypeGenerationConfigurator configurator;
+    /**
+     * @parameter  expression="${user.home}/.m2/archetype.xml"
+     */
+    private File archetypeRegistryFile;
+
+    /**
+     * Local maven repository.
+     *
+     * @parameter  expression="${localRepository}"
+     * @required
+     * @readonly
+     */
+    private ArtifactRepository localRepository;
+
+    /**
+     * @parameter  expression="${project.remoteArtifactRepositories}"
+     * @required
+     * @readonly
+     */
+    private List pomRemoteRepositories;
+
+    /**
+     * @parameter  default-value="archetype.properties" expression="${archetype.properties}"
+     */
+    private File propertyFile = null;
+
+    /**
+     * Other remote repositories available for discovering dependencies and extensions.
+     *
+     * @parameter  expression="${remoteRepositories}"
+     */
+    private String remoteRepositories;
+
+    /**
+     * @parameter  expression="${settings}"
+     * @required
+     * @readonly
+     */
+    private Settings settings;
+
+    public void execute ()
+    throws MojoExecutionException, MojoFailureException
+    {
+        try
+        {
+            List repositories =
+                archetypeRegistryManager.getRepositories (
+                    pomRemoteRepositories,
+                    remoteRepositories,
+                    archetypeRegistryFile
+                );
+
+            configurator.configureArchetype (
+                settings.getInteractiveMode (),
+                propertyFile,
+                System.getProperties (),
+                localRepository,
+                repositories
+            );
+        }
+        catch ( Exception ex )
+        {
+            throw new MojoExecutionException ( ex.getMessage (), ex );
+        }
+    }
+}

Added: maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateArchetypeMojo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateArchetypeMojo.java?rev=570618&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateArchetypeMojo.java (added)
+++ maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateArchetypeMojo.java Tue Aug 28 19:43:33 2007
@@ -0,0 +1,117 @@
+/*
+ * 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;
+
+import org.apache.maven.archetype.common.ArchetypeRegistryManager;
+import org.apache.maven.archetype.creator.ArchetypeCreator;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.project.MavenProject;
+
+import java.io.File;
+
+import java.util.List;
+
+/**
+ * @author           rafale
+ * @description      Create archetype from project.
+ * @requiresProject  true
+ * @goal             create-archetype
+ */
+public class CreateArchetypeMojo
+extends AbstractMojo
+{
+    /**
+     * @component
+     */
+    ArchetypeRegistryManager archetypeRegistryManager;
+    /**
+     * @component  role-hint="fileset"
+     */
+    ArchetypeCreator creator;
+
+    /**
+     * @parameter  expression="${archetype.filteredExtentions}"
+     */
+    private String archetypeFilteredExtentions;
+
+    /**
+     * @parameter  expression="${archetype.languages}"
+     */
+    private String archetypeLanguages;
+
+    /**
+     * @parameter  expression="${user.home}/.m2/archetype.xml"
+     */
+    private File archetypeRegistryFile;
+
+    /**
+     * @parameter  default-value="UTF-8" expression="${archetype.encoding}"
+     */
+    private String defaultEncoding;
+
+    /**
+     * @parameter  expression="${archetype.ignoreReplica}"
+     */
+    private boolean ignoreReplica = true;
+
+    /**
+     * @parameter  expression="${project}"
+     * @required
+     * @readonly
+     */
+    private MavenProject project;
+
+    /**
+     * @parameter  default-value="archetype.properties" expression="${archetype.properties}"
+     */
+    private File propertyFile = null;
+
+    public void execute ()
+    throws MojoExecutionException, MojoFailureException
+    {
+        try
+        {
+            List languages =
+                archetypeRegistryManager.getLanguages ( archetypeLanguages, archetypeRegistryFile );
+
+            List filtereds =
+                archetypeRegistryManager.getFilteredExtensions (
+                    archetypeFilteredExtentions,
+                    archetypeRegistryFile
+                );
+
+            creator.createArchetype (
+                project,
+                propertyFile,
+                languages,
+                filtereds,
+                defaultEncoding,
+                ignoreReplica,
+                archetypeRegistryFile
+            );
+        }
+        catch ( Exception ex )
+        {
+            throw new MojoExecutionException ( ex.getMessage (), ex );
+        }
+    }
+}

Added: maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateMojo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateMojo.java?rev=570618&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateMojo.java (added)
+++ maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateMojo.java Tue Aug 28 19:43:33 2007
@@ -0,0 +1,44 @@
+/*
+ * 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;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+/**
+ * @author           rafale
+ * @description      Creates sample archetype from current project.
+ * @requiresProject  true
+ * @goal             create-from-project
+ * @execute          phase="generate-sources" lifecycle="create"
+ */
+public class CreateMojo
+extends AbstractMojo
+{
+    /**
+     * @parameter
+     */
+    private String dummy;
+
+    public void execute ()
+    throws MojoExecutionException, MojoFailureException
+    { }
+}

Added: maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/GenerateMojo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/GenerateMojo.java?rev=570618&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/GenerateMojo.java (added)
+++ maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/GenerateMojo.java Tue Aug 28 19:43:33 2007
@@ -0,0 +1,44 @@
+/*
+ * 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;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+/**
+ * @author           rafale
+ * @description      Generates sample project from archetype.
+ * @requiresProject  false
+ * @goal             create
+ * @execute          phase="generate-sources" lifecycle="generate"
+ */
+public class GenerateMojo
+extends AbstractMojo
+{
+    /**
+     * @parameter
+     */
+    private String dummy;
+
+    public void execute ()
+    throws MojoExecutionException, MojoFailureException
+    { }
+}

Added: maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/GenerateProjectMojo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/GenerateProjectMojo.java?rev=570618&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/GenerateProjectMojo.java (added)
+++ maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/GenerateProjectMojo.java Tue Aug 28 19:43:33 2007
@@ -0,0 +1,108 @@
+/*
+ * 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;
+
+import org.apache.maven.archetype.common.ArchetypeRegistryManager;
+import org.apache.maven.archetype.generator.ArchetypeGenerator;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+import java.io.File;
+
+import java.util.List;
+
+/**
+ * @author           rafale
+ * @description      Generate sample project.
+ * @requiresProject  false
+ * @goal             generate-project
+ */
+public class GenerateProjectMojo
+extends AbstractMojo
+{
+    /**
+     * @component
+     */
+    ArchetypeRegistryManager archetypeRegistryManager;
+
+    /**
+     * @component
+     */
+    ArchetypeGenerator generator;
+    /**
+     * @parameter  expression="${user.home}/.m2/archetype.xml"
+     */
+    private File archetypeRegistryFile;
+
+    /**
+     * @parameter  default-value="${user.dir}"
+     */
+    private String basedir = System.getProperty ( "user.dir" );
+
+    /**
+     * Local maven repository.
+     *
+     * @parameter  expression="${localRepository}"
+     * @required
+     * @readonly
+     */
+    private ArtifactRepository localRepository;
+
+    /**
+     * @parameter  expression="${project.remoteArtifactRepositories}"
+     * @required
+     * @readonly
+     */
+    private List pomRemoteRepositories;
+
+    /**
+     * @parameter  default-value="archetype.properties" expression="${archetype.properties}"
+     */
+    private File propertyFile = null;
+
+    /**
+     * Other remote repositories available for discovering dependencies and extensions.
+     *
+     * @parameter  expression="${remoteRepositories}"
+     */
+    private String remoteRepositories;
+
+    public void execute ()
+    throws MojoExecutionException, MojoFailureException
+    {
+        try
+        {
+            List repositories =
+                archetypeRegistryManager.getRepositories (
+                    pomRemoteRepositories,
+                    remoteRepositories,
+                    archetypeRegistryFile
+                );
+
+            generator.generateArchetype ( propertyFile, localRepository, repositories, basedir );
+        }
+        catch ( Exception ex )
+        {
+            throw new MojoExecutionException ( ex.getMessage (), ex );
+        }
+    }
+}

Added: maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/IntegrationTestMojo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/IntegrationTestMojo.java?rev=570618&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/IntegrationTestMojo.java (added)
+++ maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/IntegrationTestMojo.java Tue Aug 28 19:43:33 2007
@@ -0,0 +1,302 @@
+/*
+ * 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;
+
+import org.apache.commons.collections.CollectionUtils;
+
+import org.apache.maven.archetype.common.Constants;
+import org.apache.maven.archetype.exception.ArchetypeGenerationFailure;
+import org.apache.maven.archetype.exception.ArchetypeNotConfigured;
+import org.apache.maven.archetype.exception.OutputFileExists;
+import org.apache.maven.archetype.exception.PomFileExists;
+import org.apache.maven.archetype.exception.ProjectDirectoryExists;
+import org.apache.maven.archetype.exception.UnknownArchetype;
+import org.apache.maven.archetype.generator.FilesetArchetypeGenerator;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.project.MavenProject;
+
+import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.StringUtils;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.StringWriter;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+
+/**
+ * @author           rafale
+ * @description
+ * @requiresProject  true
+ * @goal             integration-test
+ */
+public class IntegrationTestMojo
+extends AbstractMojo
+{
+    /**
+     * @component
+     */
+    FilesetArchetypeGenerator filesetGenerator;
+
+    /**
+     * @parameter  expression="${project}"
+     * @required
+     * @readonly
+     */
+    private MavenProject project;
+
+    /**
+     * @parameter  expression="${archetype.test.skip}"
+     * @readonly
+     */
+    private boolean skip = false;
+
+    public void execute ()
+    throws MojoExecutionException, MojoFailureException
+    {
+        if ( !skip )
+        {
+            try
+            {
+                File projectsDirectory =
+                    new File ( project.getBasedir (), "target/test-classes/projects" );
+
+                if ( projectsDirectory.exists () )
+                {
+                    File archetypeFile = project.getArtifact ().getFile ();
+
+                    List projectsGoalFiles =
+                        FileUtils.getFiles ( projectsDirectory, "*/goal.txt", "" );
+
+                    Iterator goalFiles = projectsGoalFiles.iterator ();
+
+                    StringWriter errorWriter = new StringWriter ();
+                    while ( goalFiles.hasNext () )
+                    {
+                        File goalFile = (File) goalFiles.next ();
+
+                        try
+                        {
+                            processIntegrationTest ( goalFile, archetypeFile );
+                        }
+                        catch ( IntegrationTestFailure ex )
+                        {
+                            errorWriter.write (
+                                "Test " + goalFile.getParentFile ().getName () + " failed\n"
+                            );
+
+                            errorWriter.write ( ex.getStackTrace () + "\n" );
+                            errorWriter.write ( ex.getMessage () + "\n" );
+                            errorWriter.write ( "\n" );
+                        }
+                    }
+
+                    String errors = errorWriter.toString ();
+                    if ( !StringUtils.isEmpty ( errors ) )
+                    {
+                        throw new MojoExecutionException ( errors );
+                    }
+                }
+            }
+            catch ( IOException ex )
+            {
+                throw new MojoFailureException ( ex, ex.getMessage (), ex.getMessage () );
+            }
+        }
+    }
+
+    private void assertTest ( File reference, File basedir )
+    throws IntegrationTestFailure, IOException
+    {
+        List referenceFiles = FileUtils.getFileNames ( reference, "**", null, false );
+        List projectFiles = FileUtils.getFileNames ( basedir, "**", null, false );
+
+        boolean fileNamesEquals =
+            CollectionUtils.isEqualCollection ( referenceFiles, projectFiles );
+
+        {
+            Iterator refs = referenceFiles.iterator ();
+            while ( refs.hasNext () )
+            {
+                String ref = (String) refs.next ();
+
+                if ( projectFiles.contains ( ref ) )
+                {
+                    projectFiles.remove ( ref );
+                    getLog ().debug ( "Contained " + ref );
+                }
+                else
+                {
+                    getLog ().debug ( "Not contained " + ref );
+                }
+            }
+            getLog ().debug ( "Remains " + projectFiles );
+        }
+
+        if ( !fileNamesEquals )
+        {
+            throw new IntegrationTestFailure ( "Reference and generated project differs" );
+        }
+
+        boolean contentEquals = true;
+        Iterator files = referenceFiles.iterator ();
+        while ( files.hasNext () )
+        {
+            String file = (String) files.next ();
+
+            if ( file.endsWith ( "pom.xml" ) )
+            {
+                if ( !modelEquals ( new File ( reference, file ), new File ( basedir, file ) ) )
+                {
+                    getLog ().warn ( "Contents of file " + file + " are not equal" );
+                    contentEquals = false;
+                }
+            }
+            else
+            {
+                if ( !FileUtils.contentEquals (
+                        new File ( reference, file ),
+                        new File ( basedir, file )
+                    )
+                )
+                {
+                    getLog ().warn ( "Contents of file " + file + " are not equal" );
+                    contentEquals = false;
+                }
+            }
+        }
+        if ( !contentEquals )
+        {
+            throw new IntegrationTestFailure ( "Some content are not equals" );
+        }
+    }
+
+    private Properties loadProperties ( final File propertiesFile )
+    throws IOException, FileNotFoundException
+    {
+        Properties properties = new Properties ();
+
+        properties.load ( new FileInputStream ( propertiesFile ) );
+
+        return properties;
+    }
+
+    private boolean modelEquals ( File referencePom, File generatedPom )
+    throws IOException
+    {
+        return FileUtils.contentEquals ( referencePom, generatedPom );
+    }
+
+    private void processIntegrationTest ( File goalFile, File archetypeFile )
+    throws IntegrationTestFailure
+    {
+        try
+        {
+            Properties testProperties = getTestProperties ( goalFile );
+
+            Properties properties = getProperties ( goalFile );
+
+            String basedir = goalFile.getParentFile ().getPath () + "/project";
+
+            FileUtils.mkdir ( basedir );
+
+            filesetGenerator.generateArchetype ( properties, archetypeFile, basedir );
+
+            File reference = new File ( goalFile.getParentFile (), "reference" );
+
+            assertTest (
+                reference,
+                new File ( basedir, properties.getProperty ( Constants.ARTIFACT_ID ) )
+            );
+        }
+        catch ( ArchetypeNotConfigured ex )
+        {
+            throw new IntegrationTestFailure ( ex );
+        }
+        catch ( UnknownArchetype ex )
+        {
+            throw new IntegrationTestFailure ( ex );
+        }
+        catch ( PomFileExists ex )
+        {
+            throw new IntegrationTestFailure ( ex );
+        }
+        catch ( ProjectDirectoryExists ex )
+        {
+            throw new IntegrationTestFailure ( ex );
+        }
+        catch ( ArchetypeGenerationFailure ex )
+        {
+            throw new IntegrationTestFailure ( ex );
+        }
+        catch ( IOException ex )
+        {
+            throw new IntegrationTestFailure ( ex );
+        }
+        catch ( OutputFileExists ex )
+        {
+            throw new IntegrationTestFailure ( ex );
+        }
+    }
+
+    private Properties getProperties ( File goalFile )
+    throws IOException
+    {
+        File propertiesFile = new File ( goalFile.getParentFile (), "archetype.properties" );
+
+        return loadProperties ( propertiesFile );
+    }
+
+    private Properties getTestProperties ( File goalFile )
+    throws IOException
+    {
+        return loadProperties ( goalFile );
+    }
+
+    class IntegrationTestFailure
+    extends Exception
+    {
+        IntegrationTestFailure ()
+        {
+            super ();
+        }
+
+        IntegrationTestFailure ( String message )
+        {
+            super ( message );
+        }
+
+        IntegrationTestFailure ( Throwable cause )
+        {
+            super ( cause );
+        }
+
+        IntegrationTestFailure ( String message, Throwable cause )
+        {
+            super ( message, cause );
+        }
+    }
+}

Added: maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/JarMojo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/JarMojo.java?rev=570618&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/JarMojo.java (added)
+++ maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/JarMojo.java Tue Aug 28 19:43:33 2007
@@ -0,0 +1,139 @@
+/*
+ * 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;
+
+import org.apache.maven.archiver.MavenArchiveConfiguration;
+import org.apache.maven.archiver.MavenArchiver;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.project.MavenProject;
+
+import org.codehaus.plexus.archiver.jar.JarArchiver;
+
+import java.io.File;
+
+/**
+ * @author           rafale
+ * @goal             jar
+ * @phase            package
+ * @requiresProject
+ */
+public class JarMojo
+extends AbstractMojo
+{
+    /**
+     * Directory containing the classes.
+     *
+     * @parameter  expression="${project.build.outputDirectory}"
+     * @required
+     */
+    private File archetypeDirectory;
+
+    /**
+     * The maven archive configuration to use.
+     *
+     * <p>See <a
+     * href="http://maven.apache.org/ref/current/maven-archiver/apidocs/org/apache/maven/archiver/MavenArchiveConfiguration.html">
+     * the Javadocs for MavenArchiveConfiguration</a>.</p>
+     *
+     * @parameter
+     */
+    private MavenArchiveConfiguration archive = new MavenArchiveConfiguration ();
+
+    /**
+     * Name of the generated JAR.
+     *
+     * @parameter  alias="jarName" expression="${project.build.finalName}"
+     * @required
+     */
+    private String finalName;
+
+    /**
+     * The Jar archiver.
+     *
+     * @parameter  expression="${component.org.codehaus.plexus.archiver.Archiver#jar}"
+     * @required
+     */
+    private JarArchiver jarArchiver;
+
+    /**
+     * Directory containing the generated JAR.
+     *
+     * @parameter  expression="${project.build.directory}"
+     * @required
+     */
+    private File outputDirectory;
+
+    /**
+     * The maven project.
+     *
+     * @parameter  expression="${project}"
+     * @required
+     * @readonly
+     */
+    private MavenProject project;
+
+    protected static File getJarFile ( File basedir, String finalName )
+    {
+        return new File ( basedir, finalName + ".jar" );
+    }
+
+    public void execute ()
+    throws MojoExecutionException, MojoFailureException
+    {
+        File jarFile = createArchive ();
+        project.getArtifact ().setFile ( jarFile );
+    }
+
+    private File createArchive ()
+    throws MojoExecutionException
+    {
+        File jarFile = getJarFile ( outputDirectory, finalName );
+
+        MavenArchiver archiver = new MavenArchiver ();
+
+        archiver.setArchiver ( jarArchiver );
+
+        archiver.setOutputFile ( jarFile );
+
+        archive.setForced ( true );
+
+        try
+        {
+            if ( !archetypeDirectory.exists () )
+            {
+                getLog ().warn ( "JAR will be empty - no content was marked for inclusion!" );
+            }
+            else
+            {
+                archiver.getArchiver ().addDirectory ( archetypeDirectory );
+            }
+
+            archiver.createArchive ( project, archive );
+
+            return jarFile;
+        }
+        catch ( Exception e )
+        {
+            throw new MojoExecutionException ( "Error assembling JAR", e );
+        }
+    }
+}

Added: maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/SamplePropertiesMojo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/SamplePropertiesMojo.java?rev=570618&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/SamplePropertiesMojo.java (added)
+++ maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/SamplePropertiesMojo.java Tue Aug 28 19:43:33 2007
@@ -0,0 +1,259 @@
+/*
+ * 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;
+
+import org.apache.maven.archetype.common.ArchetypeArtifactManager;
+import org.apache.maven.archetype.common.ArchetypeConfiguration;
+import org.apache.maven.archetype.common.ArchetypeDefinition;
+import org.apache.maven.archetype.common.ArchetypeFactory;
+import org.apache.maven.archetype.common.ArchetypePropertiesManager;
+import org.apache.maven.archetype.common.ArchetypeRegistryManager;
+import org.apache.maven.archetype.common.Constants;
+import org.apache.maven.archetype.exception.ArchetypeGenerationConfigurationFailure;
+import org.apache.maven.archetype.exception.ArchetypeNotDefined;
+import org.apache.maven.archetype.exception.UnknownArchetype;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+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.io.IOException;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+
+/**
+ * @author           rafale
+ * @requiresProject  false
+ * @goal             sample-properties
+ */
+public class SamplePropertiesMojo
+extends AbstractMojo
+{
+    /**
+     * @component
+     */
+    ArchetypeRegistryManager archetypeRegistryManager;
+
+    /**
+     * @component
+     */
+    private ArchetypeArtifactManager archetypeArtifactManager;
+
+    /**
+     * @component
+     */
+    private ArchetypeFactory archetypeFactory;
+
+    /**
+     * @component
+     */
+    private ArchetypePropertiesManager archetypePropertiesManager;
+    /**
+     * @parameter  expression="${user.home}/.m2/archetype.xml"
+     */
+    private File archetypeRegistryFile;
+
+    /**
+     * Local maven repository.
+     *
+     * @parameter  expression="${localRepository}"
+     * @required
+     * @readonly
+     */
+    private ArtifactRepository localRepository;
+
+    /**
+     * @parameter  expression="${project.remoteArtifactRepositories}"
+     * @required
+     * @readonly
+     */
+    private List pomRemoteRepositories;
+
+    /**
+     * @parameter  default-value="archetype.properties" expression="${archetype.properties}"
+     */
+    private File propertyFile = null;
+
+    /**
+     * Other remote repositories available for discovering dependencies and extensions.
+     *
+     * @parameter  expression="${remoteRepositories}"
+     */
+    private String remoteRepositories;
+
+    public void execute ()
+    throws MojoExecutionException, MojoFailureException
+    {
+        try
+        {
+            List repositories =
+                archetypeRegistryManager.getRepositories (
+                    pomRemoteRepositories,
+                    remoteRepositories,
+                    archetypeRegistryFile
+                );
+
+            Properties properties =
+                initialiseArchetypeProperties ( System.getProperties (), propertyFile );
+
+            ArchetypeDefinition archetypeDefinition =
+                archetypeFactory.createArchetypeDefinition ( properties );
+            if ( !archetypeDefinition.isDefined () )
+            {
+                throw new ArchetypeNotDefined ( "The archetype is not defined" );
+            }
+
+            if ( !archetypeArtifactManager.exists (
+                    archetypeDefinition.getGroupId (),
+                    archetypeDefinition.getArtifactId (),
+                    archetypeDefinition.getVersion (),
+                    localRepository,
+                    repositories
+                )
+            )
+            {
+                throw new UnknownArchetype (
+                    "The desired archetype does not exist (" + archetypeDefinition.getGroupId ()
+                    + ":" + archetypeDefinition.getArtifactId () + ":"
+                    + archetypeDefinition.getVersion ()
+                    + ")"
+                );
+            }
+
+            ArchetypeConfiguration archetypeConfiguration;
+
+            if ( archetypeArtifactManager.isOldArchetype (
+                    archetypeDefinition.getGroupId (),
+                    archetypeDefinition.getArtifactId (),
+                    archetypeDefinition.getVersion (),
+                    localRepository,
+                    repositories
+                )
+            )
+            {
+                org.apache.maven.archetype.descriptor.ArchetypeDescriptor archetypeDescriptor =
+                    archetypeArtifactManager.getOldArchetypeDescriptor (
+                        archetypeDefinition.getGroupId (),
+                        archetypeDefinition.getArtifactId (),
+                        archetypeDefinition.getVersion (),
+                        localRepository,
+                        repositories
+                    );
+                archetypeConfiguration =
+                    archetypeFactory.createArchetypeConfiguration (
+                        archetypeDescriptor,
+                        properties
+                    );
+            }
+            else if (
+                archetypeArtifactManager.isFileSetArchetype (
+                    archetypeDefinition.getGroupId (),
+                    archetypeDefinition.getArtifactId (),
+                    archetypeDefinition.getVersion (),
+                    localRepository,
+                    repositories
+                )
+            )
+            {
+                org.apache.maven.archetype.metadata.ArchetypeDescriptor archetypeDescriptor =
+                    archetypeArtifactManager.getFileSetArchetypeDescriptor (
+                        archetypeDefinition.getGroupId (),
+                        archetypeDefinition.getArtifactId (),
+                        archetypeDefinition.getVersion (),
+                        localRepository,
+                        repositories
+                    );
+                archetypeConfiguration =
+                    archetypeFactory.createArchetypeConfiguration (
+                        archetypeDescriptor,
+                        properties
+                    );
+            }
+            else
+            {
+                throw new ArchetypeGenerationConfigurationFailure (
+                    "The defined artifact is not an archetype"
+                );
+            }
+
+            archetypeConfiguration.setProperty ( Constants.GROUP_ID, "com.company" );
+            archetypeConfiguration.setProperty ( Constants.ARTIFACT_ID, "project" );
+            archetypeConfiguration.setProperty ( Constants.VERSION, "1.0-SNAPSHOT" );
+            archetypeConfiguration.setProperty ( Constants.PACKAGE, "com.company.project" );
+
+            Iterator requiredProperties =
+                archetypeConfiguration.getRequiredProperties ().iterator ();
+            while ( requiredProperties.hasNext () )
+            {
+                String requiredProperty = (String) requiredProperties.next ();
+
+                if ( StringUtils.isEmpty ( archetypeConfiguration.getProperty ( requiredProperty ) )
+                )
+                {
+                    archetypeConfiguration.setProperty (
+                        requiredProperty,
+                        StringUtils.isEmpty (
+                            archetypeConfiguration.getDefaultValue ( requiredProperty )
+                        ) ? "To be defined"
+                          : archetypeConfiguration.getDefaultValue ( requiredProperty )
+                    );
+                }
+            }
+
+            archetypePropertiesManager.writeProperties (
+                archetypeConfiguration.toProperties (),
+                propertyFile
+            );
+        }
+        catch ( Exception ex )
+        {
+            throw new MojoExecutionException ( ex.getMessage (), ex );
+        }
+    }
+
+    private Properties initialiseArchetypeProperties (
+        Properties commandLineProperties,
+        File propertyFile
+    )
+    throws FileNotFoundException, IOException
+    {
+        Properties properties = new Properties ();
+        archetypePropertiesManager.readProperties ( properties, propertyFile );
+
+        Iterator commandLinePropertiesIterator =
+            new ArrayList ( commandLineProperties.keySet () ).iterator ();
+        while ( commandLinePropertiesIterator.hasNext () )
+        {
+            String propertyKey = (String) commandLinePropertiesIterator.next ();
+            properties.setProperty (
+                propertyKey,
+                commandLineProperties.getProperty ( propertyKey )
+            );
+        }
+        return properties;
+    }
+}

Added: maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/SelectArchetypeMojo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/SelectArchetypeMojo.java?rev=570618&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/SelectArchetypeMojo.java (added)
+++ maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/SelectArchetypeMojo.java Tue Aug 28 19:43:33 2007
@@ -0,0 +1,135 @@
+/*
+ * 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;
+
+import org.apache.maven.archetype.common.ArchetypeRegistryManager;
+import org.apache.maven.archetype.generator.ArchetypeSelector;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.settings.Settings;
+
+import java.io.File;
+
+import java.util.List;
+
+/**
+ * @author           rafale
+ * @description      Select archetype.
+ * @requiresProject  false
+ * @goal             select-archetype
+ */
+public class SelectArchetypeMojo
+extends AbstractMojo
+{
+    /**
+     * @component
+     */
+    ArchetypeRegistryManager archetypeRegistryManager;
+    /**
+     * @parameter  expression="${archetypeArtifactId}"
+     */
+    private String archetypeArtifactId;
+
+    /**
+     * @parameter  expression="${archetypeGroupId}"
+     */
+    private String archetypeGroupId;
+
+    /**
+     * @parameter  expression="${user.home}/.m2/archetype.xml"
+     */
+    private File archetypeRegistryFile;
+
+    /**
+     * @parameter  expression="${archetypeVersion}"
+     */
+    private String archetypeVersion;
+
+    /**
+     * Local maven repository.
+     *
+     * @parameter  expression="${localRepository}"
+     * @required
+     * @readonly
+     */
+    private ArtifactRepository localRepository;
+
+    /**
+     * @parameter  expression="${project.remoteArtifactRepositories}"
+     * @required
+     * @readonly
+     */
+    private List pomRemoteRepositories;
+
+    /**
+     * @parameter  default-value="archetype.properties" expression="${archetype.properties}"
+     */
+    private File propertyFile = null;
+
+    /**
+     * Other remote repositories available for discovering dependencies and extensions.
+     *
+     * @parameter  expression="${remoteRepositories}"
+     */
+    private String remoteRepositories;
+
+    /**
+     * @component
+     */
+    private ArchetypeSelector selector;
+
+    /**
+     * @parameter  expression="${settings}"
+     * @required
+     * @readonly
+     */
+    private Settings settings;
+
+    public void execute ()
+    throws MojoExecutionException, MojoFailureException
+    {
+        try
+        {
+            List repositories =
+                archetypeRegistryManager.getRepositories (
+                    pomRemoteRepositories,
+                    remoteRepositories,
+                    archetypeRegistryFile
+                );
+
+            selector.selectArchetype (
+                archetypeGroupId,
+                archetypeArtifactId,
+                archetypeVersion,
+                settings.getInteractiveMode (),
+                propertyFile,
+                archetypeRegistryFile,
+                localRepository,
+                repositories
+            );
+        }
+        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/AddExtensionsMojo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/registry/AddExtensionsMojo.java?rev=570618&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/registry/AddExtensionsMojo.java (added)
+++ maven/sandbox/trunk/archetypeng/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/registry/AddExtensionsMojo.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-extensions
+ */
+public class AddExtensionsMojo
+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 extensionsToAdd = new ArrayList ();
+            if ( StringUtils.isNotEmpty ( extension ) )
+            {
+                extensionsToAdd.add ( extension );
+            }
+            else
+            {
+                extensionsToAdd.addAll ( Arrays.asList ( StringUtils.split ( extensions, "," ) ) );
+            }
+
+            ArchetypeRegistry registry;
+            try
+            {
+                registry = archetypeRegistryManager.readArchetypeRegistry(archetypeRegistryFile);
+            }
+            catch (FileNotFoundException ex)
+            {
+                registry = archetypeRegistryManager.getDefaultArchetypeRegistry();
+            }
+
+            Iterator extensionsToAddIterator = extensionsToAdd.iterator ();
+            while ( extensionsToAddIterator.hasNext () )
+            {
+                String extensionToAdd = (String) extensionsToAddIterator.next ();
+                if ( registry.getFilteredExtensions ().contains ( extensionToAdd ) )
+                {
+                    getLog ().debug ( "Extension " + extensionToAdd + " already exists" );
+                }
+                else
+                {
+                    registry.addFilteredExtension ( extensionToAdd.trim () );
+                    getLog ().debug ( "Extension " + extensionToAdd + " added" );
+                }
+            }
+            archetypeRegistryManager.writeArchetypeRegistry ( archetypeRegistryFile, registry );
+        }
+        catch ( Exception ex )
+        {
+            throw new MojoExecutionException ( ex.getMessage (), ex );
+        }
+    }
+}