You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ev...@apache.org on 2006/08/22 16:57:03 UTC

svn commit: r433654 [1/4] - in /maven/shared/trunk/maven-model-converter: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/maven/ src/main/java/org/apache/maven/model/ src/main/java/org/apache/maven...

Author: evenisse
Date: Tue Aug 22 07:56:59 2006
New Revision: 433654

URL: http://svn.apache.org/viewvc?rev=433654&view=rev
Log:
Moving from maven-components

Added:
    maven/shared/trunk/maven-model-converter/
    maven/shared/trunk/maven-model-converter/pom.xml   (with props)
    maven/shared/trunk/maven-model-converter/src/
    maven/shared/trunk/maven-model-converter/src/main/
    maven/shared/trunk/maven-model-converter/src/main/java/
    maven/shared/trunk/maven-model-converter/src/main/java/org/
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/ArtifactPomRewriter.java   (with props)
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/ConverterListener.java   (with props)
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/Maven1Converter.java   (with props)
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/ModelConverter.java   (with props)
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/ModelUtils.java   (with props)
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/PomTranslationException.java   (with props)
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/PomV3ToV4Translator.java   (with props)
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/ProjectConverterException.java   (with props)
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/V3PomRewriter.java   (with props)
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/V4PomRewriter.java   (with props)
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/AbstractPluginConfigurationConverter.java   (with props)
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCChangelog.java   (with props)
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCChanges.java   (with props)
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCCheckstyle.java   (with props)
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCCompiler.java   (with props)
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCJar.java   (with props)
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCJavadoc.java   (with props)
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCMultiproject.java   (with props)
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCPmd.java   (with props)
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCSurefire.java   (with props)
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCTaglist.java   (with props)
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PCCWar.java   (with props)
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PluginConfigurationConverter.java   (with props)
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/PropertyUtils.java   (with props)
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/relocators/
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/relocators/AbstractPluginRelocator.java   (with props)
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/relocators/AbstractSourceForgePluginRelocator.java   (with props)
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/relocators/CoberturaPluginRelocator.java   (with props)
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/relocators/DefaultPluginRelocatorManager.java   (with props)
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/relocators/DeveloperActivityPluginRelocator.java   (with props)
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/relocators/FaqPluginRelocator.java   (with props)
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/relocators/FileActivityPluginRelocator.java   (with props)
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/relocators/FindbugsPluginRelocator.java   (with props)
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/relocators/JdependPluginRelocator.java   (with props)
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/relocators/JdiffPluginRelocator.java   (with props)
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/relocators/JunitReportPluginRelocator.java   (with props)
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/relocators/LicenseRelocator.java   (with props)
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/relocators/NoSuchPluginRelocatorException.java   (with props)
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/relocators/PluginRelocator.java   (with props)
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/relocators/PluginRelocatorManager.java   (with props)
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/relocators/SimianPluginRelocator.java   (with props)
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/relocators/TasklistPluginRelocator.java   (with props)
    maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/relocators/XdocPluginRelocator.java   (with props)
    maven/shared/trunk/maven-model-converter/src/test/
    maven/shared/trunk/maven-model-converter/src/test/java/
    maven/shared/trunk/maven-model-converter/src/test/java/org/
    maven/shared/trunk/maven-model-converter/src/test/java/org/apache/
    maven/shared/trunk/maven-model-converter/src/test/java/org/apache/maven/
    maven/shared/trunk/maven-model-converter/src/test/java/org/apache/maven/model/
    maven/shared/trunk/maven-model-converter/src/test/java/org/apache/maven/model/converter/
    maven/shared/trunk/maven-model-converter/src/test/java/org/apache/maven/model/converter/PomV3ToV4TranslatorTest.java   (with props)
    maven/shared/trunk/maven-model-converter/src/test/java/org/apache/maven/model/converter/V3PomRewriterTest.java   (with props)
    maven/shared/trunk/maven-model-converter/src/test/java/org/apache/maven/model/converter/plugins/
    maven/shared/trunk/maven-model-converter/src/test/java/org/apache/maven/model/converter/plugins/AbstractPCCTest.java   (with props)
    maven/shared/trunk/maven-model-converter/src/test/java/org/apache/maven/model/converter/plugins/PCCChangelogTest.java   (with props)
    maven/shared/trunk/maven-model-converter/src/test/java/org/apache/maven/model/converter/plugins/PCCChangesTest.java   (with props)
    maven/shared/trunk/maven-model-converter/src/test/java/org/apache/maven/model/converter/plugins/PCCCheckstyleTest.java   (with props)
    maven/shared/trunk/maven-model-converter/src/test/java/org/apache/maven/model/converter/plugins/PCCCompilerTest.java   (with props)
    maven/shared/trunk/maven-model-converter/src/test/java/org/apache/maven/model/converter/plugins/PCCJarTest.java   (with props)
    maven/shared/trunk/maven-model-converter/src/test/java/org/apache/maven/model/converter/plugins/PCCJavadocTest.java   (with props)
    maven/shared/trunk/maven-model-converter/src/test/java/org/apache/maven/model/converter/plugins/PCCPmdTest.java   (with props)
    maven/shared/trunk/maven-model-converter/src/test/java/org/apache/maven/model/converter/plugins/PCCSurefireTest.java   (with props)
    maven/shared/trunk/maven-model-converter/src/test/java/org/apache/maven/model/converter/plugins/PCCTaglistTest.java   (with props)
    maven/shared/trunk/maven-model-converter/src/test/java/org/apache/maven/model/converter/plugins/PCCWarTest.java   (with props)
    maven/shared/trunk/maven-model-converter/src/test/java/org/apache/maven/model/converter/plugins/PropertyUtilsTest.java   (with props)
    maven/shared/trunk/maven-model-converter/src/test/resources/
    maven/shared/trunk/maven-model-converter/src/test/resources/PCCChangelogTest1.properties   (with props)
    maven/shared/trunk/maven-model-converter/src/test/resources/PCCChangelogTest2.properties   (with props)
    maven/shared/trunk/maven-model-converter/src/test/resources/PCCChangelogTest3.properties   (with props)
    maven/shared/trunk/maven-model-converter/src/test/resources/PCCChangesTest.properties   (with props)
    maven/shared/trunk/maven-model-converter/src/test/resources/PCCCheckstyleTest1.properties   (with props)
    maven/shared/trunk/maven-model-converter/src/test/resources/PCCCheckstyleTest2.properties   (with props)
    maven/shared/trunk/maven-model-converter/src/test/resources/PCCCheckstyleTest3.properties   (with props)
    maven/shared/trunk/maven-model-converter/src/test/resources/PCCCompilerTest.properties   (with props)
    maven/shared/trunk/maven-model-converter/src/test/resources/PCCJarTest.properties   (with props)
    maven/shared/trunk/maven-model-converter/src/test/resources/PCCJavadocTest1.properties   (with props)
    maven/shared/trunk/maven-model-converter/src/test/resources/PCCJavadocTest2.properties   (with props)
    maven/shared/trunk/maven-model-converter/src/test/resources/PCCJavadocTest3.properties   (with props)
    maven/shared/trunk/maven-model-converter/src/test/resources/PCCPmdTest.properties   (with props)
    maven/shared/trunk/maven-model-converter/src/test/resources/PCCSureFireTest1.properties   (with props)
    maven/shared/trunk/maven-model-converter/src/test/resources/PCCSureFireTest2.properties   (with props)
    maven/shared/trunk/maven-model-converter/src/test/resources/PCCSureFireTest3.properties   (with props)
    maven/shared/trunk/maven-model-converter/src/test/resources/PCCTaglistTest.properties   (with props)
    maven/shared/trunk/maven-model-converter/src/test/resources/PCCWarTest1.properties   (with props)
    maven/shared/trunk/maven-model-converter/src/test/resources/PCCWarTest2.properties   (with props)
    maven/shared/trunk/maven-model-converter/src/test/resources/PCCWarTest3.properties   (with props)

