fr = null;
}
}
// 2)
MavenJellyContext context = MavenUtils.createContextNoDefaults( projectDescriptor.getParentFile(),
parentContext );
// 3)
String pomToExtend = project.getExtend();
if ( pomToExtend != null && useParentPom )
{
// We must look in the <extend/> element for expressions that may be present as
//
// <extend>../project.xml</extend>
Expression e = JellyUtils.decomposeExpression( pomToExtend, context );
pomToExtend = e.evaluateAsString( context );
pomToExtend = MavenUtils.makeAbsolutePath( projectDescriptor.getParentFile(), pomToExtend );
project.setExtend( pomToExtend );
File parentPom = new File( pomToExtend );
parentPom = parentPom.getCanonicalFile();
if ( !parentPom.exists() )
{
throw new FileNotFoundException( "Parent POM not found: " + parentPom );
}
String parentPomPath = parentPom.getPath();
if ( parentPomPath.equals( projectDescriptor.getCanonicalPath() ) )
{
throw new MavenException( "Parent POM is equal to the current POM" );
}
Project parent = (Project) parentPoms.get( parentPomPath );
if ( parent == null )
{
parent = getNonJellyProject( parentPom, parentContext, true );
parent.setFile( parentPom );
parentPoms.put( parentPom.getCanonicalPath(), parent );
context.setParent( parent.getContext() );
}
// Map in the parent context which already has the properties loaded
integrateMapInContext( parent.getContext().getVariables(), context );
project.mergeParent( parent );
}
project.resolveIds();
applyDefaults( context );
// Set the created context, and put the project itself in the context. This
// is how we get the ${pom} reference in the project.xml file to work.
project.setContext( context );
context.setProject( project );
return project;
}