package org.apache.maven.lifecycle.statemgmt;

import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.project.MavenProject;

/**
 * Setup a new project instance for the forked executions to use.
 *
 * @author jdcasey
 *
 */
public class StartForkedExecutionMojo
    extends AbstractMojo
{

    private MavenProject project;

    private MavenSession session;

    private int forkId = -1;

    public void execute()
        throws MojoExecutionException, MojoFailureException
    {
        getLog().info( "Starting forked execution [fork id: " + forkId + "]" );

        if ( project != null )
        {
            session.addForkedProject( (MavenProject) project.clone() );
        }
    }

}

@@ -763,24 +763,58 @@
 )%0A        %7B%0A
+            try%0A            %7B%0A    
             
@@ -873,16 +873,275 @@
 ne() );%0A
+            %7D%0A            catch ( CloneNotSupportedException e )%0A            %7B%0A                throw new IllegalStateException( %22MavenProject instance of class %22 + project.getClass().getName() +%0A                    %22 does not support clone %22 );%0A            %7D%0A
         

Implement clone properly following Effective Java' book considerations