Added: maven/shared/trunk/maven-model-converter/pom.xml
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-model-converter/pom.xml?rev=433654&view=auto
==============================================================================
--- maven/shared/trunk/maven-model-converter/pom.xml (added)
+++ maven/shared/trunk/maven-model-converter/pom.xml Tue Aug 22 07:56:59 2006
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  ~ Copyright 2005-2006 The Apache Software Foundation.
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <parent>
+    <artifactId>maven</artifactId>
+    <groupId>org.apache.maven</groupId>
+    <version>2.1-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>maven-model-converter</artifactId>
+  <name>Maven Model Converter</name>
+  <description>Converts between version 3.0.0 and version 4.0.0 models.</description>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-model-v3</artifactId>
+      <version>2.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-model</artifactId>
+      <version>2.1-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-utils</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-container-default</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>dom4j</groupId>
+      <artifactId>dom4j</artifactId>
+      <version>1.4</version>
+    </dependency>
+  </dependencies>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.plexus</groupId>
+        <artifactId>plexus-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <goals>
+              <goal>descriptor</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: maven/shared/trunk/maven-model-converter/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/shared/trunk/maven-model-converter/pom.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/ArtifactPomRewriter.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/ArtifactPomRewriter.java?rev=433654&view=auto
==============================================================================
--- maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/ArtifactPomRewriter.java (added)
+++ maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/ArtifactPomRewriter.java Tue Aug 22 07:56:59 2006
@@ -0,0 +1,39 @@
+package org.apache.maven.model.converter;
+
+/*
+ * Copyright 2005-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.Reader;
+import java.io.Writer;
+import java.util.List;
+
+/**
+ * @author jdcasey
+ */
+public interface ArtifactPomRewriter
+{
+    public static final String ROLE = ArtifactPomRewriter.class.getName();
+
+    public static final String V3_POM = "v3";
+
+    public static final String V4_POM = "v4";
+
+    public void rewrite( Reader from, Writer to, boolean reportOnly, String groupId, String artifactId, String version,
+                         String packaging )
+        throws Exception;
+
+    List getWarnings();
+}

