You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2009/11/07 19:28:41 UTC
svn commit: r833728 [4/5] - in /maven/archetype/trunk: ./ archetype-common/
archetype-common/src/main/java/org/apache/maven/archetype/common/
archetype-common/src/main/java/org/apache/maven/archetype/exception/
archetype-common/src/main/mdo/ archetype-...
Propchange: maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/common/MavenJDOMWriter.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/common/PomManager.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/common/PomManager.java?rev=833728&r1=833727&r2=833728&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/common/PomManager.java (original)
+++ maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/common/PomManager.java Sat Nov 7 18:28:39 2009
@@ -1,70 +1,70 @@
-/*
- * 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.common;
-
-import org.apache.maven.archetype.exception.InvalidPackaging;
-import org.apache.maven.model.Model;
-import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
-import org.dom4j.DocumentException;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-
-public interface PomManager
-{
- String ROLE = PomManager.class.getName();
-
- void addModule( File basedirPom,
- String artifactId )
- throws
- IOException,
- XmlPullParserException,
- DocumentException,
- InvalidPackaging;
-
- void addParent( File pom,
- File basedirPom )
- throws
- IOException,
- XmlPullParserException;
-
- void mergePoms( File pom,
- File temporaryPom )
- throws
- IOException,
- XmlPullParserException;
-
- Model readPom( File pomFile )
- throws
- IOException,
- XmlPullParserException;
-
- Model readPom( InputStream pomStream )
- throws
- IOException,
- XmlPullParserException;
-
- void writePom( Model model,
- File pomFile,
- File initialPomFile )
- throws
- IOException;
-}
+/*
+ * 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.common;
+
+import org.apache.maven.archetype.exception.InvalidPackaging;
+import org.apache.maven.model.Model;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+import org.dom4j.DocumentException;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+
+public interface PomManager
+{
+ String ROLE = PomManager.class.getName();
+
+ void addModule( File basedirPom,
+ String artifactId )
+ throws
+ IOException,
+ XmlPullParserException,
+ DocumentException,
+ InvalidPackaging;
+
+ void addParent( File pom,
+ File basedirPom )
+ throws
+ IOException,
+ XmlPullParserException;
+
+ void mergePoms( File pom,
+ File temporaryPom )
+ throws
+ IOException,
+ XmlPullParserException;
+
+ Model readPom( File pomFile )
+ throws
+ IOException,
+ XmlPullParserException;
+
+ Model readPom( InputStream pomStream )
+ throws
+ IOException,
+ XmlPullParserException;
+
+ void writePom( Model model,
+ File pomFile,
+ File initialPomFile )
+ throws
+ IOException;
+}
Propchange: maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/common/PomManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/exception/ArchetypeGenerationConfigurationFailure.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/exception/ArchetypeGenerationFailure.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/exception/ArchetypeNotConfigured.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/exception/ArchetypeNotDefined.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/exception/ArchetypeNotDefined.java?rev=833728&r1=833727&r2=833728&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/exception/ArchetypeNotDefined.java (original)
+++ maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/exception/ArchetypeNotDefined.java Sat Nov 7 18:28:39 2009
@@ -1,44 +1,44 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.maven.archetype.exception;
-
-public class ArchetypeNotDefined
- extends Exception
-{
- public ArchetypeNotDefined()
- {
- }
-
- public ArchetypeNotDefined( String msg )
- {
- super( msg );
- }
-
- public ArchetypeNotDefined( Throwable cause )
- {
- super( cause );
- }
-
- public ArchetypeNotDefined( String msg,
- Throwable cause )
- {
- super( msg, cause );
- }
-}
+/*
+ * 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.exception;
+
+public class ArchetypeNotDefined
+ extends Exception
+{
+ public ArchetypeNotDefined()
+ {
+ }
+
+ public ArchetypeNotDefined( String msg )
+ {
+ super( msg );
+ }
+
+ public ArchetypeNotDefined( Throwable cause )
+ {
+ super( cause );
+ }
+
+ public ArchetypeNotDefined( String msg,
+ Throwable cause )
+ {
+ super( msg, cause );
+ }
+}
Propchange: maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/exception/ArchetypeNotDefined.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/exception/ArchetypeSelectionFailure.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/exception/InvalidPackaging.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/exception/OutputFileExists.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/exception/PomFileExists.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/exception/ProjectDirectoryExists.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/exception/TemplateCreationException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/exception/UnknownArchetype.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/trunk/archetype-common/src/main/java/org/apache/maven/archetype/exception/UnknownGroup.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: maven/archetype/trunk/archetype-common/src/main/mdo/archetype-catalog.mdo
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/main/mdo/archetype-catalog.mdo?rev=833728&r1=833727&r2=833728&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-common/src/main/mdo/archetype-catalog.mdo (original)
+++ maven/archetype/trunk/archetype-common/src/main/mdo/archetype-catalog.mdo Sat Nov 7 18:28:39 2009
@@ -1,138 +1,138 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- -->
-<model xmlns="http://modello.codehaus.org/MODELLO/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://modello.codehaus.org/MODELLO/1.0.0 http://modello.codehaus.org/xsd/modello-1.0.0.xsd">
- <id>archetype-catalog</id>
- <name>ArchetypeCatalog</name>
- <description>
- These are standard catalog files which contain information about Archetypes so that users
- can be presented with a list of archetypes from any number of catalogs to generate new
- projects.
- </description>
-
- <defaults>
- <default>
- <key>package</key>
- <value>org.apache.maven.archetype.catalog</value>
- </default>
- </defaults>
-
- <classes>
- <class rootElement="true" xml.tagName="archetype-catalog">
- <name>ArchetypeCatalog</name>
- <fields>
- <field>
- <name>archetypes</name>
- <association>
- <type>Archetype</type>
- <multiplicity>*</multiplicity>
- </association>
- </field>
- </fields>
- <codeSegments>
- <codeSegment>
- <code><![CDATA[
- public String toString ()
- {
- return archetypes.toString();
- }
- ]]></code>
- </codeSegment>
- </codeSegments>
- </class>
- <class>
- <name>Archetype</name>
- <fields>
- <field>
- <name>groupId</name>
- <type>String</type>
- <required>true</required>
- </field>
- <field>
- <name>artifactId</name>
- <type>String</type>
- <required>true</required>
- </field>
- <field>
- <name>version</name>
- <type>String</type>
- <required>true</required>
- </field>
- <field>
- <name>repository</name>
- <type>String</type>
- <required>true</required>
- </field>
- <field>
- <name>description</name>
- <type>String</type>
- <required>true</required>
- </field>
- <field>
- <name>goals</name>
- <association>
- <type>String</type>
- <multiplicity>*</multiplicity>
- </association>
- </field>
- <field>
- <name>properties</name>
- <description>
- <![CDATA[
- Properties that will be used during the execution of addition goals after the creation of the archetype.
- ]]>
- </description>
- <type>Properties</type>
- <association xml.mapStyle="inline">
- <type>String</type>
- <multiplicity>*</multiplicity>
- </association>
- </field>
- </fields>
- <codeSegments>
- <codeSegment>
- <code><![CDATA[
- public String toString ()
- {
- return "[" + groupId + ":" + artifactId + ":" + version + (repository != null ? " -> " + repository : "") + "]";
- }
- public int hashCode ()
- {
- return groupId.hashCode () + 17 * artifactId.hashCode ();
- }
- public boolean equals (Object object)
- {
- if (object == null || !(object instanceof Archetype) )
- {
- return false;
- }
- else
- {
- Archetype a = (Archetype) object;
- return org.codehaus.plexus.util.StringUtils.equals( groupId, a.getGroupId () ) &&
- org.codehaus.plexus.util.StringUtils.equals( artifactId, a.getArtifactId () );
- }
- }
- ]]></code>
- </codeSegment>
- </codeSegments>
- </class>
- </classes>
-</model>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+<model xmlns="http://modello.codehaus.org/MODELLO/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://modello.codehaus.org/MODELLO/1.0.0 http://modello.codehaus.org/xsd/modello-1.0.0.xsd">
+ <id>archetype-catalog</id>
+ <name>ArchetypeCatalog</name>
+ <description>
+ These are standard catalog files which contain information about Archetypes so that users
+ can be presented with a list of archetypes from any number of catalogs to generate new
+ projects.
+ </description>
+
+ <defaults>
+ <default>
+ <key>package</key>
+ <value>org.apache.maven.archetype.catalog</value>
+ </default>
+ </defaults>
+
+ <classes>
+ <class rootElement="true" xml.tagName="archetype-catalog">
+ <name>ArchetypeCatalog</name>
+ <fields>
+ <field>
+ <name>archetypes</name>
+ <association>
+ <type>Archetype</type>
+ <multiplicity>*</multiplicity>
+ </association>
+ </field>
+ </fields>
+ <codeSegments>
+ <codeSegment>
+ <code><![CDATA[
+ public String toString ()
+ {
+ return archetypes.toString();
+ }
+ ]]></code>
+ </codeSegment>
+ </codeSegments>
+ </class>
+ <class>
+ <name>Archetype</name>
+ <fields>
+ <field>
+ <name>groupId</name>
+ <type>String</type>
+ <required>true</required>
+ </field>
+ <field>
+ <name>artifactId</name>
+ <type>String</type>
+ <required>true</required>
+ </field>
+ <field>
+ <name>version</name>
+ <type>String</type>
+ <required>true</required>
+ </field>
+ <field>
+ <name>repository</name>
+ <type>String</type>
+ <required>true</required>
+ </field>
+ <field>
+ <name>description</name>
+ <type>String</type>
+ <required>true</required>
+ </field>
+ <field>
+ <name>goals</name>
+ <association>
+ <type>String</type>
+ <multiplicity>*</multiplicity>
+ </association>
+ </field>
+ <field>
+ <name>properties</name>
+ <description>
+ <![CDATA[
+ Properties that will be used during the execution of addition goals after the creation of the archetype.
+ ]]>
+ </description>
+ <type>Properties</type>
+ <association xml.mapStyle="inline">
+ <type>String</type>
+ <multiplicity>*</multiplicity>
+ </association>
+ </field>
+ </fields>
+ <codeSegments>
+ <codeSegment>
+ <code><![CDATA[
+ public String toString ()
+ {
+ return "[" + groupId + ":" + artifactId + ":" + version + (repository != null ? " -> " + repository : "") + "]";
+ }
+ public int hashCode ()
+ {
+ return groupId.hashCode () + 17 * artifactId.hashCode ();
+ }
+ public boolean equals (Object object)
+ {
+ if (object == null || !(object instanceof Archetype) )
+ {
+ return false;
+ }
+ else
+ {
+ Archetype a = (Archetype) object;
+ return org.codehaus.plexus.util.StringUtils.equals( groupId, a.getGroupId () ) &&
+ org.codehaus.plexus.util.StringUtils.equals( artifactId, a.getArtifactId () );
+ }
+ }
+ ]]></code>
+ </codeSegment>
+ </codeSegments>
+ </class>
+ </classes>
+</model>
Propchange: maven/archetype/trunk/archetype-common/src/main/mdo/archetype-catalog.mdo
------------------------------------------------------------------------------
svn:eol-style = native
Modified: maven/archetype/trunk/archetype-common/src/main/mdo/archetype-common.mdo
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/main/mdo/archetype-common.mdo?rev=833728&r1=833727&r2=833728&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-common/src/main/mdo/archetype-common.mdo (original)
+++ maven/archetype/trunk/archetype-common/src/main/mdo/archetype-common.mdo Sat Nov 7 18:28:39 2009
@@ -1,301 +1,301 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- -->
-<model xmlns="http://modello.codehaus.org/MODELLO/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://modello.codehaus.org/MODELLO/1.0.0 http://modello.codehaus.org/xsd/modello-1.0.0.xsd">
- <id>archetype-common</id>
- <name>ArchetypeCommon</name>
-
- <defaults>
- <default>
- <key>package</key>
- <value>org.apache.maven.archetype.common</value>
- </default>
- </defaults>
-
- <classes>
-
- <!--class>
- <name>Archetype</name>
- <fields>
- <field>
- <name>GroupId</name>
- <type>String</type>
- </field>
- <field>
- <name>ArtifactId</name>
- <type>String</type>
- </field>
- <field>
- <name>Version</name>
- <type>String</type>
- </field>
- <field>
- <name>Name</name>
- <type>String</type>
- </field>
- <field>
- <name>Prefix</name>
- <type>String</type>
- </field>
- </fields>
- <codeSegments>
- <codeSegment>
- <code><![CDATA[
- public boolean equals( Object o )
- {
- if ( this == o )
- {
- return true;
- }
-
- if ( !( o instanceof Archetype ) )
- {
- return false;
- }
-
- Archetype a = (Archetype) o;
-
- if ( !a.getArtifactId().equals( getArtifactId() ) )
- {
- return false;
- }
- else if ( !a.getGroupId().equals( getGroupId() ) )
- {
- return false;
- }
- /*
- else if ( !a.getPrefix().equals( getPrefix() ) )
- {
- return false;
- }
- else if ( !a.getName().equals( getName() ) )
- {
- return false;
- }*/
- return true;
- }
-
- public int hashCode()
- {
- int result = 17;
- result = 37 * result + getArtifactId().hashCode();
- result = 37 * result + getGroupId().hashCode();
- return result;
- }
- ]]></code>
- </codeSegment>
- </codeSegments>
- </class-->
-
- <class rootElement="true">
- <name>ArchetypeDefinition</name>
- <fields>
- <field>
- <name>GroupId</name>
- <type>String</type>
- </field>
- <field>
- <name>ArtifactId</name>
- <type>String</type>
- </field>
- <field>
- <name>Version</name>
- <type>String</type>
- </field>
- <field>
- <name>Name</name>
- <type>String</type>
- </field>
- <field>
- <name>repository</name>
- <type>String</type>
- </field>
- <field>
- <name>goals</name>
- <type>String</type>
- </field>
- </fields>
- <codeSegments>
- <codeSegment>
- <code><![CDATA[
- public void reset ()
- {
- setGroupId ( null );
- setArtifactId ( null );
- setVersion ( null );
- }
-
- public boolean isArtifactDefined ()
- {
- return org.codehaus.plexus.util.StringUtils.isNotEmpty( getArtifactId () );
- }
-
- public boolean isDefined ()
- {
- return isPartiallyDefined () && isVersionDefined ();
- }
-
- public boolean isGroupDefined ()
- {
- return org.codehaus.plexus.util.StringUtils.isNotEmpty( getGroupId () );
- }
-
- public boolean isPartiallyDefined ()
- {
- return isGroupDefined () && isArtifactDefined ();
- }
-
- public boolean isVersionDefined ()
- {
- return org.codehaus.plexus.util.StringUtils.isNotEmpty( getVersion () );
- }
- ]]></code>
- </codeSegment>
- </codeSegments>
- </class>
-
- <class>
- <name>ArchetypeConfiguration</name>
- <fields>
- <field>
- <name>GroupId</name>
- <type>String</type>
- </field>
- <field>
- <name>ArtifactId</name>
- <type>String</type>
- </field>
- <field>
- <name>Version</name>
- <type>String</type>
- </field>
- <field>
- <name>Name</name>
- <type>String</type>
- </field>
- <field>
- <name>goals</name>
- <type>String</type>
- </field>
- <field>
- <name>RequiredProperties</name>
- <association>
- <type>String</type>
- <multiplicity>*</multiplicity>
- </association>
- </field>
- </fields>
- <codeSegments>
- <codeSegment>
- <code><![CDATA[
- public void reset ()
- {
- properties.clear ();
- }
-
- private java.util.Properties properties = new java.util.Properties ();
-
- public void setProperty ( String requiredProperty, String propertyValue )
- {
- properties.setProperty ( requiredProperty, propertyValue );
- }
-
- public String getProperty (String property)
- {
- return properties.getProperty ( property, null );
- }
-
- public java.util.Properties getProperties ()
- {
- return properties;
- }
-
- public java.util.Properties toProperties ()
- {
- java.util.Properties result = new java.util.Properties ();
- result.putAll ( properties );
- result.setProperty (
- Constants.ARCHETYPE_GROUP_ID,
- (org.codehaus.plexus.util.StringUtils.isNotEmpty( getGroupId () ) ? getGroupId () : "" )
- );
- result.setProperty (
- Constants.ARCHETYPE_ARTIFACT_ID,
- (org.codehaus.plexus.util.StringUtils.isNotEmpty( getArtifactId () ) ? getArtifactId () : "" )
- );
- result.setProperty (
- Constants.ARCHETYPE_VERSION,
- (org.codehaus.plexus.util.StringUtils.isNotEmpty( getVersion () ) ? getVersion () : "" )
- );
-
- properties.setProperty (
- Constants.ARCHETYPE_POST_GENERATION_GOALS,
- (org.codehaus.plexus.util.StringUtils.isNotEmpty( getGoals() ) ? getGoals() : "" )
- );
-
- return result;
- }
-
- public boolean isConfigured ()
- {
- boolean configured = true;
-
- java.util.Iterator requiredProperties = getRequiredProperties().iterator();
- while ( configured && requiredProperties.hasNext () )
- {
- String requiredProperty = (String) requiredProperties.next ();
-
- configured = configured &&
- org.codehaus.plexus.util.StringUtils.isNotEmpty(
- properties.getProperty ( requiredProperty )
- );
- }
-
- return configured;
- }
-
- public boolean isConfigured ( String requiredProperties )
- {
- return org.codehaus.plexus.util.StringUtils.isNotEmpty (
- properties.getProperty ( requiredProperties )
- );
- }
-
- private java.util.Properties defaultProperties = new java.util.Properties ();
-
- public void setDefaultProperty ( String requiredProperty, String propertyValue )
- {
- defaultProperties.setProperty ( requiredProperty, propertyValue );
- }
-
- public String getDefaultValue (String requiredProperty)
- {
- return defaultProperties.getProperty ( requiredProperty, null );
- }
-
- public java.util.Properties getDefaultValues ()
- {
- return defaultProperties;
- }
- ]]></code>
- </codeSegment>
- </codeSegments>
- </class>
- </classes>
-</model>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+<model xmlns="http://modello.codehaus.org/MODELLO/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://modello.codehaus.org/MODELLO/1.0.0 http://modello.codehaus.org/xsd/modello-1.0.0.xsd">
+ <id>archetype-common</id>
+ <name>ArchetypeCommon</name>
+
+ <defaults>
+ <default>
+ <key>package</key>
+ <value>org.apache.maven.archetype.common</value>
+ </default>
+ </defaults>
+
+ <classes>
+
+ <!--class>
+ <name>Archetype</name>
+ <fields>
+ <field>
+ <name>GroupId</name>
+ <type>String</type>
+ </field>
+ <field>
+ <name>ArtifactId</name>
+ <type>String</type>
+ </field>
+ <field>
+ <name>Version</name>
+ <type>String</type>
+ </field>
+ <field>
+ <name>Name</name>
+ <type>String</type>
+ </field>
+ <field>
+ <name>Prefix</name>
+ <type>String</type>
+ </field>
+ </fields>
+ <codeSegments>
+ <codeSegment>
+ <code><![CDATA[
+ public boolean equals( Object o )
+ {
+ if ( this == o )
+ {
+ return true;
+ }
+
+ if ( !( o instanceof Archetype ) )
+ {
+ return false;
+ }
+
+ Archetype a = (Archetype) o;
+
+ if ( !a.getArtifactId().equals( getArtifactId() ) )
+ {
+ return false;
+ }
+ else if ( !a.getGroupId().equals( getGroupId() ) )
+ {
+ return false;
+ }
+ /*
+ else if ( !a.getPrefix().equals( getPrefix() ) )
+ {
+ return false;
+ }
+ else if ( !a.getName().equals( getName() ) )
+ {
+ return false;
+ }*/
+ return true;
+ }
+
+ public int hashCode()
+ {
+ int result = 17;
+ result = 37 * result + getArtifactId().hashCode();
+ result = 37 * result + getGroupId().hashCode();
+ return result;
+ }
+ ]]></code>
+ </codeSegment>
+ </codeSegments>
+ </class-->
+
+ <class rootElement="true">
+ <name>ArchetypeDefinition</name>
+ <fields>
+ <field>
+ <name>GroupId</name>
+ <type>String</type>
+ </field>
+ <field>
+ <name>ArtifactId</name>
+ <type>String</type>
+ </field>
+ <field>
+ <name>Version</name>
+ <type>String</type>
+ </field>
+ <field>
+ <name>Name</name>
+ <type>String</type>
+ </field>
+ <field>
+ <name>repository</name>
+ <type>String</type>
+ </field>
+ <field>
+ <name>goals</name>
+ <type>String</type>
+ </field>
+ </fields>
+ <codeSegments>
+ <codeSegment>
+ <code><![CDATA[
+ public void reset ()
+ {
+ setGroupId ( null );
+ setArtifactId ( null );
+ setVersion ( null );
+ }
+
+ public boolean isArtifactDefined ()
+ {
+ return org.codehaus.plexus.util.StringUtils.isNotEmpty( getArtifactId () );
+ }
+
+ public boolean isDefined ()
+ {
+ return isPartiallyDefined () && isVersionDefined ();
+ }
+
+ public boolean isGroupDefined ()
+ {
+ return org.codehaus.plexus.util.StringUtils.isNotEmpty( getGroupId () );
+ }
+
+ public boolean isPartiallyDefined ()
+ {
+ return isGroupDefined () && isArtifactDefined ();
+ }
+
+ public boolean isVersionDefined ()
+ {
+ return org.codehaus.plexus.util.StringUtils.isNotEmpty( getVersion () );
+ }
+ ]]></code>
+ </codeSegment>
+ </codeSegments>
+ </class>
+
+ <class>
+ <name>ArchetypeConfiguration</name>
+ <fields>
+ <field>
+ <name>GroupId</name>
+ <type>String</type>
+ </field>
+ <field>
+ <name>ArtifactId</name>
+ <type>String</type>
+ </field>
+ <field>
+ <name>Version</name>
+ <type>String</type>
+ </field>
+ <field>
+ <name>Name</name>
+ <type>String</type>
+ </field>
+ <field>
+ <name>goals</name>
+ <type>String</type>
+ </field>
+ <field>
+ <name>RequiredProperties</name>
+ <association>
+ <type>String</type>
+ <multiplicity>*</multiplicity>
+ </association>
+ </field>
+ </fields>
+ <codeSegments>
+ <codeSegment>
+ <code><![CDATA[
+ public void reset ()
+ {
+ properties.clear ();
+ }
+
+ private java.util.Properties properties = new java.util.Properties ();
+
+ public void setProperty ( String requiredProperty, String propertyValue )
+ {
+ properties.setProperty ( requiredProperty, propertyValue );
+ }
+
+ public String getProperty (String property)
+ {
+ return properties.getProperty ( property, null );
+ }
+
+ public java.util.Properties getProperties ()
+ {
+ return properties;
+ }
+
+ public java.util.Properties toProperties ()
+ {
+ java.util.Properties result = new java.util.Properties ();
+ result.putAll ( properties );
+ result.setProperty (
+ Constants.ARCHETYPE_GROUP_ID,
+ (org.codehaus.plexus.util.StringUtils.isNotEmpty( getGroupId () ) ? getGroupId () : "" )
+ );
+ result.setProperty (
+ Constants.ARCHETYPE_ARTIFACT_ID,
+ (org.codehaus.plexus.util.StringUtils.isNotEmpty( getArtifactId () ) ? getArtifactId () : "" )
+ );
+ result.setProperty (
+ Constants.ARCHETYPE_VERSION,
+ (org.codehaus.plexus.util.StringUtils.isNotEmpty( getVersion () ) ? getVersion () : "" )
+ );
+
+ properties.setProperty (
+ Constants.ARCHETYPE_POST_GENERATION_GOALS,
+ (org.codehaus.plexus.util.StringUtils.isNotEmpty( getGoals() ) ? getGoals() : "" )
+ );
+
+ return result;
+ }
+
+ public boolean isConfigured ()
+ {
+ boolean configured = true;
+
+ java.util.Iterator requiredProperties = getRequiredProperties().iterator();
+ while ( configured && requiredProperties.hasNext () )
+ {
+ String requiredProperty = (String) requiredProperties.next ();
+
+ configured = configured &&
+ org.codehaus.plexus.util.StringUtils.isNotEmpty(
+ properties.getProperty ( requiredProperty )
+ );
+ }
+
+ return configured;
+ }
+
+ public boolean isConfigured ( String requiredProperties )
+ {
+ return org.codehaus.plexus.util.StringUtils.isNotEmpty (
+ properties.getProperty ( requiredProperties )
+ );
+ }
+
+ private java.util.Properties defaultProperties = new java.util.Properties ();
+
+ public void setDefaultProperty ( String requiredProperty, String propertyValue )
+ {
+ defaultProperties.setProperty ( requiredProperty, propertyValue );
+ }
+
+ public String getDefaultValue (String requiredProperty)
+ {
+ return defaultProperties.getProperty ( requiredProperty, null );
+ }
+
+ public java.util.Properties getDefaultValues ()
+ {
+ return defaultProperties;
+ }
+ ]]></code>
+ </codeSegment>
+ </codeSegments>
+ </class>
+ </classes>
+</model>
Propchange: maven/archetype/trunk/archetype-common/src/main/mdo/archetype-common.mdo
------------------------------------------------------------------------------
svn:eol-style = native
Modified: maven/archetype/trunk/archetype-common/src/main/mdo/archetype-descriptor.mdo
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/main/mdo/archetype-descriptor.mdo?rev=833728&r1=833727&r2=833728&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-common/src/main/mdo/archetype-descriptor.mdo (original)
+++ maven/archetype/trunk/archetype-common/src/main/mdo/archetype-descriptor.mdo Sat Nov 7 18:28:39 2009
@@ -1,183 +1,183 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- -->
-<model xmlns="http://modello.codehaus.org/MODELLO/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://modello.codehaus.org/MODELLO/1.0.0 http://modello.codehaus.org/xsd/modello-1.0.0.xsd">
- <id>archetype-descriptor</id>
- <name>ArchetypeDescriptor</name>
-
- <defaults>
- <default>
- <key>package</key>
- <value>org.apache.maven.archetype.metadata</value>
- </default>
- </defaults>
- <classes>
- <class rootElement="true" xml.tagName="archetype-descriptor">
- <name>ArchetypeDescriptor</name>
- <superClass>AbstractArchetypeDescriptor</superClass>
- <fields>
- <field xml.attribute="true">
- <name>name</name>
- <type>String</type>
- <required>true</required>
- </field>
- <field xml.attribute="true">
- <name>partial</name>
- <type>boolean</type>
- <required>false</required>
- </field>
- <field>
- <name>requiredProperties</name>
- <association>
- <type>RequiredProperty</type>
- <multiplicity>*</multiplicity>
- </association>
- </field>
- </fields>
- </class>
-
- <class>
- <name>ModuleDescriptor</name>
- <superClass>AbstractArchetypeDescriptor</superClass>
- <fields>
- <field xml.attribute="true">
- <name>id</name>
- <type>String</type>
- <required>true</required>
- </field>
- <field xml.attribute="true">
- <name>dir</name>
- <type>String</type>
- <required>true</required>
- </field>
- <field xml.attribute="true">
- <name>name</name>
- <type>String</type>
- <required>true</required>
- </field>
- </fields>
- </class>
-
- <class>
- <name>AbstractArchetypeDescriptor</name>
- <fields>
- <field>
- <name>fileSets</name>
- <association>
- <type>FileSet</type>
- <multiplicity>*</multiplicity>
- </association>
- <required>true</required>
- </field>
- <field>
- <name>modules</name>
- <association>
- <type>ModuleDescriptor</type>
- <multiplicity>*</multiplicity>
- </association>
- <required>false</required>
- </field>
- </fields>
- </class>
-
- <class>
- <name>FileSet</name>
- <fields>
- <field xml.attribute="true">
- <name>filtered</name>
- <type>boolean</type>
- <required>false</required>
- </field>
- <field xml.attribute="true">
- <name>packaged</name>
- <type>boolean</type>
- <required>false</required>
- </field>
- <field xml.attribute="true">
- <name>encoding</name>
- <type>String</type>
- <required>false</required>
- </field>
- <field>
- <name>directory</name>
- <type>String</type>
- <required>true</required>
- </field>
- <field>
- <name>includes</name>
- <association>
- <type>String</type>
- <multiplicity>*</multiplicity>
- </association>
- <required>false</required>
- </field>
- <field>
- <name>excludes</name>
- <association>
- <type>String</type>
- <multiplicity>*</multiplicity>
- </association>
- <required>false</required>
- </field>
- </fields>
- <codeSegments>
- <codeSegment>
- <code><![CDATA[
- {
- filtered = true;
- packaged = true;
- }
-
- public String toString ()
- {
- return
- getDirectory () + " (" +
- (isFiltered () ? "Filtered" : "Copied") +
- "-" +
- (isPackaged () ? "Packaged" : "Flat") +
- ") [" +
- org.codehaus.plexus.util.StringUtils.join ( getIncludes ().iterator (), ", " ) +
- " -- " +
- org.codehaus.plexus.util.StringUtils.join ( getExcludes ().iterator (), ", " ) +
- "]";
-
- }
- ]]></code>
- </codeSegment>
- </codeSegments>
- </class>
-
- <class>
- <name>RequiredProperty</name>
- <fields>
- <field xml.attribute="true">
- <name>key</name>
- <type>String</type>
- <required>true</required>
- </field>
- <field>
- <name>defaultValue</name>
- <type>String</type>
- <required>false</required>
- </field>
- </fields>
- </class>
- </classes>
-</model>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+<model xmlns="http://modello.codehaus.org/MODELLO/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://modello.codehaus.org/MODELLO/1.0.0 http://modello.codehaus.org/xsd/modello-1.0.0.xsd">
+ <id>archetype-descriptor</id>
+ <name>ArchetypeDescriptor</name>
+
+ <defaults>
+ <default>
+ <key>package</key>
+ <value>org.apache.maven.archetype.metadata</value>
+ </default>
+ </defaults>
+ <classes>
+ <class rootElement="true" xml.tagName="archetype-descriptor">
+ <name>ArchetypeDescriptor</name>
+ <superClass>AbstractArchetypeDescriptor</superClass>
+ <fields>
+ <field xml.attribute="true">
+ <name>name</name>
+ <type>String</type>
+ <required>true</required>
+ </field>
+ <field xml.attribute="true">
+ <name>partial</name>
+ <type>boolean</type>
+ <required>false</required>
+ </field>
+ <field>
+ <name>requiredProperties</name>
+ <association>
+ <type>RequiredProperty</type>
+ <multiplicity>*</multiplicity>
+ </association>
+ </field>
+ </fields>
+ </class>
+
+ <class>
+ <name>ModuleDescriptor</name>
+ <superClass>AbstractArchetypeDescriptor</superClass>
+ <fields>
+ <field xml.attribute="true">
+ <name>id</name>
+ <type>String</type>
+ <required>true</required>
+ </field>
+ <field xml.attribute="true">
+ <name>dir</name>
+ <type>String</type>
+ <required>true</required>
+ </field>
+ <field xml.attribute="true">
+ <name>name</name>
+ <type>String</type>
+ <required>true</required>
+ </field>
+ </fields>
+ </class>
+
+ <class>
+ <name>AbstractArchetypeDescriptor</name>
+ <fields>
+ <field>
+ <name>fileSets</name>
+ <association>
+ <type>FileSet</type>
+ <multiplicity>*</multiplicity>
+ </association>
+ <required>true</required>
+ </field>
+ <field>
+ <name>modules</name>
+ <association>
+ <type>ModuleDescriptor</type>
+ <multiplicity>*</multiplicity>
+ </association>
+ <required>false</required>
+ </field>
+ </fields>
+ </class>
+
+ <class>
+ <name>FileSet</name>
+ <fields>
+ <field xml.attribute="true">
+ <name>filtered</name>
+ <type>boolean</type>
+ <required>false</required>
+ </field>
+ <field xml.attribute="true">
+ <name>packaged</name>
+ <type>boolean</type>
+ <required>false</required>
+ </field>
+ <field xml.attribute="true">
+ <name>encoding</name>
+ <type>String</type>
+ <required>false</required>
+ </field>
+ <field>
+ <name>directory</name>
+ <type>String</type>
+ <required>true</required>
+ </field>
+ <field>
+ <name>includes</name>
+ <association>
+ <type>String</type>
+ <multiplicity>*</multiplicity>
+ </association>
+ <required>false</required>
+ </field>
+ <field>
+ <name>excludes</name>
+ <association>
+ <type>String</type>
+ <multiplicity>*</multiplicity>
+ </association>
+ <required>false</required>
+ </field>
+ </fields>
+ <codeSegments>
+ <codeSegment>
+ <code><![CDATA[
+ {
+ filtered = true;
+ packaged = true;
+ }
+
+ public String toString ()
+ {
+ return
+ getDirectory () + " (" +
+ (isFiltered () ? "Filtered" : "Copied") +
+ "-" +
+ (isPackaged () ? "Packaged" : "Flat") +
+ ") [" +
+ org.codehaus.plexus.util.StringUtils.join ( getIncludes ().iterator (), ", " ) +
+ " -- " +
+ org.codehaus.plexus.util.StringUtils.join ( getExcludes ().iterator (), ", " ) +
+ "]";
+
+ }
+ ]]></code>
+ </codeSegment>
+ </codeSegments>
+ </class>
+
+ <class>
+ <name>RequiredProperty</name>
+ <fields>
+ <field xml.attribute="true">
+ <name>key</name>
+ <type>String</type>
+ <required>true</required>
+ </field>
+ <field>
+ <name>defaultValue</name>
+ <type>String</type>
+ <required>false</required>
+ </field>
+ </fields>
+ </class>
+ </classes>
+</model>
Propchange: maven/archetype/trunk/archetype-common/src/main/mdo/archetype-descriptor.mdo
------------------------------------------------------------------------------
svn:eol-style = native
Modified: maven/archetype/trunk/archetype-common/src/main/mdo/archetype-registry.mdo
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/main/mdo/archetype-registry.mdo?rev=833728&r1=833727&r2=833728&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-common/src/main/mdo/archetype-registry.mdo (original)
+++ maven/archetype/trunk/archetype-common/src/main/mdo/archetype-registry.mdo Sat Nov 7 18:28:39 2009
@@ -1,53 +1,53 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- -->
-<model xmlns="http://modello.codehaus.org/MODELLO/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://modello.codehaus.org/MODELLO/1.0.0 http://modello.codehaus.org/xsd/modello-1.0.0.xsd">
- <id>archetype-registry</id>
- <name>ArchetypeRegistry</name>
-
- <defaults>
- <default>
- <key>package</key>
- <value>org.apache.maven.archetype.registry</value>
- </default>
- </defaults>
-
- <classes>
- <class rootElement="true" xml.tagName="archetype-registry">
- <name>ArchetypeRegistry</name>
- <fields>
- <field>
- <name>Languages</name>
- <association>
- <type>String</type>
- <multiplicity>*</multiplicity>
- </association>
- </field>
- <field>
- <name>FilteredExtensions</name>
- <association>
- <type>String</type>
- <multiplicity>*</multiplicity>
- </association>
- </field>
- </fields>
- </class>
- </classes>
-</model>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+<model xmlns="http://modello.codehaus.org/MODELLO/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://modello.codehaus.org/MODELLO/1.0.0 http://modello.codehaus.org/xsd/modello-1.0.0.xsd">
+ <id>archetype-registry</id>
+ <name>ArchetypeRegistry</name>
+
+ <defaults>
+ <default>
+ <key>package</key>
+ <value>org.apache.maven.archetype.registry</value>
+ </default>
+ </defaults>
+
+ <classes>
+ <class rootElement="true" xml.tagName="archetype-registry">
+ <name>ArchetypeRegistry</name>
+ <fields>
+ <field>
+ <name>Languages</name>
+ <association>
+ <type>String</type>
+ <multiplicity>*</multiplicity>
+ </association>
+ </field>
+ <field>
+ <name>FilteredExtensions</name>
+ <association>
+ <type>String</type>
+ <multiplicity>*</multiplicity>
+ </association>
+ </field>
+ </fields>
+ </class>
+ </classes>
+</model>
Propchange: maven/archetype/trunk/archetype-common/src/main/mdo/archetype-registry.mdo
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/trunk/archetype-common/src/main/mdo/archetype.mdo
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/trunk/archetype-common/src/test/archetypes/fileset-1.0/archetype-resources/subproject/subsubproject/src/main/java/__rootArtifactId__/inner/__artifactId__/innest/Some__rootArtifactId__Class__artifactId__.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/trunk/archetype-plugin/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/AddArchetypeMetadataMojo.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/AddArchetypeMetadataMojo.java?rev=833728&r1=833727&r2=833728&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/AddArchetypeMetadataMojo.java (original)
+++ maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/AddArchetypeMetadataMojo.java Sat Nov 7 18:28:39 2009
@@ -1,91 +1,91 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.maven.archetype.mojos;
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata;
-import org.apache.maven.artifact.repository.metadata.GroupRepositoryMetadata;
-import org.apache.maven.artifact.repository.metadata.Versioning;
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.project.MavenProject;
-
-/**
- * Inject any plugin-specific artifact metadata to the project's artifact, for subsequent
- * installation and deployment. The first use-case for this is to add the LATEST metadata (which is
- * plugin-specific) for shipping alongside the plugin's artifact.
- *
- * @phase package
- * @goal add-archetype-metadata
- */
-public class AddArchetypeMetadataMojo
- extends AbstractMojo
-{
- /**
- * The prefix for the plugin goal.
- *
- * @parameter
- */
- private String goalPrefix;
-
- /**
- * The project artifact, which should have the LATEST metadata added to it.
- *
- * @parameter expression="${project}"
- * @required
- * @readonly
- */
- private MavenProject project;
-
- public void execute()
- throws
- MojoExecutionException
- {
- Artifact projectArtifact = project.getArtifact();
-
- Versioning versioning = new Versioning();
- versioning.setLatest( projectArtifact.getVersion() );
- versioning.updateTimestamp();
-
- ArtifactRepositoryMetadata metadata =
- new ArtifactRepositoryMetadata( projectArtifact, versioning );
- projectArtifact.addMetadata( metadata );
-
- GroupRepositoryMetadata groupMetadata =
- new GroupRepositoryMetadata( project.getGroupId() );
- groupMetadata.addPluginMapping(
- getGoalPrefix(),
- project.getArtifactId(),
- project.getName()
- );
-
- projectArtifact.addMetadata( groupMetadata );
- }
-
- private String getGoalPrefix()
- {
- if ( goalPrefix == null )
- {
- goalPrefix = project.getArtifactId();
- }
-
- return goalPrefix;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.maven.archetype.mojos;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata;
+import org.apache.maven.artifact.repository.metadata.GroupRepositoryMetadata;
+import org.apache.maven.artifact.repository.metadata.Versioning;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+
+/**
+ * Inject any plugin-specific artifact metadata to the project's artifact, for subsequent
+ * installation and deployment. The first use-case for this is to add the LATEST metadata (which is
+ * plugin-specific) for shipping alongside the plugin's artifact.
+ *
+ * @phase package
+ * @goal add-archetype-metadata
+ */
+public class AddArchetypeMetadataMojo
+ extends AbstractMojo
+{
+ /**
+ * The prefix for the plugin goal.
+ *
+ * @parameter
+ */
+ private String goalPrefix;
+
+ /**
+ * The project artifact, which should have the LATEST metadata added to it.
+ *
+ * @parameter expression="${project}"
+ * @required
+ * @readonly
+ */
+ private MavenProject project;
+
+ public void execute()
+ throws
+ MojoExecutionException
+ {
+ Artifact projectArtifact = project.getArtifact();
+
+ Versioning versioning = new Versioning();
+ versioning.setLatest( projectArtifact.getVersion() );
+ versioning.updateTimestamp();
+
+ ArtifactRepositoryMetadata metadata =
+ new ArtifactRepositoryMetadata( projectArtifact, versioning );
+ projectArtifact.addMetadata( metadata );
+
+ GroupRepositoryMetadata groupMetadata =
+ new GroupRepositoryMetadata( project.getGroupId() );
+ groupMetadata.addPluginMapping(
+ getGoalPrefix(),
+ project.getArtifactId(),
+ project.getName()
+ );
+
+ projectArtifact.addMetadata( groupMetadata );
+ }
+
+ private String getGoalPrefix()
+ {
+ if ( goalPrefix == null )
+ {
+ goalPrefix = project.getArtifactId();
+ }
+
+ return goalPrefix;
+ }
+}
Propchange: maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/AddArchetypeMetadataMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CleanMojo.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CleanMojo.java?rev=833728&r1=833727&r2=833728&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CleanMojo.java (original)
+++ maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CleanMojo.java Sat Nov 7 18:28:39 2009
@@ -1,53 +1,53 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.maven.archetype.mojos;
-
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-
-import java.io.File;
-
-/**
- * Clean archetype properties file.
- *
- * @author rafale
- * @requiresProject false
- * //@ //goal clean
- * @deprecated
- */
-public class CleanMojo
- extends AbstractMojo
-{
- /**
- * The property file to delete.
- *
- * @parameter default-value="archetype.properties" expression="${archetype.properties}"
- */
- private File propertyFile;
-
- public void execute()
- throws
- MojoExecutionException,
- MojoFailureException
- {
- propertyFile.delete();
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.maven.archetype.mojos;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+import java.io.File;
+
+/**
+ * Clean archetype properties file.
+ *
+ * @author rafale
+ * @requiresProject false
+ * //@ //goal clean
+ * @deprecated
+ */
+public class CleanMojo
+ extends AbstractMojo
+{
+ /**
+ * The property file to delete.
+ *
+ * @parameter default-value="archetype.properties" expression="${archetype.properties}"
+ */
+ private File propertyFile;
+
+ public void execute()
+ throws
+ MojoExecutionException,
+ MojoFailureException
+ {
+ propertyFile.delete();
+ }
+}
Propchange: maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CleanMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateArchetypeFromProjectMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateProjectFromArchetypeMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/IntegrationTestMojo.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/IntegrationTestMojo.java?rev=833728&r1=833727&r2=833728&view=diff
==============================================================================
--- maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/IntegrationTestMojo.java (original)
+++ maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/IntegrationTestMojo.java Sat Nov 7 18:28:39 2009
@@ -1,316 +1,316 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.maven.archetype.mojos;
-
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.maven.archetype.common.Constants;
-import org.apache.maven.archetype.exception.ArchetypeGenerationFailure;
-import org.apache.maven.archetype.exception.ArchetypeNotConfigured;
-import org.apache.maven.archetype.exception.OutputFileExists;
-import org.apache.maven.archetype.exception.PomFileExists;
-import org.apache.maven.archetype.exception.ProjectDirectoryExists;
-import org.apache.maven.archetype.exception.UnknownArchetype;
-import org.apache.maven.archetype.generator.FilesetArchetypeGenerator;
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.project.MavenProject;
-import org.codehaus.plexus.util.FileUtils;
-import org.codehaus.plexus.util.StringUtils;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.StringWriter;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Properties;
-
-/**
- * Execute the archetype integration tests.
- *
- * @author rafale
- * @requiresProject true
- * @goal integration-test
- */
-public class IntegrationTestMojo
- extends AbstractMojo
-{
- /** @component */
- FilesetArchetypeGenerator filesetGenerator;
-
- /**
- * The archetype project to execute the integration tests on.
- *
- * @parameter expression="${project}"
- * @required
- * @readonly
- */
- private MavenProject project;
-
- /**
- * Skip the integration test.
- *
- * @parameter expression="${archetype.test.skip}"
- * @readonly
- */
- private boolean skip = false;
-
- public void execute()
- throws
- MojoExecutionException,
- MojoFailureException
- {
- if ( !skip )
- {
- try
- {
- File projectsDirectory =
- new File( project.getBasedir(), "target/test-classes/projects" );
-
- if ( projectsDirectory.exists() )
- {
- File archetypeFile = project.getArtifact().getFile();
-
- List projectsGoalFiles =
- FileUtils.getFiles( projectsDirectory, "*/goal.txt", "" );
-
- Iterator goalFiles = projectsGoalFiles.iterator();
-
- StringWriter errorWriter = new StringWriter();
- while ( goalFiles.hasNext() )
- {
- File goalFile = (File) goalFiles.next();
-
- try
- {
- processIntegrationTest( goalFile, archetypeFile );
- }
- catch ( IntegrationTestFailure ex )
- {
- errorWriter.write(
- "Test " + goalFile.getParentFile().getName() + " failed\n"
- );
-
- errorWriter.write( ex.getStackTrace() + "\n" );
- errorWriter.write( ex.getMessage() + "\n" );
- errorWriter.write( "\n" );
- }
- }
-
- String errors = errorWriter.toString();
- if ( !StringUtils.isEmpty( errors ) )
- {
- throw new MojoExecutionException( errors );
- }
- }
- }
- catch ( IOException ex )
- {
- throw new MojoFailureException( ex, ex.getMessage(), ex.getMessage() );
- }
- }
- }
-
- private void assertTest( File reference,
- File basedir )
- throws
- IntegrationTestFailure,
- IOException
- {
- List referenceFiles = FileUtils.getFileNames( reference, "**", null, false );
- List projectFiles = FileUtils.getFileNames( basedir, "**", null, false );
-
- boolean fileNamesEquals =
- CollectionUtils.isEqualCollection( referenceFiles, projectFiles );
-
- {
- Iterator refs = referenceFiles.iterator();
- while ( refs.hasNext() )
- {
- String ref = (String) refs.next();
-
- if ( projectFiles.contains( ref ) )
- {
- projectFiles.remove( ref );
- getLog().debug( "Contained " + ref );
- }
- else
- {
- getLog().debug( "Not contained " + ref );
- }
- }
- getLog().debug( "Remains " + projectFiles );
- }
-
- if ( !fileNamesEquals )
- {
- throw new IntegrationTestFailure( "Reference and generated project differs" );
- }
-
- boolean contentEquals = true;
- Iterator files = referenceFiles.iterator();
- while ( files.hasNext() )
- {
- String file = (String) files.next();
-
- if ( file.endsWith( "pom.xml" ) )
- {
- if ( !modelEquals( new File( reference, file ), new File( basedir, file ) ) )
- {
- getLog().warn( "Contents of file " + file + " are not equal" );
- contentEquals = false;
- }
- }
- else
- {
- if ( !FileUtils.contentEquals(
- new File( reference, file ),
- new File( basedir, file )
- )
- )
- {
- getLog().warn( "Contents of file " + file + " are not equal" );
- contentEquals = false;
- }
- }
- }
- if ( !contentEquals )
- {
- throw new IntegrationTestFailure( "Some content are not equals" );
- }
- }
-
- private Properties loadProperties( final File propertiesFile )
- throws
- IOException,
- FileNotFoundException
- {
- Properties properties = new Properties();
-
- properties.load( new FileInputStream( propertiesFile ) );
-
- return properties;
- }
-
- private boolean modelEquals( File referencePom,
- File generatedPom )
- throws
- IOException
- {
- return FileUtils.contentEquals( referencePom, generatedPom );
- }
-
- private void processIntegrationTest( File goalFile,
- File archetypeFile )
- throws
- IntegrationTestFailure
- {
- try
- {
- Properties testProperties = getTestProperties( goalFile );
-
- Properties properties = getProperties( goalFile );
-
- String basedir = goalFile.getParentFile().getPath() + "/project";
-
- FileUtils.mkdir( basedir );
-//TODO: fix this to use request
- filesetGenerator.generateArchetype( null, 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 );
- }
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.maven.archetype.mojos;
+
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.maven.archetype.common.Constants;
+import org.apache.maven.archetype.exception.ArchetypeGenerationFailure;
+import org.apache.maven.archetype.exception.ArchetypeNotConfigured;
+import org.apache.maven.archetype.exception.OutputFileExists;
+import org.apache.maven.archetype.exception.PomFileExists;
+import org.apache.maven.archetype.exception.ProjectDirectoryExists;
+import org.apache.maven.archetype.exception.UnknownArchetype;
+import org.apache.maven.archetype.generator.FilesetArchetypeGenerator;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.StringUtils;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.StringWriter;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+
+/**
+ * Execute the archetype integration tests.
+ *
+ * @author rafale
+ * @requiresProject true
+ * @goal integration-test
+ */
+public class IntegrationTestMojo
+ extends AbstractMojo
+{
+ /** @component */
+ FilesetArchetypeGenerator filesetGenerator;
+
+ /**
+ * The archetype project to execute the integration tests on.
+ *
+ * @parameter expression="${project}"
+ * @required
+ * @readonly
+ */
+ private MavenProject project;
+
+ /**
+ * Skip the integration test.
+ *
+ * @parameter expression="${archetype.test.skip}"
+ * @readonly
+ */
+ private boolean skip = false;
+
+ public void execute()
+ throws
+ MojoExecutionException,
+ MojoFailureException
+ {
+ if ( !skip )
+ {
+ try
+ {
+ File projectsDirectory =
+ new File( project.getBasedir(), "target/test-classes/projects" );
+
+ if ( projectsDirectory.exists() )
+ {
+ File archetypeFile = project.getArtifact().getFile();
+
+ List projectsGoalFiles =
+ FileUtils.getFiles( projectsDirectory, "*/goal.txt", "" );
+
+ Iterator goalFiles = projectsGoalFiles.iterator();
+
+ StringWriter errorWriter = new StringWriter();
+ while ( goalFiles.hasNext() )
+ {
+ File goalFile = (File) goalFiles.next();
+
+ try
+ {
+ processIntegrationTest( goalFile, archetypeFile );
+ }
+ catch ( IntegrationTestFailure ex )
+ {
+ errorWriter.write(
+ "Test " + goalFile.getParentFile().getName() + " failed\n"
+ );
+
+ errorWriter.write( ex.getStackTrace() + "\n" );
+ errorWriter.write( ex.getMessage() + "\n" );
+ errorWriter.write( "\n" );
+ }
+ }
+
+ String errors = errorWriter.toString();
+ if ( !StringUtils.isEmpty( errors ) )
+ {
+ throw new MojoExecutionException( errors );
+ }
+ }
+ }
+ catch ( IOException ex )
+ {
+ throw new MojoFailureException( ex, ex.getMessage(), ex.getMessage() );
+ }
+ }
+ }
+
+ private void assertTest( File reference,
+ File basedir )
+ throws
+ IntegrationTestFailure,
+ IOException
+ {
+ List referenceFiles = FileUtils.getFileNames( reference, "**", null, false );
+ List projectFiles = FileUtils.getFileNames( basedir, "**", null, false );
+
+ boolean fileNamesEquals =
+ CollectionUtils.isEqualCollection( referenceFiles, projectFiles );
+
+ {
+ Iterator refs = referenceFiles.iterator();
+ while ( refs.hasNext() )
+ {
+ String ref = (String) refs.next();
+
+ if ( projectFiles.contains( ref ) )
+ {
+ projectFiles.remove( ref );
+ getLog().debug( "Contained " + ref );
+ }
+ else
+ {
+ getLog().debug( "Not contained " + ref );
+ }
+ }
+ getLog().debug( "Remains " + projectFiles );
+ }
+
+ if ( !fileNamesEquals )
+ {
+ throw new IntegrationTestFailure( "Reference and generated project differs" );
+ }
+
+ boolean contentEquals = true;
+ Iterator files = referenceFiles.iterator();
+ while ( files.hasNext() )
+ {
+ String file = (String) files.next();
+
+ if ( file.endsWith( "pom.xml" ) )
+ {
+ if ( !modelEquals( new File( reference, file ), new File( basedir, file ) ) )
+ {
+ getLog().warn( "Contents of file " + file + " are not equal" );
+ contentEquals = false;
+ }
+ }
+ else
+ {
+ if ( !FileUtils.contentEquals(
+ new File( reference, file ),
+ new File( basedir, file )
+ )
+ )
+ {
+ getLog().warn( "Contents of file " + file + " are not equal" );
+ contentEquals = false;
+ }
+ }
+ }
+ if ( !contentEquals )
+ {
+ throw new IntegrationTestFailure( "Some content are not equals" );
+ }
+ }
+
+ private Properties loadProperties( final File propertiesFile )
+ throws
+ IOException,
+ FileNotFoundException
+ {
+ Properties properties = new Properties();
+
+ properties.load( new FileInputStream( propertiesFile ) );
+
+ return properties;
+ }
+
+ private boolean modelEquals( File referencePom,
+ File generatedPom )
+ throws
+ IOException
+ {
+ return FileUtils.contentEquals( referencePom, generatedPom );
+ }
+
+ private void processIntegrationTest( File goalFile,
+ File archetypeFile )
+ throws
+ IntegrationTestFailure
+ {
+ try
+ {
+ Properties testProperties = getTestProperties( goalFile );
+
+ Properties properties = getProperties( goalFile );
+
+ String basedir = goalFile.getParentFile().getPath() + "/project";
+
+ FileUtils.mkdir( basedir );
+//TODO: fix this to use request
+ filesetGenerator.generateArchetype( null, 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/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/IntegrationTestMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archetype/trunk/archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeFactory.java
------------------------------------------------------------------------------
svn:eol-style = native