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:33:12 UTC
svn commit: r570611 [9/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/ arche...
Added: maven/sandbox/trunk/archetypeng/archetype-generator/src/main/java/org/apache/maven/archetype/generator/DefaultArchetypeGenerator.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-generator/src/main/java/org/apache/maven/archetype/generator/DefaultArchetypeGenerator.java?rev=570611&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-generator/src/main/java/org/apache/maven/archetype/generator/DefaultArchetypeGenerator.java (added)
+++ maven/sandbox/trunk/archetypeng/archetype-generator/src/main/java/org/apache/maven/archetype/generator/DefaultArchetypeGenerator.java Tue Aug 28 19:32:45 2007
@@ -0,0 +1,297 @@
+/*
+ * 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.generator;
+
+import org.apache.maven.archetype.Archetype;
+import org.apache.maven.archetype.ArchetypeDescriptorException;
+import org.apache.maven.archetype.ArchetypeNotFoundException;
+import org.apache.maven.archetype.ArchetypeTemplateProcessingException;
+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.Constants;
+import org.apache.maven.archetype.exception.ArchetypeGenerationFailure;
+import org.apache.maven.archetype.exception.ArchetypeNotConfigured;
+import org.apache.maven.archetype.exception.ArchetypeNotDefined;
+import org.apache.maven.archetype.exception.InvalidPackaging;
+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.artifact.repository.ArtifactRepository;
+
+import org.codehaus.plexus.logging.AbstractLogEnabled;
+import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+
+import org.dom4j.DocumentException;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+/**
+ * @plexus.component
+ */
+public class DefaultArchetypeGenerator
+extends AbstractLogEnabled
+implements ArchetypeGenerator
+{
+ /**
+ * @plexus.requirement
+ */
+ private ArchetypeArtifactManager archetypeArtifactManager;
+
+ /**
+ * @plexus.requirement
+ */
+ private ArchetypeFactory archetypeFactory;
+
+ /**
+ * @plexus.requirement
+ */
+ private ArchetypePropertiesManager archetypePropertiesManager;
+
+ /**
+ * @plexus.requirement
+ */
+ private FilesetArchetypeGenerator filesetGenerator;
+ /**
+ * @plexus.requirement
+ */
+ private Archetype oldArchetype;
+
+ public void generateArchetype (
+ File propertyFile,
+ ArtifactRepository localRepository,
+ List repositories,
+ String basedir
+ )
+ throws IOException,
+ ArchetypeNotDefined,
+ UnknownArchetype,
+ ArchetypeNotConfigured,
+ ProjectDirectoryExists,
+ PomFileExists,
+ OutputFileExists,
+ FileNotFoundException,
+ XmlPullParserException,
+ DocumentException,
+ InvalidPackaging,
+ ArchetypeGenerationFailure
+ {
+ Properties properties = initialiseArchetypeProperties ( 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 ()
+ + ")"
+ );
+ }
+
+ if ( archetypeArtifactManager.isFileSetArchetype (
+ archetypeDefinition.getGroupId (),
+ archetypeDefinition.getArtifactId (),
+ archetypeDefinition.getVersion (),
+ localRepository,
+ repositories
+ )
+ )
+ {
+ processFileSetArchetype (
+ properties,
+ localRepository,
+ basedir,
+ repositories,
+ archetypeDefinition
+ );
+ }
+ else if (
+ archetypeArtifactManager.isOldArchetype (
+ archetypeDefinition.getGroupId (),
+ archetypeDefinition.getArtifactId (),
+ archetypeDefinition.getVersion (),
+ localRepository,
+ repositories
+ )
+ )
+ {
+ processOldArchetype (
+ localRepository,
+ properties,
+ basedir,
+ archetypeDefinition,
+ repositories
+ );
+ }
+ else
+ {
+ throw new ArchetypeGenerationFailure ( "The defined artifact is not an archetype" );
+ }
+ }
+
+ /**Common*/
+ public String getPackageAsDirectory ( String packageName )
+ {
+ return StringUtils.replace ( packageName, ".", "/" );
+ }
+
+ /**Common*/
+ private Properties initialiseArchetypeProperties ( File propertyFile )
+ throws IOException
+ {
+ Properties properties = new Properties ();
+ archetypePropertiesManager.readProperties ( properties, propertyFile );
+ return properties;
+ }
+
+ /**FileSetArchetype*/
+ private void processFileSetArchetype (
+ final Properties properties,
+ final ArtifactRepository localRepository,
+ final String basedir,
+ final List repositories,
+ final ArchetypeDefinition archetypeDefinition
+ )
+ throws UnknownArchetype,
+ ArchetypeNotConfigured,
+ ProjectDirectoryExists,
+ PomFileExists,
+ OutputFileExists,
+ ArchetypeGenerationFailure
+ {
+ File archetypeFile =
+ archetypeArtifactManager.getArchetypeFile (
+ archetypeDefinition.getGroupId (),
+ archetypeDefinition.getArtifactId (),
+ archetypeDefinition.getVersion (),
+ localRepository,
+ repositories
+ );
+
+ filesetGenerator.generateArchetype ( properties, archetypeFile, basedir );
+ }
+
+ /**OldArchetype*/
+ private void processOldArchetype (
+ final ArtifactRepository localRepository,
+ final Properties properties,
+ final String basedir,
+ final ArchetypeDefinition archetypeDefinition,
+ final List repositories
+ )
+ throws UnknownArchetype, ArchetypeGenerationFailure
+ {
+ ArchetypeConfiguration archetypeConfiguration;
+
+ org.apache.maven.archetype.descriptor.ArchetypeDescriptor archetypeDescriptor =
+ archetypeArtifactManager.getOldArchetypeDescriptor (
+ archetypeDefinition.getGroupId (),
+ archetypeDefinition.getArtifactId (),
+ archetypeDefinition.getVersion (),
+ localRepository,
+ repositories
+ );
+ archetypeConfiguration =
+ archetypeFactory.createArchetypeConfiguration ( archetypeDescriptor, properties );
+
+ Map map = new HashMap ();
+
+ map.put ( "basedir", basedir );
+
+ map.put (
+ "package",
+ archetypeConfiguration.getProperties ().getProperty ( Constants.PACKAGE )
+ );
+
+ map.put (
+ "packageName",
+ archetypeConfiguration.getProperties ().getProperty ( Constants.PACKAGE )
+ );
+
+ map.put (
+ "groupId",
+ archetypeConfiguration.getProperties ().getProperty ( Constants.GROUP_ID )
+ );
+
+ map.put (
+ "artifactId",
+ archetypeConfiguration.getProperties ().getProperty ( Constants.ARTIFACT_ID )
+ );
+
+ map.put (
+ "version",
+ archetypeConfiguration.getProperties ().getProperty ( Constants.VERSION )
+ );
+ try
+ {
+ oldArchetype.createArchetype (
+ archetypeDefinition.getGroupId (),
+ archetypeDefinition.getArtifactId (),
+ archetypeDefinition.getVersion (),
+ localRepository,
+ repositories,
+ map
+ );
+ }
+ catch ( ArchetypeDescriptorException ex )
+ {
+ throw new ArchetypeGenerationFailure (
+ "Failed to generate project from the old archetype"
+ );
+ }
+ catch ( ArchetypeTemplateProcessingException ex )
+ {
+ throw new ArchetypeGenerationFailure (
+ "Failed to generate project from the old archetype"
+ );
+ }
+ catch ( ArchetypeNotFoundException ex )
+ {
+ throw new ArchetypeGenerationFailure (
+ "Failed to generate project from the old archetype"
+ );
+ }
+ }
+}
Added: maven/sandbox/trunk/archetypeng/archetype-generator/src/main/java/org/apache/maven/archetype/generator/DefaultArchetypeSelectionQueryer.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-generator/src/main/java/org/apache/maven/archetype/generator/DefaultArchetypeSelectionQueryer.java?rev=570611&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-generator/src/main/java/org/apache/maven/archetype/generator/DefaultArchetypeSelectionQueryer.java (added)
+++ maven/sandbox/trunk/archetypeng/archetype-generator/src/main/java/org/apache/maven/archetype/generator/DefaultArchetypeSelectionQueryer.java Tue Aug 28 19:32:45 2007
@@ -0,0 +1,137 @@
+/*
+ * 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.generator;
+
+import org.apache.maven.archetype.common.Archetype;
+import org.apache.maven.archetype.common.ArchetypeDefinition;
+
+import org.codehaus.plexus.components.interactivity.Prompter;
+import org.codehaus.plexus.components.interactivity.PrompterException;
+import org.codehaus.plexus.logging.AbstractLogEnabled;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @plexus.component
+ */
+public class DefaultArchetypeSelectionQueryer
+extends AbstractLogEnabled
+implements ArchetypeSelectionQueryer
+{
+ /**
+ * @plexus.requirement
+ */
+ private Prompter prompter;
+
+ public boolean confirmSelection ( ArchetypeDefinition archetypeDefinition )
+ throws PrompterException
+ {
+ String query =
+ "Confirm archetype selection: \n" + archetypeDefinition.getGroupId () + "/"
+ + archetypeDefinition.getName () + "\n";
+
+ String answer = prompter.prompt ( query, Arrays.asList ( new String[] { "Y", "N" } ), "Y" );
+
+ return "Y".equalsIgnoreCase ( answer );
+ }
+
+ public Archetype selectArtifact ( List archetypes )
+ throws PrompterException
+ {
+ String query = "Choose archetype:\n";
+ Map answerMap = new HashMap ();
+ List answers = new ArrayList ();
+ Iterator archetypeIterator = archetypes.iterator ();
+ int counter = 1;
+ while ( archetypeIterator.hasNext () )
+ {
+ Archetype archetype = (Archetype) archetypeIterator.next ();
+
+ answerMap.put ( "" + counter, archetype );
+ query +=
+ "" + counter + ": " + archetype.getName () + " (" + archetype.getGroupId () + ":"
+ + archetype.getArtifactId () + ")\n";
+ answers.add ( "" + counter );
+
+ counter++;
+ }
+ query += "Choose a number: ";
+
+ String answer = prompter.prompt ( query, answers );
+
+ return (Archetype) answerMap.get ( answer );
+ }
+
+ public String selectGroup ( List groups )
+ throws PrompterException
+ {
+ String query = "Choose group:\n";
+ Map answerMap = new HashMap ();
+ List answers = new ArrayList ();
+ Iterator groupIterator = groups.iterator ();
+ int counter = 1;
+ while ( groupIterator.hasNext () )
+ {
+ String group = (String) groupIterator.next ();
+
+ answerMap.put ( "" + counter, group );
+ query += "" + counter + ": " + group + "\n";
+ answers.add ( "" + counter );
+
+ counter++;
+ }
+ query += "Choose a number: ";
+
+ String answer = prompter.prompt ( query, answers );
+
+ return (String) answerMap.get ( answer );
+ }
+
+ public String selectVersion ( List archetypeVersions )
+ throws PrompterException
+ {
+ String query = "Choose version: \n";
+ Map answerMap = new HashMap ();
+ List answers = new ArrayList ();
+
+ Iterator archetypeVersionsKeys = archetypeVersions.iterator ();
+ int counter = 1;
+ while ( archetypeVersionsKeys.hasNext () )
+ {
+ String archetypeVersion = (String) archetypeVersionsKeys.next ();
+
+ answerMap.put ( "" + counter, archetypeVersion );
+ query += "" + counter + ": " + archetypeVersion + "\n";
+ answers.add ( "" + counter );
+
+ counter++;
+ }
+ query += "Choose a number: ";
+
+ String answer = prompter.prompt ( query, answers );
+
+ return (String) answerMap.get ( answer );
+ }
+}
Added: maven/sandbox/trunk/archetypeng/archetype-generator/src/main/java/org/apache/maven/archetype/generator/DefaultArchetypeSelector.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-generator/src/main/java/org/apache/maven/archetype/generator/DefaultArchetypeSelector.java?rev=570611&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-generator/src/main/java/org/apache/maven/archetype/generator/DefaultArchetypeSelector.java (added)
+++ maven/sandbox/trunk/archetypeng/archetype-generator/src/main/java/org/apache/maven/archetype/generator/DefaultArchetypeSelector.java Tue Aug 28 19:32:45 2007
@@ -0,0 +1,343 @@
+/*
+ * 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.generator;
+
+import org.apache.maven.archetype.common.Archetype;
+import org.apache.maven.archetype.common.ArchetypeArtifactManager;
+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.ArchetypeNotDefined;
+import org.apache.maven.archetype.exception.ArchetypeSelectionFailure;
+import org.apache.maven.archetype.exception.UnknownArchetype;
+import org.apache.maven.archetype.exception.UnknownGroup;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+
+import org.codehaus.plexus.components.interactivity.PrompterException;
+import org.codehaus.plexus.logging.AbstractLogEnabled;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+import java.util.List;
+import java.util.Properties;
+
+/**
+ * @plexus.component
+ */
+public class DefaultArchetypeSelector
+extends AbstractLogEnabled
+implements ArchetypeSelector
+{
+ /**
+ * @plexus.requirement
+ */
+ private ArchetypeArtifactManager archetypeArtifactManager;
+
+ /**
+ * @plexus.requirement
+ */
+ private ArchetypeFactory archetypeFactory;
+
+ /**
+ * @plexus.requirement
+ */
+ private ArchetypePropertiesManager archetypePropertiesManager;
+
+ /**
+ * @plexus.requirement
+ */
+ private ArchetypeRegistryManager archetypeRegistryManager;
+
+ /**
+ * @plexus.requirement
+ */
+ private ArchetypeSelectionQueryer archetypeSelectionQueryer;
+
+ public void selectArchetype (
+ String archetypeGroupId,
+ String archetypeArtifactId,
+ String archetypeVersion,
+ Boolean interactiveMode,
+ File propertyFile,
+ File archetypeRegistryFile,
+ ArtifactRepository localRepository,
+ List repositories
+ )
+ throws ArchetypeNotDefined,
+ UnknownArchetype,
+ UnknownGroup,
+ IOException,
+ FileNotFoundException,
+ PrompterException,
+ ArchetypeSelectionFailure
+ {
+ Properties properties =
+ initialiseArchetypeId (
+ archetypeGroupId,
+ archetypeArtifactId,
+ archetypeVersion,
+ propertyFile
+ );
+
+ ArchetypeDefinition archetypeDefinition =
+ archetypeFactory.createArchetypeDefinition ( properties );
+
+ if ( interactiveMode.booleanValue () )
+ {
+ if ( archetypeDefinition.isPartiallyDefined () )
+ {
+ getLogger ().debug ( "Archetype is partially defined" );
+ archetypeDefinition.setVersion (
+ archetypeArtifactManager.getReleaseVersion (
+ archetypeDefinition.getGroupId (),
+ archetypeDefinition.getArtifactId (),
+ localRepository,
+ repositories
+ )
+ );
+ }
+ else
+ {
+ getLogger ().debug ( "Archetype is not defined" );
+ }
+
+ List groups = archetypeRegistryManager.getArchetypeGroups ( archetypeRegistryFile );
+
+ while ( !archetypeDefinition.isDefined () && ! groups.isEmpty() )
+ {
+ try
+ {
+ if ( !archetypeDefinition.isGroupDefined () )
+ {
+ getLogger ().debug ( "Archetype group not defined" );
+
+ getLogger ().debug ( "Groups=" + groups );
+
+ archetypeDefinition.setGroupId (
+ archetypeSelectionQueryer.selectGroup ( groups )
+ );
+ }
+ else
+ {
+ getLogger ().debug (
+ "Archetype group: " + archetypeDefinition.getGroupId ()
+ );
+ }
+
+ if ( !archetypeDefinition.isArtifactDefined () )
+ {
+ getLogger ().debug ( "Archetype artifact not defined" );
+
+ List archetypes =
+ archetypeArtifactManager.getArchetypes (
+ archetypeDefinition.getGroupId (),
+ localRepository,
+ repositories
+ );
+ getLogger ().debug ( "Archetypes=" + archetypes );
+
+ if ( !archetypes.isEmpty() )
+ {
+ Archetype archetype =
+ archetypeSelectionQueryer.selectArtifact ( archetypes );
+
+ archetypeDefinition.setArtifactId ( archetype.getArtifactId () );
+ archetypeDefinition.setName ( archetype.getName () );
+ }
+ else
+ {
+ getLogger ().info (
+ "The group " + archetypeDefinition.getGroupId () + " defines no archetype"
+ );
+
+ groups.remove ( archetypeDefinition.getGroupId () );
+ archetypeDefinition.setGroupId ( null );
+ }
+ }
+ else
+ {
+ getLogger ().debug (
+ "Archetype artifact: " + archetypeDefinition.getArtifactId ()
+ );
+ }
+
+ if ( archetypeDefinition.isPartiallyDefined () )
+ {
+ getLogger ().debug ( "Archetype version not defined" );
+
+ List versions =
+ archetypeArtifactManager.getVersions (
+ archetypeDefinition.getGroupId (),
+ archetypeDefinition.getArtifactId (),
+ localRepository,
+ repositories
+ );
+ getLogger ().debug ( "Versions=" + versions );
+
+ archetypeDefinition.setVersion (
+ archetypeSelectionQueryer.selectVersion ( versions )
+ );
+ }
+ else
+ {
+ getLogger ().debug (
+ "Archetype version: " + archetypeDefinition.getVersion ()
+ );
+ }
+
+ if ( !archetypeDefinition.isGroupDefined () )
+ {
+ getLogger ().debug ( "Archetype group problem" );
+ }
+ else if ( !archetypeDefinition.isDefined () )
+ {
+ throw new ArchetypeSelectionFailure (
+ "The archetype must be selected here"
+ );
+ }
+ else if ( !archetypeSelectionQueryer.confirmSelection ( archetypeDefinition ) )
+ {
+ getLogger ().debug ( "Archetype selection not confirmed" );
+ archetypeDefinition.reset ();
+ }
+ else
+ {
+ getLogger ().debug ( "Archetype selection confirmed" );
+ }
+ }
+ catch ( UnknownGroup e )
+ {
+ getLogger ().warn ( "Unknown group" );
+ archetypeDefinition.reset ();
+ }
+ catch ( UnknownArchetype e )
+ {
+ getLogger ().warn ( "Unknown archetype" );
+ archetypeDefinition.reset ();
+ }
+ } // end while
+
+ if ( groups.isEmpty() )
+ {
+ throw new UnknownGroup ( "No registered group contain an archetype" );
+ }
+ }
+ else
+ {
+ if ( !archetypeDefinition.isDefined () )
+ {
+ if ( !archetypeDefinition.isPartiallyDefined () )
+ {
+ throw new ArchetypeNotDefined ( "The archetype is not defined" );
+ }
+ else
+ {
+ getLogger ().debug ( "Archetype is partially defined" );
+ archetypeDefinition.setVersion (
+ archetypeArtifactManager.getReleaseVersion (
+ archetypeDefinition.getGroupId (),
+ archetypeDefinition.getArtifactId (),
+ localRepository,
+ repositories
+ )
+ );
+ getLogger ().info (
+ "Using default version " + archetypeDefinition.getVersion ()
+ );
+ }
+ }
+ if ( !archetypeDefinition.isDefined () )
+ {
+ throw new ArchetypeSelectionFailure ( "The archetype must be selected here" );
+ }
+ else
+ {
+ getLogger ().info (
+ "Archetype selected (" + archetypeDefinition.getGroupId () + ":"
+ + archetypeDefinition.getArtifactId () + ":" + archetypeDefinition
+ .getVersion () + ")"
+ );
+ }
+ } // end if
+
+ 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 ()
+ + ")"
+ );
+ }
+ else
+ {
+ archetypePropertiesManager.writeProperties (
+ archetypeDefinition.toProperties (),
+ propertyFile
+ );
+ }
+ }
+
+ private Properties initialiseArchetypeId (
+ String archetypeGroupId,
+ String archetypeArtifactId,
+ String archetypeVersion,
+ File propertyFile
+ )
+ throws IOException
+ {
+ Properties properties = new Properties ();
+ try
+ {
+ archetypePropertiesManager.readProperties ( properties, propertyFile );
+ }
+ catch ( FileNotFoundException e )
+ {
+ getLogger ().debug ( "archetype.properties does not exist" );
+ }
+
+ if ( archetypeGroupId != null )
+ {
+ properties.setProperty ( Constants.ARCHETYPE_GROUP_ID, archetypeGroupId );
+ }
+
+ if ( archetypeArtifactId != null )
+ {
+ properties.setProperty ( Constants.ARCHETYPE_ARTIFACT_ID, archetypeArtifactId );
+ }
+
+ if ( archetypeVersion != null )
+ {
+ properties.setProperty ( Constants.ARCHETYPE_VERSION, archetypeVersion );
+ }
+
+ return properties;
+ }
+}
Added: maven/sandbox/trunk/archetypeng/archetype-generator/src/main/java/org/apache/maven/archetype/generator/DefaultFilesetArchetypeGenerator.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-generator/src/main/java/org/apache/maven/archetype/generator/DefaultFilesetArchetypeGenerator.java?rev=570611&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-generator/src/main/java/org/apache/maven/archetype/generator/DefaultFilesetArchetypeGenerator.java (added)
+++ maven/sandbox/trunk/archetypeng/archetype-generator/src/main/java/org/apache/maven/archetype/generator/DefaultFilesetArchetypeGenerator.java Tue Aug 28 19:32:45 2007
@@ -0,0 +1,776 @@
+/*
+ * 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.generator;
+
+import org.apache.maven.archetype.common.ArchetypeArtifactManager;
+import org.apache.maven.archetype.common.ArchetypeConfiguration;
+import org.apache.maven.archetype.common.ArchetypeFactory;
+import org.apache.maven.archetype.common.ArchetypeFilesResolver;
+import org.apache.maven.archetype.common.Constants;
+import org.apache.maven.archetype.common.PomManager;
+import org.apache.maven.archetype.exception.ArchetypeGenerationFailure;
+import org.apache.maven.archetype.exception.ArchetypeNotConfigured;
+import org.apache.maven.archetype.exception.InvalidPackaging;
+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.metadata.AbstractArchetypeDescriptor;
+import org.apache.maven.archetype.metadata.ArchetypeDescriptor;
+import org.apache.maven.archetype.metadata.FileSet;
+import org.apache.maven.archetype.metadata.ModuleDescriptor;
+
+import org.apache.velocity.VelocityContext;
+import org.apache.velocity.context.Context;
+
+import org.codehaus.plexus.logging.AbstractLogEnabled;
+import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+import org.codehaus.plexus.velocity.VelocityComponent;
+
+import org.dom4j.DocumentException;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+/**
+ * @plexus.component
+ */
+public class DefaultFilesetArchetypeGenerator
+extends AbstractLogEnabled
+implements FilesetArchetypeGenerator
+{
+ /**
+ * @plexus.requirement
+ */
+ private ArchetypeArtifactManager archetypeArtifactManager;
+
+ /**
+ * @plexus.requirement
+ */
+ private ArchetypeFactory archetypeFactory;
+
+ /**
+ * @plexus.requirement
+ */
+ private ArchetypeFilesResolver archetypeFilesResolver;
+
+ /**
+ * @plexus.requirement
+ */
+ private PomManager pomManager;
+
+ /**
+ * @plexus.requirement
+ */
+ private VelocityComponent velocity;
+
+ public void generateArchetype ( Properties properties, File archetypeFile, String basedir )
+ throws UnknownArchetype,
+ ArchetypeNotConfigured,
+ ProjectDirectoryExists,
+ PomFileExists,
+ OutputFileExists,
+ ArchetypeGenerationFailure
+ {
+ ClassLoader old = Thread.currentThread ().getContextClassLoader ();
+
+ try
+ {
+ ArchetypeDescriptor archetypeDescriptor =
+ archetypeArtifactManager.getFileSetArchetypeDescriptor ( archetypeFile );
+ ArchetypeConfiguration archetypeConfiguration =
+ archetypeFactory.createArchetypeConfiguration ( archetypeDescriptor, properties );
+
+ if ( !archetypeConfiguration.isConfigured () )
+ {
+ throw new ArchetypeNotConfigured ( "The archetype is not configured" );
+ }
+
+ Context context = prepareVelocityContext ( archetypeConfiguration );
+ String packageName =
+ archetypeConfiguration.getProperties ().getProperty ( Constants.PACKAGE );
+
+ String artifactId =
+ archetypeConfiguration.getProperties ().getProperty ( Constants.ARTIFACT_ID );
+ File outputDirectoryFile = new File ( basedir, artifactId );
+ File basedirPom = new File ( basedir, Constants.ARCHETYPE_POM );
+ File pom = new File ( outputDirectoryFile, Constants.ARCHETYPE_POM );
+
+ List archetypeResources =
+ archetypeArtifactManager.getFilesetArchetypeResources ( archetypeFile );
+
+ ZipFile archetypeZipFile =
+ archetypeArtifactManager.getArchetypeZipFile ( archetypeFile );
+
+ ClassLoader archetypeJarLoader =
+ archetypeArtifactManager.getArchetypeJarLoader ( archetypeFile );
+
+ Thread.currentThread ().setContextClassLoader ( archetypeJarLoader );
+
+ if ( archetypeDescriptor.isPartial () )
+ {
+ getLogger ().debug (
+ "Procesing partial archetype " + archetypeDescriptor.getId ()
+ );
+ if ( outputDirectoryFile.exists () )
+ {
+ if ( !pom.exists () )
+ {
+ throw new PomFileExists (
+ "This is a partial archetype and the pom.xml file doesn't exist."
+ );
+ }
+ else
+ {
+ processPomWithMerge ( context, pom, "" );
+ processArchetypeTemplatesWithWarning (
+ archetypeDescriptor,
+ archetypeResources,
+ archetypeZipFile,
+ "",
+ context,
+ packageName,
+ outputDirectoryFile
+ );
+ }
+ }
+ else
+ {
+ if ( basedirPom.exists () )
+ {
+ processPomWithMerge ( context, basedirPom, "" );
+ processArchetypeTemplatesWithWarning (
+ archetypeDescriptor,
+ archetypeResources,
+ archetypeZipFile,
+ "",
+ context,
+ packageName,
+ new File ( basedir )
+ );
+ }
+ else
+ {
+ processPom ( context, pom, "" );
+ processArchetypeTemplates (
+ archetypeDescriptor,
+ archetypeResources,
+ archetypeZipFile,
+ "",
+ context,
+ packageName,
+ outputDirectoryFile
+ );
+ }
+ }
+
+ if ( archetypeDescriptor.getModules ().size () > 0 )
+ {
+ getLogger ().info ( "Modules ignored in partial mode" );
+ }
+ }
+ else
+ {
+ getLogger ().debug (
+ "Processing complete archetype " + archetypeDescriptor.getId ()
+ );
+ if ( outputDirectoryFile.exists () )
+ {
+ throw new ProjectDirectoryExists ( "The project directory already exists" );
+ }
+ else
+ {
+ processFilesetModule (
+ artifactId,
+ archetypeResources,
+ pom,
+ archetypeZipFile,
+ "",
+ basedirPom,
+ outputDirectoryFile,
+ packageName,
+ archetypeDescriptor,
+ context
+ );
+ }
+ } // end if
+ }
+ catch ( FileNotFoundException ex )
+ {
+ throw new ArchetypeGenerationFailure ( ex );
+ }
+ catch ( IOException ex )
+ {
+ throw new ArchetypeGenerationFailure ( ex );
+ }
+ catch ( XmlPullParserException ex )
+ {
+ throw new ArchetypeGenerationFailure ( ex );
+ }
+ catch ( DocumentException ex )
+ {
+ throw new ArchetypeGenerationFailure ( ex );
+ }
+ catch ( ArchetypeGenerationFailure ex )
+ {
+ throw new ArchetypeGenerationFailure ( ex );
+ }
+ catch ( InvalidPackaging ex )
+ {
+ throw new ArchetypeGenerationFailure ( ex );
+ }
+ finally
+ {
+ Thread.currentThread ().setContextClassLoader ( old );
+ }
+ }
+
+ public String getPackageAsDirectory ( String packageName )
+ {
+ return StringUtils.replace ( packageName, ".", "/" );
+ }
+
+ private void copyFile (
+ final File outFile,
+ final String template,
+ final boolean failIfExists,
+ final ZipFile archetypeZipFile
+ )
+ throws FileNotFoundException, OutputFileExists, IOException
+ {
+ getLogger ().debug ( "Copying file " + template );
+
+ if ( failIfExists && outFile.exists () )
+ {
+ throw new OutputFileExists ( "Don't rewrite file " + outFile.getName () );
+ }
+ else if ( outFile.exists () )
+ {
+ getLogger ().warn ( "CP Don't override file " + outFile );
+ }
+ else
+ {
+ ZipEntry input =
+ archetypeZipFile.getEntry ( Constants.ARCHETYPE_RESOURCES + "/" + template );
+
+ InputStream inputStream = archetypeZipFile.getInputStream ( input );
+
+ outFile.getParentFile ().mkdirs ();
+
+ IOUtil.copy ( inputStream, new FileOutputStream ( outFile ) );
+ }
+ }
+
+ private void copyFiles (
+ String directory,
+ List fileSetResources,
+ boolean packaged,
+ String packageName,
+ File outputDirectoryFile,
+ ZipFile archetypeZipFile,
+ String moduleOffset,
+ boolean failIfExists
+ )
+ throws OutputFileExists, FileNotFoundException, IOException
+ {
+ Iterator iterator = fileSetResources.iterator ();
+
+ while ( iterator.hasNext () )
+ {
+ String template = (String) iterator.next ();
+
+ String templateName = StringUtils.replaceOnce ( template, directory + "/", "" );
+
+ if ( !StringUtils.isEmpty ( moduleOffset ) )
+ {
+ templateName = StringUtils.replaceOnce ( templateName, moduleOffset + "/", "" );
+ }
+ templateName = StringUtils.replace ( templateName, File.separator, "/" );
+
+ File outFile =
+ new File (
+ outputDirectoryFile, /*(StringUtils.isEmpty
+ * (moduleOffset)?"":moduleOffset+"/")+*/
+ directory + "/" + ( packaged ? getPackageAsDirectory ( packageName ) : "" )
+ + "/" + templateName
+ );
+
+ copyFile ( outFile, template, failIfExists, archetypeZipFile );
+ } // end while
+ }
+
+ private String getEncoding ( String archetypeEncoding )
+ {
+ return
+ ( ( null == archetypeEncoding ) || "".equals ( archetypeEncoding ) )
+ ? "UTF-8"
+ : archetypeEncoding;
+ }
+
+ private String getOffsetSeparator ( String moduleOffset )
+ {
+ return ( StringUtils.isEmpty ( moduleOffset ) ? "/" : ( "/" + moduleOffset + "/" ) );
+ }
+
+ private void setParentArtifactId ( Context context, String artifactId )
+ {
+ context.put ( Constants.PARENT_ARTIFACT_ID, artifactId );
+ }
+
+ private Context prepareVelocityContext ( ArchetypeConfiguration archetypeConfiguration )
+ {
+ Context context = new VelocityContext ();
+ Iterator iterator = archetypeConfiguration.getProperties ().keySet ().iterator ();
+ while ( iterator.hasNext () )
+ {
+ String key = (String) iterator.next ();
+
+ Object value = archetypeConfiguration.getProperties ().getProperty ( key );
+
+ context.put ( key, value );
+ }
+ return context;
+ }
+
+ private void processArchetypeTemplates (
+ AbstractArchetypeDescriptor archetypeDescriptor,
+ List archetypeResources,
+ ZipFile archetypeZipFile,
+ String moduleOffset,
+ Context context,
+ String packageName,
+ File outputDirectoryFile
+ )
+ throws OutputFileExists, ArchetypeGenerationFailure, FileNotFoundException, IOException
+ {
+ processTemplates (
+ packageName,
+ outputDirectoryFile,
+ context,
+ archetypeDescriptor,
+ archetypeResources,
+ archetypeZipFile,
+ moduleOffset,
+ false
+ );
+ }
+
+ private void processArchetypeTemplatesWithWarning (
+ org.apache.maven.archetype.metadata.ArchetypeDescriptor archetypeDescriptor,
+ List archetypeResources,
+ ZipFile archetypeZipFile,
+ String moduleOffset,
+ Context context,
+ String packageName,
+ File outputDirectoryFile
+ )
+ throws OutputFileExists, ArchetypeGenerationFailure, FileNotFoundException, IOException
+ {
+ processTemplates (
+ packageName,
+ outputDirectoryFile,
+ context,
+ archetypeDescriptor,
+ archetypeResources,
+ archetypeZipFile,
+ moduleOffset,
+ true
+ );
+ }
+
+ private void processFileSet (
+ String directory,
+ List fileSetResources,
+ boolean packaged,
+ String packageName,
+ Context context,
+ File outputDirectoryFile,
+ String moduleOffset,
+ String archetypeEncoding,
+ boolean failIfExists
+ )
+ throws OutputFileExists, ArchetypeGenerationFailure
+ {
+ Iterator iterator = fileSetResources.iterator ();
+
+ while ( iterator.hasNext () )
+ {
+ String template = (String) iterator.next ();
+
+ String templateName = StringUtils.replaceOnce ( template, directory, "" );
+
+ processTemplate (
+ new File (
+ outputDirectoryFile,
+ directory + "/" + ( packaged ? getPackageAsDirectory ( packageName ) : "" )
+ + "/" + templateName.substring ( moduleOffset.length () )
+ ),
+ context,
+ Constants.ARCHETYPE_RESOURCES + "/" /*+
+ *getOffsetSeparator(moduleOffset)*/ + template,
+ archetypeEncoding,
+ failIfExists
+ );
+ } // end while
+ }
+
+ private void processFilesetModule (
+ String artifactId,
+ final List archetypeResources,
+ File pom,
+ final ZipFile archetypeZipFile,
+ String moduleOffset,
+ File basedirPom,
+ File outputDirectoryFile,
+ final String packageName,
+ final AbstractArchetypeDescriptor archetypeDescriptor,
+ final Context context
+ )
+ throws DocumentException,
+ XmlPullParserException,
+ ArchetypeGenerationFailure,
+ InvalidPackaging,
+ IOException,
+ OutputFileExists
+ {
+ outputDirectoryFile.mkdirs ();
+ getLogger ().debug ( "Processing " + artifactId );
+
+ processFilesetProject (
+ archetypeDescriptor,
+ artifactId,
+ archetypeResources,
+ pom,
+ archetypeZipFile,
+ moduleOffset,
+ context,
+ packageName,
+ outputDirectoryFile,
+ basedirPom
+ );
+
+ String parentArtifactId = (String) context.get ( Constants.PARENT_ARTIFACT_ID );
+ Iterator subprojects = archetypeDescriptor.getModules ().iterator ();
+ if ( subprojects.hasNext () )
+ {
+ getLogger ().debug (
+ artifactId + " has modules (" + archetypeDescriptor.getModules () + ")"
+ );
+ setParentArtifactId ( context, artifactId );
+ }
+ while ( subprojects.hasNext () )
+ {
+ ModuleDescriptor project = (ModuleDescriptor) subprojects.next ();
+
+ artifactId = project.getId ();
+
+ File moduleOutputDirectoryFile = new File ( outputDirectoryFile, artifactId );
+ context.put ( Constants.ARTIFACT_ID, artifactId );
+ processFilesetModule (
+ artifactId,
+ archetypeResources,
+ new File ( moduleOutputDirectoryFile, Constants.ARCHETYPE_POM ),
+ archetypeZipFile,
+ ( StringUtils.isEmpty ( moduleOffset ) ? "" : ( moduleOffset + "/" ) ) + artifactId,
+ pom,
+ moduleOutputDirectoryFile,
+ packageName,
+ project,
+ context
+ );
+ }
+ restoreParentArtifactId ( context, parentArtifactId );
+ getLogger ().debug ( "Processed " + artifactId );
+ }
+
+ private void processFilesetProject (
+ final AbstractArchetypeDescriptor archetypeDescriptor,
+ final String artifactId,
+ final List archetypeResources,
+ final File pom,
+ final ZipFile archetypeZipFile,
+ String moduleOffset,
+ final Context context,
+ final String packageName,
+ final File outputDirectoryFile,
+ final File basedirPom
+ )
+ throws DocumentException,
+ XmlPullParserException,
+ ArchetypeGenerationFailure,
+ InvalidPackaging,
+ IOException,
+ FileNotFoundException,
+ OutputFileExists
+ {
+ if ( basedirPom.exists () )
+ {
+ processPomWithParent (
+
+ context,
+ pom,
+ moduleOffset,
+ basedirPom,
+ artifactId
+ );
+ }
+ else
+ {
+ processPom ( context, pom, moduleOffset );
+ }
+
+ processArchetypeTemplates (
+ archetypeDescriptor,
+ archetypeResources,
+ archetypeZipFile,
+ moduleOffset,
+ context,
+ packageName,
+ outputDirectoryFile
+ );
+ }
+
+ private void processPom ( Context context, File pom, String moduleOffset )
+ throws OutputFileExists, ArchetypeGenerationFailure
+ {
+ getLogger ().debug ( "Processing pom " + pom );
+ processTemplate (
+ pom,
+ context,
+ Constants.ARCHETYPE_RESOURCES + getOffsetSeparator ( moduleOffset )
+ + Constants.ARCHETYPE_POM,
+ getEncoding ( null ),
+ true
+ );
+ }
+
+ private void processPomWithMerge ( Context context, File pom, String moduleOffset )
+ throws OutputFileExists, IOException, XmlPullParserException, ArchetypeGenerationFailure
+ {
+ getLogger ().debug ( "Processing pom " + pom + " with merge" );
+
+ File temporaryPom = getTemporaryFile ( pom );
+
+ processTemplate (
+ temporaryPom,
+ context,
+ Constants.ARCHETYPE_RESOURCES + getOffsetSeparator ( moduleOffset )
+ + Constants.ARCHETYPE_POM,
+ getEncoding ( null ),
+ true
+ );
+
+ pomManager.mergePoms ( pom, temporaryPom );
+
+ // getTemporaryFile sets deleteOnExit. Lets try to delete and then make sure deleteOnExit is
+ // still set. Windows has issues deleting files with certain JDKs.
+ try
+ {
+ FileUtils.forceDelete ( temporaryPom );
+ }
+ catch ( IOException e )
+ {
+ temporaryPom.deleteOnExit ();
+ }
+ }
+
+ private void processPomWithParent (
+ Context context,
+ File pom,
+ String moduleOffset,
+ File basedirPom,
+ String artifactId
+ )
+ throws OutputFileExists,
+ FileNotFoundException,
+ XmlPullParserException,
+ DocumentException,
+ IOException,
+ InvalidPackaging,
+ ArchetypeGenerationFailure
+ {
+ getLogger ().debug ( "Processing pom " + pom + " with parent " + basedirPom );
+ processTemplate (
+ pom,
+ context,
+ Constants.ARCHETYPE_RESOURCES + getOffsetSeparator ( moduleOffset )
+ + Constants.ARCHETYPE_POM,
+ getEncoding ( null ),
+ true
+ );
+
+ if ( StringUtils.isEmpty ( moduleOffset ) )
+ {
+ getLogger ().debug ( "Adding module " + artifactId );
+ pomManager.addModule ( basedirPom, artifactId );
+ pomManager.addParent ( pom, basedirPom );
+ }
+ }
+
+ private void processTemplate (
+ File outFile,
+ Context context,
+ String templateFileName,
+ String encoding,
+ boolean failIfExists
+ )
+ throws OutputFileExists, ArchetypeGenerationFailure
+ {
+ templateFileName = templateFileName.replace ( File.separatorChar, '/' );
+
+ getLogger ().debug ( "Prosessing template " + templateFileName );
+
+ if ( failIfExists && outFile.exists () )
+ {
+ throw new OutputFileExists ( "Don't rewrite file " + outFile.getAbsolutePath () );
+ }
+ else if ( outFile.exists () )
+ {
+ getLogger ().warn ( "PT Don't override file " + outFile );
+ }
+ else
+ {
+ if ( !outFile.getParentFile ().exists () )
+ {
+ outFile.getParentFile ().mkdirs ();
+ }
+
+ getLogger ().debug ( "Merging into " + outFile );
+
+ Writer writer = null;
+
+ try
+ {
+ writer = new OutputStreamWriter ( new FileOutputStream ( outFile ), encoding );
+
+ velocity.getEngine ().mergeTemplate ( templateFileName, encoding, context, writer );
+
+ writer.flush ();
+ }
+ catch ( Exception e )
+ {
+ throw new ArchetypeGenerationFailure (
+ "Error merging velocity templates: " + e.getMessage (),
+ e
+ );
+ }
+ finally
+ {
+ IOUtil.close ( writer );
+ writer = null;
+ }
+ }
+ }
+
+ private void processTemplates (
+ String packageName,
+ File outputDirectoryFile,
+ Context context,
+ AbstractArchetypeDescriptor archetypeDescriptor,
+ List archetypeResources,
+ ZipFile archetypeZipFile,
+ String moduleOffset,
+ boolean failIfExists
+ )
+ throws OutputFileExists, ArchetypeGenerationFailure, FileNotFoundException, IOException
+ {
+ Iterator iterator = archetypeDescriptor.getFileSets ().iterator ();
+ if ( iterator.hasNext () )
+ {
+ getLogger ().debug ( "Processing filesets" );
+ }
+ while ( iterator.hasNext () )
+ {
+ FileSet fileSet = (FileSet) iterator.next ();
+
+ List fileSetResources =
+ archetypeFilesResolver.filterFiles ( moduleOffset, fileSet, archetypeResources );
+
+ if ( fileSet.isFiltered () )
+ {
+ getLogger ().debug (
+ "Processing fileset " + fileSet + "\n\n\n\n" + fileSetResources + "\n\n"
+ + archetypeResources + "\n\n"
+ );
+ processFileSet (
+ fileSet.getDirectory (),
+ fileSetResources,
+ fileSet.isPackaged (),
+ packageName,
+ context,
+ outputDirectoryFile,
+ moduleOffset,
+ getEncoding ( fileSet.getEncoding () ),
+ failIfExists
+ );
+ getLogger ().debug ( "Processed " + fileSetResources.size () + " files" );
+ }
+ else
+ {
+ getLogger ().debug ( "Copying fileset " + fileSet );
+ copyFiles (
+ fileSet.getDirectory (),
+ fileSetResources,
+ fileSet.isPackaged (),
+ packageName,
+ outputDirectoryFile,
+ archetypeZipFile,
+ moduleOffset,
+ failIfExists
+ );
+ getLogger ().debug ( "Copied " + fileSetResources.size () + " files" );
+ }
+ } // end while
+ }
+
+ private void restoreParentArtifactId ( Context context, String parentArtifactId )
+ {
+ if ( StringUtils.isEmpty ( parentArtifactId ) )
+ {
+ context.remove ( Constants.PARENT_ARTIFACT_ID );
+ }
+ else
+ {
+ context.put ( Constants.PARENT_ARTIFACT_ID, parentArtifactId );
+ }
+ }
+
+ private File getTemporaryFile ( File file )
+ {
+ File tmp =
+ FileUtils.createTempFile ( file.getName (), Constants.TMP, file.getParentFile () );
+ tmp.deleteOnExit ();
+ return tmp;
+ }
+}
Added: maven/sandbox/trunk/archetypeng/archetype-generator/src/main/java/org/apache/maven/archetype/generator/FilesetArchetypeGenerator.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-generator/src/main/java/org/apache/maven/archetype/generator/FilesetArchetypeGenerator.java?rev=570611&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-generator/src/main/java/org/apache/maven/archetype/generator/FilesetArchetypeGenerator.java (added)
+++ maven/sandbox/trunk/archetypeng/archetype-generator/src/main/java/org/apache/maven/archetype/generator/FilesetArchetypeGenerator.java Tue Aug 28 19:32:45 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.generator;
+
+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 java.io.File;
+
+import java.util.Properties;
+
+/**
+ * @author rafale
+ */
+public interface FilesetArchetypeGenerator
+{
+ String ROLE = FilesetArchetypeGenerator.class.getName ();
+
+ void generateArchetype ( Properties properties, File archetypeFile, String basedir )
+ throws UnknownArchetype,
+ ArchetypeNotConfigured,
+ ProjectDirectoryExists,
+ PomFileExists,
+ OutputFileExists,
+ ArchetypeGenerationFailure;
+}
Added: maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/basic-1.0/META-INF/maven/archetype-metadata.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/basic-1.0/META-INF/maven/archetype-metadata.xml?rev=570611&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/basic-1.0/META-INF/maven/archetype-metadata.xml (added)
+++ maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/basic-1.0/META-INF/maven/archetype-metadata.xml Tue Aug 28 19:32:45 2007
@@ -0,0 +1,92 @@
+<?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.
+-->
+<archetype-descriptor id="basic" >
+
+ <requiredProperties>
+ <requiredProperty key="property-with-default-1" >
+ <defaultValue>default-value</defaultValue>
+ </requiredProperty>
+ <requiredProperty key="property-with-default-2" >
+ <defaultValue>default-value</defaultValue>
+ </requiredProperty>
+ <requiredProperty key="property-with-default-3" >
+ <defaultValue>default-value</defaultValue>
+ </requiredProperty>
+ <requiredProperty key="property-with-default-4" >
+ <defaultValue>default-value</defaultValue>
+ </requiredProperty>
+ <requiredProperty key="property-without-default-1" />
+ <requiredProperty key="property-without-default-2" />
+ <requiredProperty key="property-without-default-3" />
+ <requiredProperty key="property-without-default-4" />
+ </requiredProperties>
+
+ <fileSets>
+ <fileSet filtered="true" packaged="true" >
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**/*.java</include>
+ </includes>
+ </fileSet>
+ <fileSet filtered="true" packaged="true" >
+ <directory>src/main/c</directory>
+ <includes>
+ <include>**/*.c</include>
+ </includes>
+ </fileSet>
+ <fileSet filtered="true" packaged="true" >
+ <directory>src/test/java</directory>
+ <includes>
+ <include>**/*.java</include>
+ </includes>
+ </fileSet>
+ <fileSet filtered="true" packaged="true" >
+ <directory>src/test/c</directory>
+ <includes>
+ <include>**/*.c</include>
+ </includes>
+ </fileSet>
+ <fileSet filtered="true" packaged="false" >
+ <directory>src/main/resources</directory>
+ <includes>
+ <include>**/*.properties</include>
+ </includes>
+ </fileSet>
+ <fileSet filtered="true" packaged="false" >
+ <directory>src/main/mdo</directory>
+ <includes>
+ <include>**/*.mdo</include>
+ </includes>
+ </fileSet>
+ <fileSet filtered="true" packaged="false" >
+ <directory>src/test/resources</directory>
+ <includes>
+ <include>**/*.properties</include>
+ </includes>
+ </fileSet>
+ <fileSet filtered="true" packaged="false" >
+ <directory>src/test/mdo</directory>
+ <includes>
+ <include>**/*.mdo</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+
+</archetype-descriptor>
Added: maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/basic-1.0/archetype-resources/pom.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/basic-1.0/archetype-resources/pom.xml?rev=570611&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/basic-1.0/archetype-resources/pom.xml (added)
+++ maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/basic-1.0/archetype-resources/pom.xml Tue Aug 28 19:32:45 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>${groupId}</groupId>
+ <artifactId>${artifactId}</artifactId>
+ <version>${version}</version>
+
+ <name>Maven ArchetypeNG Test</name>
+ <packaging>jar</packaging>
+
+</project>
\ No newline at end of file
Added: maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/basic-1.0/archetype-resources/src/main/c/App.c
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/basic-1.0/archetype-resources/src/main/c/App.c?rev=570611&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/basic-1.0/archetype-resources/src/main/c/App.c (added)
+++ maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/basic-1.0/archetype-resources/src/main/c/App.c Tue Aug 28 19:32:45 2007
@@ -0,0 +1,12 @@
+groupId=${groupId}
+artifactId=${artifactId}
+version=${version}
+package=${package}
+property-without-default-1=${property-without-default-1}
+property-without-default-2=${property-without-default-2}
+property-without-default-3=${property-without-default-3}
+property-without-default-4=${property-without-default-4}
+property-with-default-1=${property-with-default-1}
+property-with-default-2=${property-with-default-2}
+property-with-default-3=${property-with-default-3}
+property-with-default-4=${property-with-default-4}
Added: maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/basic-1.0/archetype-resources/src/main/java/App.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/basic-1.0/archetype-resources/src/main/java/App.java?rev=570611&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/basic-1.0/archetype-resources/src/main/java/App.java (added)
+++ maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/basic-1.0/archetype-resources/src/main/java/App.java Tue Aug 28 19:32:45 2007
@@ -0,0 +1,12 @@
+groupId=${groupId}
+artifactId=${artifactId}
+version=${version}
+package=${package}
+property-without-default-1=${property-without-default-1}
+property-without-default-2=${property-without-default-2}
+property-without-default-3=${property-without-default-3}
+property-without-default-4=${property-without-default-4}
+property-with-default-1=${property-with-default-1}
+property-with-default-2=${property-with-default-2}
+property-with-default-3=${property-with-default-3}
+property-with-default-4=${property-with-default-4}
\ No newline at end of file
Added: maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/basic-1.0/archetype-resources/src/main/java/inner/package/App2.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/basic-1.0/archetype-resources/src/main/java/inner/package/App2.java?rev=570611&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/basic-1.0/archetype-resources/src/main/java/inner/package/App2.java (added)
+++ maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/basic-1.0/archetype-resources/src/main/java/inner/package/App2.java Tue Aug 28 19:32:45 2007
@@ -0,0 +1,12 @@
+groupId=${groupId}
+artifactId=${artifactId}
+version=${version}
+package=${package}
+property-without-default-1=${property-without-default-1}
+property-without-default-2=${property-without-default-2}
+property-without-default-3=${property-without-default-3}
+property-without-default-4=${property-without-default-4}
+property-with-default-1=${property-with-default-1}
+property-with-default-2=${property-with-default-2}
+property-with-default-3=${property-with-default-3}
+property-with-default-4=${property-with-default-4}
\ No newline at end of file
Added: maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/basic-1.0/archetype-resources/src/main/mdo/App.mdo
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/basic-1.0/archetype-resources/src/main/mdo/App.mdo?rev=570611&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/basic-1.0/archetype-resources/src/main/mdo/App.mdo (added)
+++ maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/basic-1.0/archetype-resources/src/main/mdo/App.mdo Tue Aug 28 19:32:45 2007
@@ -0,0 +1,12 @@
+groupId=${groupId}
+artifactId=${artifactId}
+version=${version}
+package=${package}
+property-without-default-1=${property-without-default-1}
+property-without-default-2=${property-without-default-2}
+property-without-default-3=${property-without-default-3}
+property-without-default-4=${property-without-default-4}
+property-with-default-1=${property-with-default-1}
+property-with-default-2=${property-with-default-2}
+property-with-default-3=${property-with-default-3}
+property-with-default-4=${property-with-default-4}
\ No newline at end of file
Added: maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/basic-1.0/archetype-resources/src/main/resources/App.properties
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/basic-1.0/archetype-resources/src/main/resources/App.properties?rev=570611&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/basic-1.0/archetype-resources/src/main/resources/App.properties (added)
+++ maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/basic-1.0/archetype-resources/src/main/resources/App.properties Tue Aug 28 19:32:45 2007
@@ -0,0 +1,12 @@
+groupId=${groupId}
+artifactId=${artifactId}
+version=${version}
+package=${package}
+property-without-default-1=${property-without-default-1}
+property-without-default-2=${property-without-default-2}
+property-without-default-3=${property-without-default-3}
+property-without-default-4=${property-without-default-4}
+property-with-default-1=${property-with-default-1}
+property-with-default-2=${property-with-default-2}
+property-with-default-3=${property-with-default-3}
+property-with-default-4=${property-with-default-4}
\ No newline at end of file
Added: maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/basic-1.0/archetype-resources/src/main/resources/inner/dir/App2.properties
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/basic-1.0/archetype-resources/src/main/resources/inner/dir/App2.properties?rev=570611&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/basic-1.0/archetype-resources/src/main/resources/inner/dir/App2.properties (added)
+++ maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/basic-1.0/archetype-resources/src/main/resources/inner/dir/App2.properties Tue Aug 28 19:32:45 2007
@@ -0,0 +1,12 @@
+groupId=${groupId}
+artifactId=${artifactId}
+version=${version}
+package=${package}
+property-without-default-1=${property-without-default-1}
+property-without-default-2=${property-without-default-2}
+property-without-default-3=${property-without-default-3}
+property-without-default-4=${property-without-default-4}
+property-with-default-1=${property-with-default-1}
+property-with-default-2=${property-with-default-2}
+property-with-default-3=${property-with-default-3}
+property-with-default-4=${property-with-default-4}
\ No newline at end of file
Added: maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/basic-1.0/archetype-resources/src/test/c/AppTest.c
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/basic-1.0/archetype-resources/src/test/c/AppTest.c?rev=570611&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/basic-1.0/archetype-resources/src/test/c/AppTest.c (added)
+++ maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/basic-1.0/archetype-resources/src/test/c/AppTest.c Tue Aug 28 19:32:45 2007
@@ -0,0 +1,12 @@
+groupId=${groupId}
+artifactId=${artifactId}
+version=${version}
+package=${package}
+property-without-default-1=${property-without-default-1}
+property-without-default-2=${property-without-default-2}
+property-without-default-3=${property-without-default-3}
+property-without-default-4=${property-without-default-4}
+property-with-default-1=${property-with-default-1}
+property-with-default-2=${property-with-default-2}
+property-with-default-3=${property-with-default-3}
+property-with-default-4=${property-with-default-4}
\ No newline at end of file
Added: maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/basic-1.0/archetype-resources/src/test/java/AppTest.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/basic-1.0/archetype-resources/src/test/java/AppTest.java?rev=570611&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/basic-1.0/archetype-resources/src/test/java/AppTest.java (added)
+++ maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/basic-1.0/archetype-resources/src/test/java/AppTest.java Tue Aug 28 19:32:45 2007
@@ -0,0 +1,12 @@
+groupId=${groupId}
+artifactId=${artifactId}
+version=${version}
+package=${package}
+property-without-default-1=${property-without-default-1}
+property-without-default-2=${property-without-default-2}
+property-without-default-3=${property-without-default-3}
+property-without-default-4=${property-without-default-4}
+property-with-default-1=${property-with-default-1}
+property-with-default-2=${property-with-default-2}
+property-with-default-3=${property-with-default-3}
+property-with-default-4=${property-with-default-4}
\ No newline at end of file
Added: maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/basic-1.0/archetype-resources/src/test/mdo/AppTest.mdo
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/basic-1.0/archetype-resources/src/test/mdo/AppTest.mdo?rev=570611&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/basic-1.0/archetype-resources/src/test/mdo/AppTest.mdo (added)
+++ maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/basic-1.0/archetype-resources/src/test/mdo/AppTest.mdo Tue Aug 28 19:32:45 2007
@@ -0,0 +1,12 @@
+groupId=${groupId}
+artifactId=${artifactId}
+version=${version}
+package=${package}
+property-without-default-1=${property-without-default-1}
+property-without-default-2=${property-without-default-2}
+property-without-default-3=${property-without-default-3}
+property-without-default-4=${property-without-default-4}
+property-with-default-1=${property-with-default-1}
+property-with-default-2=${property-with-default-2}
+property-with-default-3=${property-with-default-3}
+property-with-default-4=${property-with-default-4}
\ No newline at end of file
Added: maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/basic-1.0/archetype-resources/src/test/resources/AppTest.properties
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/basic-1.0/archetype-resources/src/test/resources/AppTest.properties?rev=570611&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/basic-1.0/archetype-resources/src/test/resources/AppTest.properties (added)
+++ maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/basic-1.0/archetype-resources/src/test/resources/AppTest.properties Tue Aug 28 19:32:45 2007
@@ -0,0 +1,12 @@
+groupId=${groupId}
+artifactId=${artifactId}
+version=${version}
+package=${package}
+property-without-default-1=${property-without-default-1}
+property-without-default-2=${property-without-default-2}
+property-without-default-3=${property-without-default-3}
+property-without-default-4=${property-without-default-4}
+property-with-default-1=${property-with-default-1}
+property-with-default-2=${property-with-default-2}
+property-with-default-3=${property-with-default-3}
+property-with-default-4=${property-with-default-4}
\ No newline at end of file
Added: maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/fileset-1.0/META-INF/maven/archetype-metadata.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/fileset-1.0/META-INF/maven/archetype-metadata.xml?rev=570611&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/fileset-1.0/META-INF/maven/archetype-metadata.xml (added)
+++ maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/fileset-1.0/META-INF/maven/archetype-metadata.xml Tue Aug 28 19:32:45 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.
+-->
+<archetype-descriptor id="fileset" partial="false" >
+
+ <requiredProperties>
+ <requiredProperty key="property-with-default-1" >
+ <defaultValue>default-value</defaultValue>
+ </requiredProperty>
+ <requiredProperty key="property-with-default-2" >
+ <defaultValue>default-value</defaultValue>
+ </requiredProperty>
+ <requiredProperty key="property-with-default-3" >
+ <defaultValue>default-value</defaultValue>
+ </requiredProperty>
+ <requiredProperty key="property-with-default-4" >
+ <defaultValue>default-value</defaultValue>
+ </requiredProperty>
+ <requiredProperty key="property-without-default-1" />
+ <requiredProperty key="property-without-default-2" />
+ <requiredProperty key="property-without-default-3" />
+ <requiredProperty key="property-without-default-4" />
+ </requiredProperties>
+
+ <fileSets>
+ <fileSet filtered="true" packaged="true" >
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**/*.java</include>
+ </includes>
+ </fileSet>
+ <fileSet filtered="false" packaged="true" >
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**/*.ogg</include>
+ </includes>
+ </fileSet>
+ <fileSet filtered="true" packaged="false" >
+ <directory>src/main/resources</directory>
+ <includes>
+ <include>**/*.properties</include>
+ </includes>
+ </fileSet>
+ <fileSet filtered="false" packaged="false" >
+ <directory>src/main/resources</directory>
+ <includes>
+ <include>**/*.png</include>
+ </includes>
+ </fileSet>
+ <fileSet filtered="true" packaged="false" >
+ <directory>src/site</directory>
+ <includes>
+ <include>**/*.xml</include>
+ <include>**/*.apt</include>
+ </includes>
+ </fileSet>
+ <fileSet filtered="true">
+ <directory></directory>
+ <includes>
+ <include>.classpath</include>
+ <include>*.xml</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+
+ <modules>
+ <module id="subproject">
+ <fileSets>
+ <fileSet filtered="true" packaged="true" >
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**/*.java</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+
+ <modules>
+ <module id="subsubproject">
+ <fileSets>
+ <fileSet filtered="true" packaged="true" >
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**/*.java</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+ </module>
+ </modules>
+ </module>
+ </modules>
+
+</archetype-descriptor>
Added: maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/fileset-1.0/archetype-resources/.classpath
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/fileset-1.0/archetype-resources/.classpath?rev=570611&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/fileset-1.0/archetype-resources/.classpath (added)
+++ maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/fileset-1.0/archetype-resources/.classpath Tue Aug 28 19:32:45 2007
@@ -0,0 +1,12 @@
+groupId=${groupId}
+artifactId=${artifactId}
+version=${version}
+package=${package}
+property-without-default-1=${property-without-default-1}
+property-without-default-2=${property-without-default-2}
+property-without-default-3=${property-without-default-3}
+property-without-default-4=${property-without-default-4}
+property-with-default-1=${property-with-default-1}
+property-with-default-2=${property-with-default-2}
+property-with-default-3=${property-with-default-3}
+property-with-default-4=${property-with-default-4}
\ No newline at end of file
Added: maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/fileset-1.0/archetype-resources/pom.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/fileset-1.0/archetype-resources/pom.xml?rev=570611&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/fileset-1.0/archetype-resources/pom.xml (added)
+++ maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/fileset-1.0/archetype-resources/pom.xml Tue Aug 28 19:32:45 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>
+
+ <groupId>${groupId}</groupId>
+ <artifactId>${artifactId}</artifactId>
+ <version>${version}</version>
+
+ <name>Maven ArchetypeNG Test</name>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>subproject</module>
+ </modules>
+
+</project>
\ No newline at end of file
Added: maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/fileset-1.0/archetype-resources/profiles.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/fileset-1.0/archetype-resources/profiles.xml?rev=570611&view=auto
==============================================================================
--- maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/fileset-1.0/archetype-resources/profiles.xml (added)
+++ maven/sandbox/trunk/archetypeng/archetype-generator/src/test/archetypes/fileset-1.0/archetype-resources/profiles.xml Tue Aug 28 19:32:45 2007
@@ -0,0 +1,12 @@
+groupId=${groupId}
+artifactId=${artifactId}
+version=${version}
+package=${package}
+property-without-default-1=${property-without-default-1}
+property-without-default-2=${property-without-default-2}
+property-without-default-3=${property-without-default-3}
+property-without-default-4=${property-without-default-4}
+property-with-default-1=${property-with-default-1}
+property-with-default-2=${property-with-default-2}
+property-with-default-3=${property-with-default-3}
+property-with-default-4=${property-with-default-4}
\ No newline at end of file