Propchange: maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/ArtifactPomRewriter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/ArtifactPomRewriter.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/ConverterListener.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/ConverterListener.java?rev=433654&view=auto
==============================================================================
--- maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/ConverterListener.java (added)
+++ maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/ConverterListener.java Tue Aug 22 07:56:59 2006
@@ -0,0 +1,36 @@
+package org.apache.maven.model.converter;
+
+/*
+ * Copyright 2001-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public interface ConverterListener
+{
+    void debug( String message );
+
+    void debug( String message, Throwable throwable );
+
+    void info( String message );
+
+    void info( String message, Throwable throwable );
+
+    void warn( String message );
+
+    void warn( String message, Throwable throwable );
+
+    void error( String message);
+
+    void error( String message, Throwable throwable );
+}

Propchange: maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/ConverterListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/ConverterListener.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/Maven1Converter.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/Maven1Converter.java?rev=433654&view=auto
==============================================================================
--- maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/Maven1Converter.java (added)
+++ maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/Maven1Converter.java Tue Aug 22 07:56:59 2006
@@ -0,0 +1,379 @@
+package org.apache.maven.model.converter;
+
+/*
+ * Copyright 2001-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.maven.model.Model;
+import org.apache.maven.model.converter.plugins.PluginConfigurationConverter;
+import org.apache.maven.model.converter.relocators.PluginRelocator;
+import org.apache.maven.model.converter.relocators.PluginRelocatorManager;
+import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
+import org.apache.maven.model.v3_0_0.io.xpp3.MavenXpp3Reader;
+import org.codehaus.plexus.logging.AbstractLogEnabled;
+import org.codehaus.plexus.util.IOUtil;
+import org.dom4j.Document;
+import org.dom4j.Element;
+import org.dom4j.io.SAXReader;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+/**
+ * Converts a Maven 1 project.xml (v3 pom) to a Maven 2 pom.xml (v4 pom).
+ *
+ * @author Fabrizio Giustina
+ * @author Dennis Lundberg
+ * @version $Id$
+ * @plexus.component role="org.apache.maven.model.converter.Maven1Converter"
+ */
+public class Maven1Converter
+    extends AbstractLogEnabled
+{
+    /**
+     * Available converters for specific plugin configurations
+     *
+     * @plexus.requirement role="org.apache.maven.model.converter.plugins.PluginConfigurationConverter"
+     */
+    private List converters;
+
+    /**
+     * Plexus component that manages plugin relocators
+     *
+     * @plexus.requirement
+     */
+    private PluginRelocatorManager pluginRelocatorManager;
+
+    private File basedir;
+
+    private File outputdir;
+
+    private String fileName = "project.xml";
+
+    private List listeners = new ArrayList();
+
+    public void execute()
+        throws ProjectConverterException
+    {
+        File projectxml = new File( basedir, fileName );
+
+        if ( !projectxml.exists() )
+        {
+            throw new ProjectConverterException( "Missing " + fileName + " in " + basedir.getAbsolutePath() );
+        }
+
+        PomV3ToV4Translator translator = new PomV3ToV4Translator();
+
+        org.apache.maven.model.v3_0_0.Model v3Model;
+        try
+        {
+            v3Model = loadV3Pom( projectxml );
+        }
+        catch ( Exception e )
+        {
+            throw new ProjectConverterException( "Exception caught while loading " + fileName + ". " + e.getMessage(), e );
+        }
+
+        Model v4Model;
+        try
+        {
+            v4Model = translator.translate( v3Model );
+            removeDistributionManagementStatus( v4Model );
+        }
+        catch ( Exception e )
+        {
+            throw new ProjectConverterException( "Exception caught while converting " + fileName + ". " + e.getMessage(),
+                                                 e );
+        }
+
+        Properties properties = new Properties();
+
+        if ( v3Model.getExtend() != null )
+        {
+            loadProperties( properties, new File( new File( basedir, v3Model.getExtend() ).getParentFile(),
+                                                  "project.properties" ) );
+        }
+
+        loadProperties( properties, new File( basedir, "project.properties" ) );
+
+        for ( Iterator i = converters.iterator(); i.hasNext(); )
+        {
+            PluginConfigurationConverter converter = (PluginConfigurationConverter) i.next();
+            converter.convertConfiguration( v4Model, v3Model, properties );
+        }
+
+        // @todo Should this be run before or after the configuration converters?
+        Collection pluginRelocators = pluginRelocatorManager.getPluginRelocators();
+        sendInfoMessage( "There are " + pluginRelocators.size() + " plugin relocators available" );
+        PluginRelocator pluginRelocator;
+        Iterator iterator = pluginRelocators.iterator();
+        while ( iterator.hasNext() )
+        {
+            pluginRelocator = (PluginRelocator) iterator.next();
+            pluginRelocator.relocate( v4Model );
+        }
+
+        try
+        {
+            writeV4Pom( v4Model );
+        }
+        catch ( IOException e )
+        {
+            throw new ProjectConverterException( "Failed to write the pom.xml.", e );
+        }
+    }
+
+    private boolean isEmpty( String value )
+    {
+        return value == null || value.trim().length() == 0;
+    }
+
+    private void loadProperties( Properties properties, File propertiesFile )
+    {
+        if ( propertiesFile.exists() )
+        {
+            InputStream is = null;
+            try
+            {
+                is = new FileInputStream( propertiesFile );
+                properties.load( is );
+            }
+            catch ( IOException e )
+            {
+                sendWarnMessage( "Unable to read " + propertiesFile.getAbsolutePath() + ", ignoring." );
+            }
+            finally
+            {
+                IOUtil.close( is );
+            }
+        }
+    }
+
+    private org.apache.maven.model.v3_0_0.Model loadV3Pom( File inputFile )
+        throws Exception
+    {
+        MavenXpp3Reader v3Reader = new MavenXpp3Reader();
+
+        org.apache.maven.model.v3_0_0.Model model;
+
+        model = v3Reader.read( new FileReader( inputFile ) );
+
+        SAXReader r = new SAXReader();
+
+        Document d = r.read( new FileReader( inputFile ) );
+
+        Element root = d.getRootElement();
+
+        Element idElement = root.element( "id" );
+
+        String id = null;
+
+        if ( idElement != null )
+        {
+            id = idElement.getText();
+        }
+        //        String id = model.getId();
+
+        String groupId = model.getGroupId();
+
+        String artifactId = model.getArtifactId();
+
+        if ( !isEmpty( id ) )
+        {
+            int i = id.indexOf( "+" );
+
+            int j = id.indexOf( ":" );
+
+            if ( i > 0 )
+            {
+                model.setGroupId( id.substring( 0, i ) );
+
+                model.setArtifactId( id.replace( '+', '-' ) );
+            }
+            else if ( j > 0 )
+            {
+                model.setGroupId( id.substring( 0, j ) );
+
+                model.setArtifactId( id.substring( j + 1 ) );
+            }
+            else
+            {
+                model.setGroupId( id );
+
+                model.setArtifactId( id );
+            }
+
+            if ( !isEmpty( groupId ) )
+            {
+                sendWarnMessage( "Both <id> and <groupId> is set, using <groupId>." );
+
+                model.setGroupId( groupId );
+            }
+
+            if ( !isEmpty( artifactId ) )
+            {
+                sendWarnMessage( "Both <id> and <artifactId> is set, using <artifactId>." );
+
+                model.setArtifactId( artifactId );
+            }
+        }
+
+        return model;
+    }
+
+    /**
+     * The status element of the distributionManagement section must not be
+     * set in local projects. This method removes that element from the model.
+     */
+    private void removeDistributionManagementStatus( Model v4Model )
+    {
+        if ( v4Model.getDistributionManagement() != null )
+        {
+            if ( "converted".equals( v4Model.getDistributionManagement().getStatus() ) )
+            {
+                v4Model.getDistributionManagement().setStatus( null );
+            }
+        }
+    }
+
+    /**
+     * Write the pom to <code>${basedir}/pom.xml</code>. If the file exists it
+     * will be overwritten.
+     *
+     * @param v4Model
+     * @throws ProjectConverterException
+     */
+    private void writeV4Pom( Model v4Model )
+        throws ProjectConverterException, IOException
+    {
+        if ( outputdir == null )
+        {
+            outputdir = basedir;
+        }
+
+        if ( !outputdir.exists() && !outputdir.mkdirs() )
+        {
+            throw new IOException( "Failed to create directory " + outputdir );
+        }
+
+        File pomxml = new File( outputdir, "pom.xml" );
+
+        if ( pomxml.exists() )
+        {
+            sendWarnMessage( "pom.xml in " + outputdir.getAbsolutePath() + " already exists, overwriting" );
+        }
+
+        MavenXpp3Writer v4Writer = new MavenXpp3Writer();
+
+        // write the new pom.xml
+        sendInfoMessage( "Writing new pom to: " + pomxml.getAbsolutePath() );
+
+        Writer output = null;
+        try
+        {
+            output = new FileWriter( pomxml );
+            v4Writer.write( output, v4Model );
+            output.close();
+        }
+        catch ( IOException e )
+        {
+            throw new ProjectConverterException( "Unable to write pom.xml. " + e.getMessage(), e );
+        }
+        finally
+        {
+            IOUtil.close( output );
+        }
+    }
+
+    public File getBasedir()
+    {
+        return basedir;
+    }
+
+    public void setBasedir( File basedir )
+    {
+        this.basedir = basedir;
+    }
+
+    public String getProjectFileName()
+    {
+        return fileName;
+    }
+
+    public void setProjectFileName( String projectFileName )
+    {
+        this.fileName = projectFileName;
+    }
+
+    public void setProjectFile( File projectFile )
+    {
+        if ( projectFile != null )
+        {
+            basedir = projectFile.getParentFile();
+            fileName = projectFile.getName();
+        }
+    }
+
+    public File getOutputdir()
+    {
+        return outputdir;
+    }
+
+    public void setOutputdir( File outputdir )
+    {
+        this.outputdir = outputdir;
+    }
+
+    public void addListener( ConverterListener listener )
+    {
+        if ( !listeners.contains( listener ) )
+        {
+            listeners.add( listener );
+        }
+    }
+
+    private void sendInfoMessage( String message )
+    {
+        getLogger().info( message );
+        
+        for ( Iterator i = listeners.iterator(); i.hasNext(); )
+        {
+            ConverterListener listener = (ConverterListener) i.next();
+            listener.info( message );
+        }
+    }
+
+    private void sendWarnMessage( String message )
+    {
+        getLogger().warn( message );
+        
+        for ( Iterator i = listeners.iterator(); i.hasNext(); )
+        {
+            ConverterListener listener = (ConverterListener) i.next();
+            listener.warn( message );
+        }
+    }
+}

Propchange: maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/Maven1Converter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/Maven1Converter.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/ModelConverter.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/ModelConverter.java?rev=433654&view=auto
==============================================================================
--- maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/ModelConverter.java (added)
+++ maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/ModelConverter.java Tue Aug 22 07:56:59 2006
@@ -0,0 +1,39 @@
+package org.apache.maven.model.converter;
+
+/*
+ * Copyright 2005-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.maven.model.Model;
+
+import java.util.List;
+
+/**
+ * Model conversion interface.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ * @version $Id$
+ */
+public interface ModelConverter
+{
+    String ROLE = ModelConverter.class.getName();
+
+    Model translate( org.apache.maven.model.v3_0_0.Model v3Model )
+        throws PomTranslationException;
+
+    void validateV4Basics( Model model, String groupId, String artifactId, String version, String packaging );
+
+    List getWarnings();
+}

