Allowing project-less builds...removing requiresProject.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@576603 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2007-09-17 22:05:54 +00:00
parent f3df0eb871
commit 21f1be77ff
4 changed files with 31 additions and 22 deletions

View File

@ -7,24 +7,27 @@ import org.apache.maven.project.MavenProject;
/**
* Remove the execution-project used during the fork, now that the forking mojo is finished executing.
*
*
* @author jdcasey
*
*/
public class ClearForkedContextMojo
extends AbstractMojo
{
private MavenProject project;
private int forkId = -1;
public void execute()
throws MojoExecutionException, MojoFailureException
{
getLog().info( "Cleaning up forked execution context [fork id: " + forkId + "]" );
project.clearExecutionProject();
if ( project != null )
{
project.clearExecutionProject();
}
}
}

View File

@ -10,14 +10,14 @@ import org.apache.maven.project.MavenProject;
/**
* Restore the lifecycle execution context's current-project, and set the project instance from the
* forked execution to project.getExecutionProject() for the forking mojo to use.
*
*
* @author jdcasey
*
*/
public class EndForkedExecutionMojo
extends AbstractMojo
{
private int forkId = -1;
private BuildContextManager buildContextManager;
@ -26,13 +26,16 @@ public class EndForkedExecutionMojo
throws MojoExecutionException, MojoFailureException
{
getLog().info( "Ending forked execution [fork id: " + forkId + "]" );
LifecycleExecutionContext ctx = LifecycleExecutionContext.read( buildContextManager );
MavenProject executionProject = ctx.removeForkedProject();
MavenProject project = ctx.getCurrentProject();
project.setExecutionProject( executionProject );
if ( ( project != null ) && ( executionProject != null ) )
{
project.setExecutionProject( executionProject );
}
ctx.store( buildContextManager );
}

View File

@ -9,27 +9,30 @@ 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 int forkId = -1;
private BuildContextManager buildContextManager;
public void execute()
throws MojoExecutionException, MojoFailureException
{
getLog().info( "Starting forked execution [fork id: " + forkId + "]" );
LifecycleExecutionContext ctx = LifecycleExecutionContext.read( buildContextManager );
ctx.addForkedProject( new MavenProject( project ) );
if ( project != null )
{
ctx.addForkedProject( new MavenProject( project ) );
}
ctx.store( buildContextManager );
}

View File

@ -11,7 +11,7 @@
<goal>start-fork</goal>
<description>Setup the appropriate build state to initiate a forked execution.</description>
<requiresDirectInvocation>false</requiresDirectInvocation>
<requiresProject>true</requiresProject>
<requiresProject>false</requiresProject>
<requiresReports>false</requiresReports>
<aggregator>false</aggregator>
<requiresOnline>false</requiresOnline>
@ -51,7 +51,7 @@
<goal>end-fork</goal>
<description>Restore the non-fork currentProject instance, for use in the forking mojo.</description>
<requiresDirectInvocation>false</requiresDirectInvocation>
<requiresProject>true</requiresProject>
<requiresProject>false</requiresProject>
<requiresReports>false</requiresReports>
<aggregator>false</aggregator>
<requiresOnline>false</requiresOnline>
@ -83,7 +83,7 @@
<goal>clear-fork-context</goal>
<description>Tear down any build state used during the previous forked execution.</description>
<requiresDirectInvocation>false</requiresDirectInvocation>
<requiresProject>true</requiresProject>
<requiresProject>false</requiresProject>
<requiresReports>false</requiresReports>
<aggregator>false</aggregator>
<requiresOnline>false</requiresOnline>
@ -117,7 +117,7 @@
<goal>resolve-late-bound-plugin</goal>
<description>Resolve a late-bound plugin during a build, right before it is to be used.</description>
<requiresDirectInvocation>false</requiresDirectInvocation>
<requiresProject>true</requiresProject>
<requiresProject>false</requiresProject>
<requiresReports>false</requiresReports>
<aggregator>false</aggregator>
<requiresOnline>false</requiresOnline>