You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by jv...@apache.org on 2007/07/06 18:35:16 UTC
svn commit: r553946 [17/19] - in
/maven/archetype/branches/maven-archetypeng: ./ maven-archetypeng-bundles/
maven-archetypeng-bundles/maven-archetypeng-archetype/
maven-archetypeng-bundles/maven-archetypeng-archetype/src/
maven-archetypeng-bundles/mave...
Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/test/resources/projects/generate-9/file-value/pom.xml.sample
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/test/resources/projects/generate-9/file-value/pom.xml.sample?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/test/resources/projects/generate-9/file-value/pom.xml.sample (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/test/resources/projects/generate-9/file-value/pom.xml.sample Fri Jul 6 09:34:35 2007
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright 2006 The Apache Software Foundation.
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+-->
+<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.codehaus.mojo.archetypeng</groupId>
+ <artifactId>test-generate-9-parent</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.codehaus.mojo.archetypeng</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/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/test/resources/projects/generate-9/pom.xml.sample
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/test/resources/projects/generate-9/pom.xml.sample?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/test/resources/projects/generate-9/pom.xml.sample (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/test/resources/projects/generate-9/pom.xml.sample Fri Jul 6 09:34:35 2007
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright 2006 The Apache Software Foundation.
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+-->
+<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.codehaus.mojo.archetypeng</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/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/test/resources/projects/select-1/dummy
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/test/resources/projects/select-1/dummy?view=auto&rev=553946
==============================================================================
(empty)
Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/test/resources/projects/select-2/archetype.properties.sample
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/test/resources/projects/select-2/archetype.properties.sample?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/test/resources/projects/select-2/archetype.properties.sample (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/test/resources/projects/select-2/archetype.properties.sample Fri Jul 6 09:34:35 2007
@@ -0,0 +1,3 @@
+archetype.groupId=org.codehaus.mojo.archetypes
+archetype.artifactId=maven-archetype-test
+archetype.version=1.0
Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/test/resources/projects/select-3/dummy
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/test/resources/projects/select-3/dummy?view=auto&rev=553946
==============================================================================
(empty)
Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/test/resources/projects/select-4/archetype.properties.sample
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/test/resources/projects/select-4/archetype.properties.sample?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/test/resources/projects/select-4/archetype.properties.sample (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/test/resources/projects/select-4/archetype.properties.sample Fri Jul 6 09:34:35 2007
@@ -0,0 +1,3 @@
+archetype.groupId=org.codehaus.mojo.archetypes
+archetype.artifactId=maven-archetype-test
+archetype.version=1.0
Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/test/resources/projects/select-5/dummy
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/test/resources/projects/select-5/dummy?view=auto&rev=553946
==============================================================================
(empty)
Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/test/resources/projects/select-6/dummy
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/test/resources/projects/select-6/dummy?view=auto&rev=553946
==============================================================================
(empty)
Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/test/resources/projects/select-7/archetype.properties.sample
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/test/resources/projects/select-7/archetype.properties.sample?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/test/resources/projects/select-7/archetype.properties.sample (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/test/resources/projects/select-7/archetype.properties.sample Fri Jul 6 09:34:35 2007
@@ -0,0 +1,3 @@
+archetype.groupId=org.codehaus.mojo.archetypes
+archetype.artifactId=maven-archetype-test-dont-exist
+archetype.version=1.0
Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/test/resources/projects/select-8/archetype.properties.sample
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/test/resources/projects/select-8/archetype.properties.sample?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/test/resources/projects/select-8/archetype.properties.sample (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/test/resources/projects/select-8/archetype.properties.sample Fri Jul 6 09:34:35 2007
@@ -0,0 +1,2 @@
+archetype.groupId=org.codehaus.mojo.archetypes
+archetype.artifactId=maven-archetype-test
Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/test/resources/repositories/central/dummy
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/test/resources/repositories/central/dummy?view=auto&rev=553946
==============================================================================
(empty)
Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/test/resources/repositories/local/dummy
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/maven-archetypeng-generator/src/test/resources/repositories/local/dummy?view=auto&rev=553946
==============================================================================
(empty)
Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/pom.xml
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/pom.xml?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/pom.xml (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/pom.xml Fri Jul 6 09:34:35 2007
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright 2006 The Apache Software Foundation.
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+-->
+<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.codehaus.mojo.archetypeng</groupId>
+ <artifactId>maven-archetypeng</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>maven-archetypeng-core</artifactId>
+
+ <name>Maven ArchetypeNG Core</name>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>maven-archetypeng-archetype-descriptor</module>
+ <module>maven-archetypeng-archetype-registry</module>
+ <module>maven-archetypeng-common</module>
+ <module>maven-archetypeng-generator</module>
+ <module>maven-archetypeng-creator</module>
+ </modules>
+
+ <build>
+ <plugins>
+ <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>
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-core/pom.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/pom.xml?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/pom.xml (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/pom.xml Fri Jul 6 09:34:35 2007
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright 2006 The Apache Software Foundation.
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+-->
+<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.codehaus.mojo.archetypeng</groupId>
+ <artifactId>maven-archetypeng</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.codehaus.mojo</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.codehaus.mojo.archetypeng</groupId>
+ <artifactId>maven-archetypeng-common</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.mojo.archetypeng</groupId>
+ <artifactId>maven-archetypeng-generator</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.mojo.archetypeng</groupId>
+ <artifactId>maven-archetypeng-creator</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-archiver</artifactId>
+ <version>2.2</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>
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/pom.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/CleanMojo.java
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/CleanMojo.java?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/CleanMojo.java (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/CleanMojo.java Fri Jul 6 09:34:35 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.codehaus.mojo.archetypeng.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 ();
+ }
+}
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/CleanMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/CleanMojo.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/ConfigureCreationMojo.java
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/ConfigureCreationMojo.java?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/ConfigureCreationMojo.java (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/ConfigureCreationMojo.java Fri Jul 6 09:34:35 2007
@@ -0,0 +1,113 @@
+/*
+ * 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.codehaus.mojo.archetypeng.mojos;
+
+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 org.codehaus.mojo.archetypeng.creator.ArchetypeCreationConfigurator;
+
+import java.io.File;
+import java.util.List;
+import org.codehaus.mojo.archetypeng.ArchetypeRegistryManager;
+
+/**
+ * @author rafale
+ * @description Configure archetype's creation properties.
+ * @requiresProject true
+ * @goal configure-creation
+ */
+public class ConfigureCreationMojo
+extends AbstractMojo
+{
+ /**
+ * @component
+ */
+ ArchetypeCreationConfigurator configurator;
+
+ /**
+ * @parameter expression="${user.home}/.m2/archetype.xml"
+ */
+ private File archetypeRegistryFile;
+
+ /**
+ * @component
+ */
+ ArchetypeRegistryManager archetypeRegistryManager;
+
+ /**
+ * @parameter expression="${project}"
+ * @required
+ * @readonly
+ */
+ private MavenProject project;
+
+ /**
+ * @parameter default-value="archetype.properties" expression="${archetype.properties}"
+ */
+ private File propertyFile = null;
+
+ /**
+ * @parameter expression="${archetype.languages}"
+ */
+ private String archetypeLanguages;
+
+ /**
+ * @parameter expression="${settings}"
+ * @required
+ * @readonly
+ */
+ private Settings settings;
+
+ /**
+ * @parameter expression="${interactive}" default-value="false"
+ */
+ private boolean interactive;
+
+ 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 );
+ }
+ }
+}
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/ConfigureCreationMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/ConfigureCreationMojo.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/ConfigureGenerationMojo.java
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/ConfigureGenerationMojo.java?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/ConfigureGenerationMojo.java (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/ConfigureGenerationMojo.java Fri Jul 6 09:34:35 2007
@@ -0,0 +1,119 @@
+/*
+ * 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.codehaus.mojo.archetypeng.mojos;
+
+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 org.codehaus.mojo.archetypeng.generator.ArchetypeGenerationConfigurator;
+
+import java.io.File;
+
+import java.util.List;
+import org.codehaus.mojo.archetypeng.ArchetypeRegistryManager;
+
+/**
+ * @author rafale
+ * @description Configure archetype's properties.
+ * @requiresProject false
+ * @goal configure-generation
+ */
+public class ConfigureGenerationMojo
+extends AbstractMojo
+{
+ /**
+ * @parameter expression="${user.home}/.m2/archetype.xml"
+ */
+ private File archetypeRegistryFile;
+
+ /**
+ * @component
+ */
+ ArchetypeRegistryManager archetypeRegistryManager;
+
+ /**
+ * @component
+ */
+ ArchetypeGenerationConfigurator configurator;
+
+ /**
+ * 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 );
+ }
+ }
+}
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/ConfigureGenerationMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/ConfigureGenerationMojo.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/CreateArchetypeMojo.java
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/CreateArchetypeMojo.java?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/CreateArchetypeMojo.java (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/CreateArchetypeMojo.java Fri Jul 6 09:34:35 2007
@@ -0,0 +1,110 @@
+/*
+ * 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.codehaus.mojo.archetypeng.mojos;
+
+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.mojo.archetypeng.ArchetypeRegistryManager;
+import org.codehaus.mojo.archetypeng.creator.ArchetypeCreator;
+
+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="${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
+ );
+ }
+ catch ( Exception ex )
+ {
+ throw new MojoExecutionException ( ex.getMessage (), ex );
+ }
+ }
+}
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/CreateArchetypeMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/CreateArchetypeMojo.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/CreateMojo.java
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/CreateMojo.java?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/CreateMojo.java (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/CreateMojo.java Fri Jul 6 09:34:35 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.codehaus.mojo.archetypeng.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
+ { }
+}
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/CreateMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/CreateMojo.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/GenerateMojo.java
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/GenerateMojo.java?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/GenerateMojo.java (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/GenerateMojo.java Fri Jul 6 09:34:35 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.codehaus.mojo.archetypeng.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
+ { }
+}
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/GenerateMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/GenerateMojo.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/GenerateProjectMojo.java
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/GenerateProjectMojo.java?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/GenerateProjectMojo.java (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/GenerateProjectMojo.java Fri Jul 6 09:34:35 2007
@@ -0,0 +1,110 @@
+/*
+ * 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.codehaus.mojo.archetypeng.mojos;
+
+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.mojo.archetypeng.generator.ArchetypeGenerator;
+
+import java.io.File;
+
+import java.util.List;
+import org.codehaus.mojo.archetypeng.ArchetypeRegistryManager;
+
+/**
+ * @author rafale
+ * @description Generate sample project.
+ * @requiresProject false
+ * @goal generate-project
+ */
+public class GenerateProjectMojo
+extends AbstractMojo
+{
+ /**
+ * @parameter expression="${user.home}/.m2/archetype.xml"
+ */
+ private File archetypeRegistryFile;
+
+ /**
+ * @component
+ */
+ ArchetypeRegistryManager archetypeRegistryManager;
+
+ /**
+ * @parameter default-value="${user.dir}"
+ */
+ private String basedir = System.getProperty ( "user.dir" );
+
+ /**
+ * @component
+ */
+ ArchetypeGenerator generator;
+
+ /**
+ * 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 );
+ }
+ }
+}
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/GenerateProjectMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/GenerateProjectMojo.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/IntegrationTestMojo.java
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/IntegrationTestMojo.java?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/IntegrationTestMojo.java (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/IntegrationTestMojo.java Fri Jul 6 09:34:35 2007
@@ -0,0 +1,293 @@
+/*
+ * 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.codehaus.mojo.archetypeng.mojos;
+
+import org.apache.commons.collections.CollectionUtils;
+
+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.mojo.archetypeng.Constants;
+import org.codehaus.mojo.archetypeng.exception.ArchetypeGenerationFailure;
+import org.codehaus.mojo.archetypeng.exception.ArchetypeNotConfigured;
+import org.codehaus.mojo.archetypeng.exception.OutputFileExists;
+import org.codehaus.mojo.archetypeng.exception.PomFileExists;
+import org.codehaus.mojo.archetypeng.exception.ProjectDirectoryExists;
+import org.codehaus.mojo.archetypeng.exception.UnknownArchetype;
+import org.codehaus.mojo.archetypeng.generator.FilesetArchetypeGenerator;
+
+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.FileReader;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+import java.util.Collection;
+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;
+
+ public void execute ()
+ throws MojoExecutionException, MojoFailureException
+ {
+ try
+ {
+ File projectsDirectory =
+ new File ( project.getBasedir (), "target/test-classes/projects" );
+
+ 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 );
+ }
+ }
+}
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/IntegrationTestMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/IntegrationTestMojo.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/JarMojo.java
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/JarMojo.java?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/JarMojo.java (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/JarMojo.java Fri Jul 6 09:34:35 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.codehaus.mojo.archetypeng.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 );
+ }
+ }
+}
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/JarMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/JarMojo.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/SamplePropertiesMojo.java
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/SamplePropertiesMojo.java?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/SamplePropertiesMojo.java (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/SamplePropertiesMojo.java Fri Jul 6 09:34:35 2007
@@ -0,0 +1,230 @@
+package org.codehaus.mojo.archetypeng.mojos;
+
+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;
+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.mojo.archetypeng.ArchetypeArtifactManager;
+import org.codehaus.mojo.archetypeng.ArchetypeConfiguration;
+import org.codehaus.mojo.archetypeng.ArchetypeDefinition;
+import org.codehaus.mojo.archetypeng.ArchetypeFactory;
+import org.codehaus.mojo.archetypeng.ArchetypePropertiesManager;
+import org.codehaus.mojo.archetypeng.ArchetypeRegistryManager;
+import org.codehaus.mojo.archetypeng.Constants;
+import org.codehaus.mojo.archetypeng.exception.ArchetypeGenerationConfigurationFailure;
+import org.codehaus.mojo.archetypeng.exception.ArchetypeNotDefined;
+import org.codehaus.mojo.archetypeng.exception.UnknownArchetype;
+import org.codehaus.plexus.util.StringUtils;
+
+/**
+ *
+ * @author rafale
+
+ * @requiresProject false
+ * @goal sample-properties
+ */
+public class SamplePropertiesMojo
+extends AbstractMojo
+{
+ /**
+ * @parameter expression="${user.home}/.m2/archetype.xml"
+ */
+ private File archetypeRegistryFile;
+
+ /**
+ * @component
+ */
+ ArchetypeRegistryManager archetypeRegistryManager;
+
+ /**
+ * @component
+ */
+ private ArchetypeArtifactManager archetypeArtifactManager;
+
+ /**
+ * @component
+ */
+ private ArchetypePropertiesManager archetypePropertiesManager;
+
+ /**
+ * Local maven repository.
+ *
+ * @parameter expression="${localRepository}"
+ * @required
+ * @readonly
+ */
+ private ArtifactRepository localRepository;
+
+ /**
+ * @component
+ */
+ private ArchetypeFactory archetypeFactory;
+
+ /**
+ * @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.codehaus.mojo.archetypeng.archetype.filesets.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;
+ }
+}
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/SamplePropertiesMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/SamplePropertiesMojo.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/SelectArchetypeMojo.java
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/SelectArchetypeMojo.java?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/SelectArchetypeMojo.java (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/SelectArchetypeMojo.java Fri Jul 6 09:34:35 2007
@@ -0,0 +1,136 @@
+/*
+ * 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.codehaus.mojo.archetypeng.mojos;
+
+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 org.codehaus.mojo.archetypeng.generator.ArchetypeSelector;
+
+import java.io.File;
+import java.util.List;
+import org.codehaus.mojo.archetypeng.ArchetypeRegistryManager;
+
+/**
+ * @author rafale
+ * @description Select archetype.
+ * @requiresProject false
+ * @goal select-archetype
+ */
+public class SelectArchetypeMojo
+extends AbstractMojo
+{
+ /**
+ * @parameter expression="${archetypeArtifactId}"
+ */
+ private String archetypeArtifactId;
+
+ /**
+ * @parameter expression="${archetypeGroupId}"
+ */
+ private String archetypeGroupId;
+
+ /**
+ * @parameter expression="${user.home}/.m2/archetype.xml"
+ */
+ private File archetypeRegistryFile;
+
+ /**
+ * @component
+ */
+ ArchetypeRegistryManager archetypeRegistryManager;
+
+ /**
+ * @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 );
+ }
+ }
+}
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/SelectArchetypeMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/SelectArchetypeMojo.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/registry/AddExtensionsMojo.java
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/registry/AddExtensionsMojo.java?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/registry/AddExtensionsMojo.java (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/registry/AddExtensionsMojo.java Fri Jul 6 09:34:35 2007
@@ -0,0 +1,109 @@
+package org.codehaus.mojo.archetypeng.mojos.registry;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+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.mojo.archetypeng.ArchetypeArtifactManager;
+import org.codehaus.mojo.archetypeng.ArchetypeConfiguration;
+import org.codehaus.mojo.archetypeng.ArchetypeDefinition;
+import org.codehaus.mojo.archetypeng.ArchetypeFactory;
+import org.codehaus.mojo.archetypeng.ArchetypePropertiesManager;
+import org.codehaus.mojo.archetypeng.ArchetypeRegistryManager;
+import org.codehaus.mojo.archetypeng.Constants;
+import org.codehaus.mojo.archetypeng.exception.ArchetypeGenerationConfigurationFailure;
+import org.codehaus.mojo.archetypeng.exception.ArchetypeNotDefined;
+import org.codehaus.mojo.archetypeng.exception.UnknownArchetype;
+import org.codehaus.mojo.archetypeng.registry.ArchetypeRegistry;
+import org.codehaus.plexus.util.StringUtils;
+
+/**
+ *
+ * @author rafale
+
+ * @requiresProject false
+ * @goal add-extensions
+ */
+public class AddExtensionsMojo
+extends AbstractMojo
+{
+ /**
+ * @parameter expression="${user.home}/.m2/archetype.xml"
+ */
+ private File archetypeRegistryFile;
+
+ /**
+ * @component
+ */
+ ArchetypeRegistryManager archetypeRegistryManager;
+
+ /**
+ * @parameter expression="${extension}"
+ */
+ String extension;
+
+ /**
+ * @parameter expression="${extensions}"
+ */
+ String extensions;
+
+ 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 = archetypeRegistryManager.readArchetypeRegistry(
+ archetypeRegistryFile
+ );
+
+ 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 );
+ }
+ }
+
+}
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/registry/AddExtensionsMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/registry/AddExtensionsMojo.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/registry/AddGroupsMojo.java
URL: http://svn.apache.org/viewvc/maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/registry/AddGroupsMojo.java?view=auto&rev=553946
==============================================================================
--- maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/registry/AddGroupsMojo.java (added)
+++ maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/registry/AddGroupsMojo.java Fri Jul 6 09:34:35 2007
@@ -0,0 +1,109 @@
+package org.codehaus.mojo.archetypeng.mojos.registry;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+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.mojo.archetypeng.ArchetypeArtifactManager;
+import org.codehaus.mojo.archetypeng.ArchetypeConfiguration;
+import org.codehaus.mojo.archetypeng.ArchetypeDefinition;
+import org.codehaus.mojo.archetypeng.ArchetypeFactory;
+import org.codehaus.mojo.archetypeng.ArchetypePropertiesManager;
+import org.codehaus.mojo.archetypeng.ArchetypeRegistryManager;
+import org.codehaus.mojo.archetypeng.Constants;
+import org.codehaus.mojo.archetypeng.exception.ArchetypeGenerationConfigurationFailure;
+import org.codehaus.mojo.archetypeng.exception.ArchetypeNotDefined;
+import org.codehaus.mojo.archetypeng.exception.UnknownArchetype;
+import org.codehaus.mojo.archetypeng.registry.ArchetypeRegistry;
+import org.codehaus.plexus.util.StringUtils;
+
+/**
+ *
+ * @author rafale
+
+ * @requiresProject false
+ * @goal add-groups
+ */
+public class AddGroupsMojo
+extends AbstractMojo
+{
+ /**
+ * @parameter expression="${user.home}/.m2/archetype.xml"
+ */
+ private File archetypeRegistryFile;
+
+ /**
+ * @component
+ */
+ ArchetypeRegistryManager archetypeRegistryManager;
+
+ /**
+ * @parameter expression="${group}"
+ */
+ String group;
+
+ /**
+ * @parameter expression="${groups}"
+ */
+ String groups;
+
+ 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 = archetypeRegistryManager.readArchetypeRegistry(
+ archetypeRegistryFile
+ );
+
+ 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 );
+ }
+ }
+
+}
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/registry/AddGroupsMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/branches/maven-archetypeng/maven-archetypeng-plugin/src/main/java/org/codehaus/mojo/archetypeng/mojos/registry/AddGroupsMojo.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"