Propchange: maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/ModelConverter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/ModelConverter.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/ModelUtils.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/ModelUtils.java?rev=433654&view=auto
==============================================================================
--- maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/ModelUtils.java (added)
+++ maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/ModelUtils.java Tue Aug 22 07:56:59 2006
@@ -0,0 +1,86 @@
+package org.apache.maven.model.converter;
+
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.model.ReportPlugin;
+
+import java.util.Iterator;
+
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Utility class which features various methods associated with Maven model.
+ *
+ * @author Dennis Lundberg
+ * @version $Id$
+ */
+public class ModelUtils
+{
+    /**
+     * Try to find a build plugin in a model.
+     *
+     * @param model      Look for the build plugin in this model
+     * @param groupId    The groupId for the build plugin to look for
+     * @param artifactId The artifactId for the build plugin to look for
+     * @return The requested build plugin if it exists, otherwise null
+     */
+    public static Plugin findBuildPlugin( Model model, String groupId, String artifactId )
+    {
+        if ( model.getBuild() == null || model.getBuild().getPlugins() == null )
+        {
+            return null;
+        }
+
+        Iterator iterator = model.getBuild().getPlugins().iterator();
+        while ( iterator.hasNext() )
+        {
+            Plugin plugin = (Plugin) iterator.next();
+            if ( plugin.getGroupId().equals( groupId ) && plugin.getArtifactId().equals( artifactId ) )
+            {
+                return plugin;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Try to find a report plugin in a model.
+     *
+     * @param model      Look for the report plugin in this model
+     * @param groupId    The groupId for the report plugin to look for
+     * @param artifactId The artifactId for the report plugin to look for
+     * @return The requested report plugin if it exists, otherwise null
+     */
+    public static ReportPlugin findReportPlugin( Model model, String groupId, String artifactId )
+    {
+        if ( model.getReporting() == null || model.getReporting().getPlugins() == null )
+        {
+            return null;
+        }
+        
+        Iterator iterator = model.getReporting().getPlugins().iterator();
+        while ( iterator.hasNext() )
+        {
+            ReportPlugin plugin = (ReportPlugin) iterator.next();
+            if ( plugin.getGroupId().equals( groupId ) && plugin.getArtifactId().equals( artifactId ) )
+            {
+                return plugin;
+            }
+        }
+        return null;
+    }
+}

Propchange: maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/ModelUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/ModelUtils.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/PomTranslationException.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/PomTranslationException.java?rev=433654&view=auto
==============================================================================
--- maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/PomTranslationException.java (added)
+++ maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/PomTranslationException.java Tue Aug 22 07:56:59 2006
@@ -0,0 +1,62 @@
+package org.apache.maven.model.converter;/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @author jdcasey
+ */
+public class PomTranslationException
+    extends Exception
+{
+
+    private final String groupId;
+
+    private final String artifactId;
+
+    private final String version;
+
+    public PomTranslationException( String groupId, String artifactId, String version, String message )
+    {
+        this( groupId, artifactId, version, message, null );
+    }
+
+    public PomTranslationException( String groupId, String artifactId, String version, Throwable cause )
+    {
+        this( groupId, artifactId, version, "[No message provided.]", cause );
+    }
+
+    public PomTranslationException( String groupId, String artifactId, String version, String message, Throwable cause )
+    {
+        super( "In POM{" + groupId + ":" + artifactId + ":" + version + "}: " + message, cause );
+        this.groupId = groupId;
+        this.artifactId = artifactId;
+        this.version = version;
+    }
+
+    public String getGroupId()
+    {
+        return groupId;
+    }
+
+    public String getArtifactId()
+    {
+        return artifactId;
+    }
+
+    public String getVersion()
+    {
+        return version;
+    }
+}
\ No newline at end of file

Propchange: maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/PomTranslationException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/PomTranslationException.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/PomV3ToV4Translator.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/PomV3ToV4Translator.java?rev=433654&view=auto
==============================================================================
--- maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/PomV3ToV4Translator.java (added)
+++ maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/PomV3ToV4Translator.java Tue Aug 22 07:56:59 2006
@@ -0,0 +1,867 @@
+package org.apache.maven.model.converter;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.maven.model.Build;
+import org.apache.maven.model.CiManagement;
+import org.apache.maven.model.Contributor;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.DeploymentRepository;
+import org.apache.maven.model.Developer;
+import org.apache.maven.model.DistributionManagement;
+import org.apache.maven.model.IssueManagement;
+import org.apache.maven.model.License;
+import org.apache.maven.model.MailingList;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Notifier;
+import org.apache.maven.model.Organization;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.model.Resource;
+import org.apache.maven.model.Scm;
+import org.apache.maven.model.Site;
+import org.apache.maven.model.v3_0_0.UnitTest;
+import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+
+/**
+ * @author jdcasey
+ * @plexus.component role="org.apache.maven.model.converter.ModelConverter"
+ */
+public class PomV3ToV4Translator
+    implements ModelConverter
+{
+    private transient List discoveredPlugins = new ArrayList();
+
+    private List warnings;
+
+    public Model translate( org.apache.maven.model.v3_0_0.Model v3Model )
+        throws PomTranslationException
+    {
+        warnings = new ArrayList();
+
+        try
+        {
+            String groupId = format( v3Model.getGroupId() );
+            String artifactId = format( v3Model.getArtifactId() );
+
+            String id = v3Model.getId();
+
+            if ( StringUtils.isNotEmpty( id ) )
+            {
+                if ( StringUtils.isEmpty( groupId ) )
+                {
+                    int plusIdx = id.indexOf( "+" );
+                    if ( plusIdx > -1 )
+                    {
+                        groupId = id.substring( 0, plusIdx );
+                    }
+                    else
+                    {
+                        groupId = id;
+                    }
+                }
+
+                if ( StringUtils.isEmpty( artifactId ) )
+                {
+                    artifactId = format( id );
+                }
+            }
+
+            String version = format( v3Model.getCurrentVersion() );
+
+            if ( version == null )
+            {
+                version = format( v3Model.getVersion() );
+            }
+
+            PomKey pomKey = new PomKey( groupId, artifactId, version );
+
+            warnOfUnsupportedMainModelElements( v3Model );
+
+            Model model = new Model();
+            model.setArtifactId( artifactId );
+
+            // moved this above the translation of the build, to allow
+            // additional plugins to be defined in v3 poms via
+            // <dependency><type>plugin</type></dependency>
+            model.setDependencies( translateDependencies( v3Model.getDependencies() ) );
+
+            model.setBuild( translateBuild( v3Model.getBuild() ) );
+            model.setCiManagement( translateCiManagementInfo( v3Model.getBuild() ) );
+            model.setContributors( translateContributors( v3Model.getContributors() ) );
+
+            model.setDescription( v3Model.getDescription() );
+            model.setDevelopers( translateDevelopers( v3Model.getDevelopers() ) );
+
+            model.setDistributionManagement( translateDistributionManagement( pomKey, v3Model ) );
+
+            model.setGroupId( groupId );
+            model.setInceptionYear( v3Model.getInceptionYear() );
+            model.setIssueManagement( translateIssueManagement( v3Model ) );
+
+            model.setLicenses( translateLicenses( v3Model.getLicenses() ) );
+            model.setMailingLists( translateMailingLists( v3Model.getMailingLists() ) );
+            model.setModelVersion( "4.0.0" );
+            model.setName( v3Model.getName() );
+            model.setOrganization( translateOrganization( v3Model.getOrganization() ) );
+            model.setPackaging( "jar" );
+            // TODO: not very good conversion - just omit for now
+//                model.setReporting( translateReports( v3Model.getReports(), reporter ) );
+            model.setScm( translateScm( v3Model ) );
+            model.setUrl( v3Model.getUrl() );
+
+            model.setVersion( version );
+
+            return model;
+        }
+        finally
+        {
+            this.discoveredPlugins.clear();
+        }
+    }
+
+    private String format( String source )
+    {
+        return source == null ? null : source.replace( '+', '-' );
+    }
+
+    private CiManagement translateCiManagementInfo( org.apache.maven.model.v3_0_0.Build v3Build )
+    {
+        CiManagement ciMgmt = null;
+
+        if ( v3Build != null )
+        {
+            String nagEmailAddress = v3Build.getNagEmailAddress();
+
+            if ( StringUtils.isNotEmpty( nagEmailAddress ) )
+            {
+                Notifier notifier = new Notifier();
+
+                notifier.setType( "mail" );
+                notifier.addConfiguration( "address", nagEmailAddress );
+
+                ciMgmt = new CiManagement();
+                ciMgmt.addNotifier( notifier );
+            }
+        }
+
+        return ciMgmt;
+    }
+
+    private void warnOfUnsupportedMainModelElements( org.apache.maven.model.v3_0_0.Model v3Model )
+    {
+        if ( StringUtils.isNotEmpty( v3Model.getExtend() ) )
+        {
+            warnings.add( "Ignoring non-portable parent declaration: " + v3Model.getExtend() );
+        }
+
+        if ( StringUtils.isNotEmpty( v3Model.getGumpRepositoryId() ) )
+        {
+            warnings.add( "Ignoring gump repository id: \'" + v3Model.getGumpRepositoryId() +
+                "\'. This is not supported in v4 POMs." );
+        }
+
+        if ( notEmpty( v3Model.getVersions() ) )
+        {
+            warnings.add( "Ignoring <versions/> section. This is not supported in v4 POMs." );
+        }
+
+        if ( notEmpty( v3Model.getBranches() ) )
+        {
+            warnings.add( "Ignoring <branches/> section. This is not supported in v4 POMs." );
+        }
+
+        Properties v3ModelProperties = v3Model.getProperties();
+
+        if ( v3ModelProperties != null && !v3ModelProperties.isEmpty() )
+        {
+            warnings.add( "Ignoring <properties/> section. It is not supported in v4 POMs." );
+        }
+
+        if ( StringUtils.isNotEmpty( v3Model.getPackage() ) )
+        {
+            warnings.add( "Ignoring <package/>. It is not supported in v4 POMs." );
+        }
+
+        if ( notEmpty( v3Model.getPackageGroups() ) )
+        {
+            warnings.add( "Ignoring <packageGroups/> section. It is not supported in v4 POMs." );
+        }
+
+        if ( StringUtils.isNotEmpty( v3Model.getLogo() ) )
+        {
+            warnings.add( "Ignoring <logo/> for project. It is not supported in v4 POMs." );
+        }
+
+        if ( StringUtils.isNotEmpty( v3Model.getShortDescription() ) )
+        {
+            warnings.add( "Ignoring <shortDescription/>. It is not supported in v4 POMs." );
+        }
+    }
+
+    private Scm translateScm( org.apache.maven.model.v3_0_0.Model v3Model )
+    {
+        Scm scm = null;
+
+        org.apache.maven.model.v3_0_0.Repository repo = v3Model.getRepository();
+        if ( repo != null )
+        {
+            scm = new Scm();
+            scm.setConnection( repo.getConnection() );
+            scm.setDeveloperConnection( repo.getDeveloperConnection() );
+            scm.setUrl( repo.getUrl() );
+        }
+
+        return scm;
+    }
+
+/*
+    private Reporting translateReports( List v3Reports, Reporter reporter )
+        throws ReportWriteException
+    {
+        Reporting reports = null;
+        if ( v3Reports != null && !v3Reports.isEmpty() )
+        {
+            reports = new Reporting();
+            for ( Iterator it = v3Reports.iterator(); it.hasNext(); )
+            {
+                String reportName = (String) it.next();
+
+                Pattern pluginNamePattern = Pattern.compile( "maven-(.+)-plugin" );
+                Matcher matcher = pluginNamePattern.matcher( reportName );
+
+                String reportPluginName;
+                if ( !matcher.matches() )
+                {
+                    warnings.add(
+                        "Non-standard report name: \'" + reportName + "\'. Using entire name for plugin artifactId." );
+
+                    reportPluginName = reportName;
+                }
+                else
+                {
+                    reportPluginName = matcher.group( 1 );
+                }
+
+                ReportPlugin reportPlugin = new ReportPlugin();
+
+                reportPlugin.setGroupId( "maven" );
+
+                reportPlugin.setArtifactId( reportPluginName );
+
+                StringBuffer info = new StringBuffer();
+
+                info.append( "Using some derived information for report: \'" ).append( reportName ).append( "\'.\n" )
+                    .append( "\to groupId: \'maven\'\n" ).append( "\to artifactId: \'" ).append( reportPluginName )
+                    .append( "\'\n" ).append( "\to goal: \'report\'\n" )
+                    .append( "\n" )
+                    .append( "These values were extracted using the v3 report naming convention, but may be wrong." );
+
+                warnings.add( info.toString() );
+
+                reports.addPlugin( reportPlugin );
+            }
+        }
+
+        return reports;
+    }
+*/
+
+    private Organization translateOrganization( org.apache.maven.model.v3_0_0.Organization v3Organization )
+    {
+        Organization organization = null;
+
+        if ( v3Organization != null )
+        {
+            organization = new Organization();
+
+            organization.setName( v3Organization.getName() );
+            organization.setUrl( v3Organization.getUrl() );
+
+            if ( StringUtils.isNotEmpty( v3Organization.getLogo() ) )
+            {
+                warnings.add( "Ignoring <organization><logo/></organization>. It is not supported in v4 POMs." );
+            }
+        }
+
+        return organization;
+    }
+
+    private List translateMailingLists( List v3MailingLists )
+    {
+        List mailingLists = new ArrayList();
+
+        if ( notEmpty( v3MailingLists ) )
+        {
+            for ( Iterator it = v3MailingLists.iterator(); it.hasNext(); )
+            {
+                org.apache.maven.model.v3_0_0.MailingList v3List = (org.apache.maven.model.v3_0_0.MailingList) it
+                    .next();
+                MailingList list = new MailingList();
+                list.setArchive( v3List.getArchive() );
+                list.setName( v3List.getName() );
+                list.setSubscribe( v3List.getSubscribe() );
+                list.setUnsubscribe( v3List.getUnsubscribe() );
+
+                mailingLists.add( list );
+            }
+        }
+
+        return mailingLists;
+    }
+
+    private List translateLicenses( List v3Licenses )
+    {
+        List licenses = new ArrayList();
+
+        if ( notEmpty( v3Licenses ) )
+        {
+            for ( Iterator it = v3Licenses.iterator(); it.hasNext(); )
+            {
+                org.apache.maven.model.v3_0_0.License v3License = (org.apache.maven.model.v3_0_0.License) it.next();
+                License license = new License();
+                license.setComments( v3License.getComments() );
+                license.setName( v3License.getName() );
+                license.setUrl( v3License.getUrl() );
+
+                licenses.add( license );
+            }
+        }
+
+        return licenses;
+    }
+
+    private IssueManagement translateIssueManagement( org.apache.maven.model.v3_0_0.Model v3Model )
+    {
+        IssueManagement issueMgmt = null;
+
+        String issueTrackingUrl = v3Model.getIssueTrackingUrl();
+        if ( StringUtils.isNotEmpty( issueTrackingUrl ) )
+        {
+            issueMgmt = new IssueManagement();
+            issueMgmt.setUrl( issueTrackingUrl );
+        }
+
+        return issueMgmt;
+    }
+
+    private DistributionManagement translateDistributionManagement( PomKey pomKey,
+                                                                    org.apache.maven.model.v3_0_0.Model v3Model )
+        throws PomTranslationException
+    {
+        DistributionManagement distributionManagement = new DistributionManagement();
+
+        Site site = null;
+
+        String siteAddress = v3Model.getSiteAddress();
+
+        String siteDirectory = v3Model.getSiteDirectory();
+
+        if ( StringUtils.isEmpty( siteAddress ) )
+        {
+            if ( !StringUtils.isEmpty( siteDirectory ) )
+            {
+                site = new Site();
+
+                site.setId( "default" );
+
+                site.setName( "Default Site" );
+
+                site.setUrl( "file://" + siteDirectory );
+            }
+        }
+        else
+        {
+            if ( StringUtils.isEmpty( siteDirectory ) )
+            {
+                throw new PomTranslationException( pomKey.groupId(), pomKey.artifactId(), pomKey.version(),
+                                                   "Missing 'siteDirectory': Both siteAddress and siteDirectory must be set at the same time." );
+            }
+
+            site = new Site();
+
+            site.setId( "default" );
+
+            site.setName( "Default Site" );
+
+            site.setUrl( "scp://" + siteAddress + "/" + siteDirectory );
+        }
+
+        distributionManagement.setSite( site );
+
+        String distributionSite = v3Model.getDistributionSite();
+
+        String distributionDirectory = v3Model.getDistributionDirectory();
+
+        DeploymentRepository repository = null;
+
+        if ( StringUtils.isEmpty( distributionSite ) )
+        {
+            if ( !StringUtils.isEmpty( distributionDirectory ) )
+            {
+                repository = new DeploymentRepository();
+
+                repository.setId( "default" );
+
+                repository.setName( "Default Repository" );
+
+                repository.setUrl( "file://" + distributionDirectory );
+                //                throw new Exception( "Missing 'distributionSite': Both distributionSite and
+                // distributionDirectory must be set." );
+            }
+        }
+        else
+        {
+            if ( StringUtils.isEmpty( distributionDirectory ) )
+            {
+                throw new PomTranslationException( pomKey.groupId(), pomKey.artifactId(), pomKey.version(),
+                                                   "Missing 'distributionDirectory': must be set is 'distributionSite' is set." );
+            }
+
+            repository = new DeploymentRepository();
+
+            repository.setId( "default" );
+
+            repository.setName( "Default Repository" );
+
+            repository.setUrl( distributionSite + "/" + distributionDirectory );
+        }
+
+        distributionManagement.setRepository( repository );
+
+        distributionManagement.setStatus( "converted" );
+
+        if ( site == null && repository == null )
+        {
+            return null;
+        }
+
+        return distributionManagement;
+    }
+
+    private List translateDevelopers( List v3Developers )
+    {
+        List developers = new ArrayList();
+
+        if ( notEmpty( v3Developers ) )
+        {
+            for ( Iterator it = v3Developers.iterator(); it.hasNext(); )
+            {
+                org.apache.maven.model.v3_0_0.Developer v3Developer = (org.apache.maven.model.v3_0_0.Developer) it
+                    .next();
+
+                Developer developer = new Developer();
+
+                developer.setEmail( v3Developer.getEmail() );
+                developer.setId( v3Developer.getId() );
+                developer.setName( v3Developer.getName() );
+                developer.setOrganization( v3Developer.getOrganization() );
+                developer.setRoles( v3Developer.getRoles() );
+                developer.setTimezone( v3Developer.getTimezone() );
+                developer.setUrl( v3Developer.getUrl() );
+
+                developers.add( developer );
+            }
+        }
+
+        return developers;
+    }
+
+    private List translateDependencies( List v3Deps )
+    {
+        List deps = new ArrayList();
+
+        if ( notEmpty( v3Deps ) )
+        {
+            boolean isJunitPresent = false;
+
+            for ( Iterator it = v3Deps.iterator(); it.hasNext(); )
+            {
+                org.apache.maven.model.v3_0_0.Dependency v3Dep = (org.apache.maven.model.v3_0_0.Dependency) it.next();
+
+                String groupId = format( v3Dep.getGroupId() );
+                String artifactId = format( v3Dep.getArtifactId() );
+
+                String id = v3Dep.getId();
+
+                if ( StringUtils.isNotEmpty( id ) )
+                {
+                    if ( StringUtils.isEmpty( groupId ) )
+                    {
+                        int plusIdx = id.indexOf( "+" );
+
+                        if ( plusIdx > -1 )
+                        {
+                            groupId = id.substring( 0, plusIdx );
+                        }
+                        else
+                        {
+                            groupId = id;
+                        }
+                    }
+
+                    if ( StringUtils.isEmpty( artifactId ) )
+                    {
+                        artifactId = format( id );
+                    }
+                }
+
+                if ( "junit".equals( groupId ) && "junit".equals( artifactId ) )
+                {
+                    isJunitPresent = true;
+                }
+
+                String type = v3Dep.getType();
+                if ( "plugin".equals( type ) )
+                {
+                    if ( "maven".equals( groupId ) )
+                    {
+                        groupId = "org.apache.maven.plugins";
+                    }
+
+                    Plugin plugin = new Plugin();
+                    plugin.setGroupId( groupId );
+                    plugin.setArtifactId( artifactId );
+                    plugin.setVersion( format( v3Dep.getVersion() ) );
+
+                    Xpp3Dom config = new Xpp3Dom( "configuration" );
+
+                    Properties props = v3Dep.getProperties();
+
+                    if ( !props.isEmpty() )
+                    {
+                        for ( Iterator propertyIterator = props.keySet().iterator(); propertyIterator.hasNext(); )
+                        {
+                            String key = (String) propertyIterator.next();
+                            String value = props.getProperty( key );
+
+                            Xpp3Dom child = new Xpp3Dom( key );
+                            child.setValue( value );
+
+                            config.addChild( child );
+                        }
+                    }
+
+                    plugin.setConfiguration( config );
+
+                    this.discoveredPlugins.add( plugin );
+                }
+                else
+                {
+                    Dependency dep = new Dependency();
+
+                    dep.setGroupId( groupId );
+                    dep.setArtifactId( artifactId );
+                    dep.setVersion( v3Dep.getVersion() );
+                    dep.setType( v3Dep.getType() );
+
+                    String scope = v3Dep.getProperty( "scope" );
+                    if ( StringUtils.isNotEmpty( scope ) )
+                    {
+                        dep.setScope( scope );
+                    }
+
+                    String optional = v3Dep.getProperty( "optional" );
+                    if ( StringUtils.isNotEmpty( optional ) )
+                    {
+                        dep.setOptional( Boolean.valueOf( optional ).booleanValue() );
+                    }
+
+                    deps.add( dep );
+                }
+            }
+
+            if ( !isJunitPresent )
+            {
+                Dependency junitDep = new Dependency();
+                junitDep.setGroupId( "junit" );
+                junitDep.setArtifactId( "junit" );
+                junitDep.setVersion( "3.8.2" );
+                junitDep.setScope( "test" );
+                deps.add( junitDep );
+            }
+        }
+
+        return deps;
+    }
+
+    private List translateContributors( List v3Contributors )
+    {
+        List contributors = new ArrayList();
+
+        if ( notEmpty( v3Contributors ) )
+        {
+            for ( Iterator it = v3Contributors.iterator(); it.hasNext(); )
+            {
+                org.apache.maven.model.v3_0_0.Contributor v3Contributor = (org.apache.maven.model.v3_0_0.Contributor) it
+                    .next();
+
+                Contributor contributor = new Contributor();
+
+                contributor.setEmail( v3Contributor.getEmail() );
+                contributor.setName( v3Contributor.getName() );
+                contributor.setOrganization( v3Contributor.getOrganization() );
+                contributor.setRoles( v3Contributor.getRoles() );
+                contributor.setTimezone( v3Contributor.getTimezone() );
+                contributor.setUrl( v3Contributor.getUrl() );
+
+                contributors.add( contributor );
+            }
+        }
+
+        return contributors;
+    }
+
+    private Build translateBuild( org.apache.maven.model.v3_0_0.Build v3Build )
+    {
+        Build build = null;
+        if ( v3Build != null )
+        {
+            build = new Build();
+
+            warnOfUnsupportedBuildElements( v3Build );
+
+            build.setSourceDirectory( v3Build.getSourceDirectory() );
+            build.setTestSourceDirectory( v3Build.getUnitTestSourceDirectory() );
+
+            build.setResources( translateResources( v3Build.getResources() ) );
+
+            UnitTest unitTest = v3Build.getUnitTest();
+            if ( unitTest != null )
+            {
+                build.setTestResources( translateResources( unitTest.getResources() ) );
+
+                List testIncludes = unitTest.getIncludes();
+
+                List testExcludes = new ArrayList( unitTest.getExcludes() );
+
+                if ( notEmpty( testIncludes ) || notEmpty( testExcludes ) )
+                {
+                    Plugin plugin = new Plugin();
+                    plugin.setGroupId( "org.apache.maven.plugins" );
+                    plugin.setArtifactId( "maven-surefire-plugin" );
+
+                    Xpp3Dom config = new Xpp3Dom( "configuration" );
+
+                    if ( notEmpty( testIncludes ) )
+                    {
+                        Xpp3Dom includes = new Xpp3Dom( "includes" );
+                        for ( Iterator it = testIncludes.iterator(); it.hasNext(); )
+                        {
+                            String includePattern = (String) it.next();
+                            Xpp3Dom include = new Xpp3Dom( "include" );
+                            include.setValue( includePattern );
+
+                            includes.addChild( include );
+                        }
+
+                        config.addChild( includes );
+                    }
+
+                    if ( notEmpty( testExcludes ) )
+                    {
+                        Xpp3Dom excludes = new Xpp3Dom( "excludes" );
+                        for ( Iterator it = testExcludes.iterator(); it.hasNext(); )
+                        {
+                            String excludePattern = (String) it.next();
+                            Xpp3Dom exclude = new Xpp3Dom( "exclude" );
+                            exclude.setValue( excludePattern );
+
+                            excludes.addChild( exclude );
+                        }
+
+                        config.addChild( excludes );
+                    }
+
+                    if ( config.getChildCount() > 0 )
+                    {
+                        plugin.setConfiguration( config );
+                    }
+
+                    build.addPlugin( plugin );
+                }
+            }
+        }
+
+        if ( !this.discoveredPlugins.isEmpty() )
+        {
+            if ( build == null )
+            {
+                build = new Build();
+            }
+
+            for ( Iterator it = this.discoveredPlugins.iterator(); it.hasNext(); )
+            {
+                Plugin plugin = (Plugin) it.next();
+
+                build.addPlugin( plugin );
+            }
+        }
+
+        return build;
+    }
+
+    private void warnOfUnsupportedBuildElements( org.apache.maven.model.v3_0_0.Build v3Build )
+    {
+        if ( notEmpty( v3Build.getSourceModifications() ) )
+        {
+            warnings.add( "Ignoring <sourceModifications/> section. It is not supported in v4 POMs." );
+        }
+
+        if ( StringUtils.isNotEmpty( v3Build.getAspectSourceDirectory() ) )
+        {
+            warnings.add( "Ignoring <aspectSourceDirectory/>. It is not supported in v4 POMs." );
+        }
+
+        if ( StringUtils.isNotEmpty( v3Build.getIntegrationUnitTestSourceDirectory() ) )
+        {
+            warnings.add( "Ignoring <integrationUnitTestSourceDirectory/>. It is not supported in v4 POMs." );
+        }
+    }
+
+    private List translateResources( List v3Resources )
+    {
+        List resources = new ArrayList();
+
+        if ( notEmpty( v3Resources ) )
+        {
+            for ( Iterator it = v3Resources.iterator(); it.hasNext(); )
+            {
+                org.apache.maven.model.v3_0_0.Resource v3Resource = (org.apache.maven.model.v3_0_0.Resource) it.next();
+                Resource resource = new Resource();
+
+                if ( v3Resource.getDirectory() == null )
+                {
+                    resource.setDirectory( "." );
+                }
+                else
+                {
+                    resource.setDirectory( v3Resource.getDirectory() );
+                }
+
+                List excludes = new ArrayList( v3Resource.getExcludes() );
+
+                resource.setExcludes( excludes );
+
+                resource.setIncludes( v3Resource.getIncludes() );
+                resource.setTargetPath( v3Resource.getTargetPath() );
+
+                resources.add( resource );
+            }
+        }
+
+        return resources;
+    }
+
+    //    private String pathPatternsToString( List patterns )
+    //    {
+    //        StringBuffer result = new StringBuffer();
+    //
+    //        if ( notEmpty( patterns ) )
+    //        {
+    //            for ( Iterator it = patterns.iterator(); it.hasNext(); )
+    //            {
+    //                String pattern = (String) it.next();
+    //
+    //                result.append( "," ).append( pattern );
+    //            }
+    //
+    //            result.setLength( result.length() - 1 );
+    //        }
+    //
+    //        return result.toString();
+    //    }
+
+    private boolean notEmpty( List test )
+    {
+        return test != null && !test.isEmpty();
+    }
+
+    public void validateV4Basics( Model model, String groupId, String artifactId, String version, String packaging )
+    {
+        if ( StringUtils.isEmpty( model.getModelVersion() ) )
+        {
+            model.setModelVersion( "4.0.0" );
+        }
+
+        if ( StringUtils.isEmpty( model.getGroupId() ) )
+        {
+            warnings.add( "Setting groupId on model using artifact information." );
+            model.setGroupId( groupId );
+        }
+
+        if ( StringUtils.isEmpty( model.getArtifactId() ) )
+        {
+            warnings.add( "Setting artifactId on model using artifact information." );
+            model.setArtifactId( artifactId );
+        }
+
+        if ( StringUtils.isEmpty( model.getVersion() ) )
+        {
+            warnings.add( "Setting version on model using artifact information." );
+            model.setVersion( version );
+        }
+
+        if ( StringUtils.isEmpty( model.getPackaging() ) )
+        {
+            warnings.add( "Setting packaging on model using artifact type information." );
+            model.setPackaging( packaging );
+        }
+    }
+
+    public List getWarnings()
+    {
+        return warnings;
+    }
+
+    private static class PomKey
+    {
+        private final String groupId;
+
+        private final String artifactId;
+
+        private final String version;
+
+        PomKey( String groupId, String artifactId, String version )
+        {
+            this.groupId = groupId;
+            this.artifactId = artifactId;
+            this.version = version;
+        }
+
+        public String groupId()
+        {
+            return groupId;
+        }
+
+        public String artifactId()
+        {
+            return artifactId;
+        }
+
+        public String version()
+        {
+            return version;
+        }
+    }
+
+}
\ No newline at end of file

Propchange: maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/PomV3ToV4Translator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/PomV3ToV4Translator.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/ProjectConverterException.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/ProjectConverterException.java?rev=433654&view=auto
==============================================================================
--- maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/ProjectConverterException.java (added)
+++ maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/ProjectConverterException.java Tue Aug 22 07:56:59 2006
@@ -0,0 +1,19 @@
+package org.apache.maven.model.converter;
+
+/**
+ * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
+ * @version $Id$
+ */
+public class ProjectConverterException
+    extends Exception
+{
+    public ProjectConverterException( String message )
+    {
+        super( message );
+    }
+
+    public ProjectConverterException( String message, Throwable throwable )
+    {
+        super( message, throwable );
+    }
+}

Propchange: maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/ProjectConverterException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/ProjectConverterException.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/V3PomRewriter.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/V3PomRewriter.java?rev=433654&view=auto
==============================================================================
--- maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/V3PomRewriter.java (added)
+++ maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/V3PomRewriter.java Tue Aug 22 07:56:59 2006
@@ -0,0 +1,82 @@
+package org.apache.maven.model.converter;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.maven.model.Model;
+import org.apache.maven.model.v3_0_0.io.xpp3.MavenXpp3Reader;
+import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
+import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.StringUtils;
+
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.util.List;
+
+/**
+ * @author jdcasey
+ * @plexus.component role="org.apache.maven.model.converter.ArtifactPomRewriter" role-hint="v3"
+ */
+public class V3PomRewriter
+    implements ArtifactPomRewriter
+{
+    /**
+     * @plexus.requirement
+     */
+    private ModelConverter translator;
+
+    public void rewrite( Reader from, Writer to, boolean reportOnly, String groupId, String artifactId, String version,
+                         String packaging )
+        throws Exception
+    {
+        Model v4Model;
+
+        if ( from != null )
+        {
+            MavenXpp3Reader v3Reader = new MavenXpp3Reader();
+
+            StringWriter w = new StringWriter();
+            IOUtil.copy( from, w );
+            String content = StringUtils.replace( w.toString(), "${pom.currentVersion}", "${project.version}" );
+
+            org.apache.maven.model.v3_0_0.Model v3Model = v3Reader.read( new StringReader( content ) );
+            v4Model = translator.translate( v3Model );
+        }
+        else
+        {
+            v4Model = new Model();
+        }
+
+        if ( v4Model != null )
+        {
+            translator.validateV4Basics( v4Model, groupId, artifactId, version, packaging );
+
+            if ( !reportOnly )
+            {
+                MavenXpp3Writer v4Writer = new MavenXpp3Writer();
+                v4Writer.write( to, v4Model );
+            }
+        }
+    }
+
+    public List getWarnings()
+    {
+        return translator.getWarnings();
+    }
+
+}
\ No newline at end of file

Propchange: maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/V3PomRewriter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/V3PomRewriter.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/V4PomRewriter.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/V4PomRewriter.java?rev=433654&view=auto
==============================================================================
--- maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/V4PomRewriter.java (added)
+++ maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/V4PomRewriter.java Tue Aug 22 07:56:59 2006
@@ -0,0 +1,72 @@
+package org.apache.maven.model.converter;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.maven.model.Model;
+import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
+import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
+
+import java.io.Reader;
+import java.io.Writer;
+import java.util.List;
+
+/**
+ * @author jdcasey
+ * @plexus.component role="org.apache.maven.model.converter.ArtifactPomRewriter" role-hint="v4"
+ */
+public class V4PomRewriter
+    implements ArtifactPomRewriter
+{
+    /**
+     * @plexus.requirement
+     */
+    private ModelConverter translator;
+
+    public void rewrite( Reader from, Writer to, boolean reportOnly, String groupId, String artifactId, String version,
+                         String packaging )
+        throws Exception
+    {
+        Model model = null;
+
+        if ( from != null )
+        {
+            MavenXpp3Reader reader = new MavenXpp3Reader();
+
+            model = reader.read( from );
+        }
+        else
+        {
+            model = new Model();
+        }
+
+        if ( model != null )
+        {
+            translator.validateV4Basics( model, groupId, artifactId, version, packaging );
+
+            if ( !reportOnly )
+            {
+                MavenXpp3Writer writer = new MavenXpp3Writer();
+                writer.write( to, model );
+            }
+        }
+    }
+
+    public List getWarnings()
+    {
+        return translator.getWarnings();
+    }
+}
\ No newline at end of file

Propchange: maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/V4PomRewriter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/V4PomRewriter.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/AbstractPluginConfigurationConverter.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/AbstractPluginConfigurationConverter.java?rev=433654&view=auto
==============================================================================
--- maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/AbstractPluginConfigurationConverter.java (added)
+++ maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/AbstractPluginConfigurationConverter.java Tue Aug 22 07:56:59 2006
@@ -0,0 +1,143 @@
+package org.apache.maven.model.converter.plugins;
+
+/*
+ * Copyright 2001-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.maven.model.Build;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.model.ReportPlugin;
+import org.apache.maven.model.Reporting;
+import org.apache.maven.model.converter.ModelUtils;
+import org.apache.maven.model.converter.ProjectConverterException;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+
+import java.util.Properties;
+
+/**
+ * @author Fabrizio Giustina
+ * @author Dennis Lundberg
+ * @version $Id$
+ */
+public abstract class AbstractPluginConfigurationConverter implements PluginConfigurationConverter
+{
+    public static final String TYPE_BUILD_PLUGIN = "build plugin";
+    public static final String TYPE_REPORT_PLUGIN = "report plugin";
+
+    public abstract String getArtifactId();
+
+    public String getGroupId()
+    {
+        return "org.apache.maven.plugins";
+    }
+
+    public abstract String getType();
+
+    /**
+     * Add a child element to the configuration.
+     *
+     * @param configuration     The configuration to add the element to
+     * @param projectProperties The M1 properties
+     * @param mavenOneProperty  The name of the Maven 1 property to convert
+     * @param mavenTwoElement   The name of the Maven 2 configuration element
+     */
+    protected void addConfigurationChild( Xpp3Dom configuration, Properties projectProperties, String mavenOneProperty,
+                                          String mavenTwoElement )
+    {
+        String value = projectProperties.getProperty( mavenOneProperty );
+        addConfigurationChild( configuration, mavenTwoElement, value );
+    }
+
+    /**
+     * Add a child element to the configuration.
+     *
+     * @param configuration   The configuration to add the element to
+     * @param mavenTwoElement The name of the Maven 2 configuration element
+     * @param value           Set the value of the element to this
+     */
+    protected void addConfigurationChild( Xpp3Dom configuration, String mavenTwoElement, String value )
+    {
+        if ( value != null )
+        {
+            Xpp3Dom child = new Xpp3Dom( mavenTwoElement );
+            child.setValue( value );
+            configuration.addChild( child );
+        }
+    }
+
+    public void convertConfiguration( Model v4Model, org.apache.maven.model.v3_0_0.Model v3Model,
+                                      Properties projectProperties )
+        throws ProjectConverterException
+    {
+        boolean addPlugin = false;
+
+        Xpp3Dom configuration = new Xpp3Dom( "configuration" );
+
+        buildConfiguration( configuration, v3Model, projectProperties );
+
+        if ( configuration.getChildCount() > 0 )
+        {
+            if ( TYPE_BUILD_PLUGIN.equals( getType() ) )
+            {
+                Plugin plugin = ModelUtils.findBuildPlugin( v4Model, getGroupId(), getArtifactId() );
+                if ( plugin == null )
+                {
+                    addPlugin = true;
+                    plugin = new Plugin();
+                    plugin.setGroupId( getGroupId() );
+                    plugin.setArtifactId( getArtifactId() );
+                }
+
+                plugin.setConfiguration( configuration );
+
+                if ( addPlugin )
+                {
+                    if ( v4Model.getBuild() == null )
+                    {
+                        v4Model.setBuild( new Build() );
+                    }
+                    v4Model.getBuild().addPlugin( plugin );
+                }
+            }
+            else if ( TYPE_REPORT_PLUGIN.equals( getType() ) )
+            {
+                ReportPlugin plugin = ModelUtils.findReportPlugin( v4Model, getGroupId(), getArtifactId() );
+                if ( plugin == null )
+                {
+                    addPlugin = true;
+                    plugin = new ReportPlugin();
+                    plugin.setGroupId( getGroupId() );
+                    plugin.setArtifactId( getArtifactId() );
+                }
+
+                plugin.setConfiguration( configuration );
+
+                if ( addPlugin )
+                {
+                    if ( v4Model.getReporting() == null )
+                    {
+                        v4Model.setReporting( new Reporting() );
+                    }
+                    v4Model.getReporting().addPlugin( plugin );
+                }
+            }
+        }
+    }
+
+    protected abstract void buildConfiguration( Xpp3Dom configuration, org.apache.maven.model.v3_0_0.Model v3Model,
+                                                Properties projectProperties )
+        throws ProjectConverterException;
+}

Propchange: maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/AbstractPluginConfigurationConverter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/shared/trunk/maven-model-converter/src/main/java/org/apache/maven/model/converter/plugins/AbstractPluginConfigurationConverter.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"