}
private MavenJellyContext initialiseHousingPluginContext( JellyScriptHousing housing, MavenJellyContext baseContext )
throws Exception
{
Project project = housing.getProject();
// TODO: I think this should merge into pluginContext, but that seems to break existing jelly as it depends on
// that kind of warped scoping. Fix this in 1.1
MavenUtils.integrateMapInContext( housing.getPluginProperties(), baseContext );
/*
// Instead, we must go through each property and merge from previous plugin contexts, or the original property
// first integrate new ones
MavenUtils.integrateMapInContext( project.getContext().getVariables(), baseContext );
// now integrate properties that have a new value
Properties p = new Properties();
for ( Iterator i = housing.getPluginProperties().keySet().iterator(); i.hasNext(); )
{
String key = (String) i.next();
Object value = project.getContext().getVariable( key );
if ( value != null )
{
baseContext.setVariable( key, value );
}
else
{
p.setProperty( key, (String) housing.getPluginProperties().get( key ) );
}
}
MavenUtils.integrateMapInContext( p, baseContext );
// but leave alone anything in there that is not a plugin property, and already exists in baseContext
*/
// TODO necessary to create a new one every time?
MavenJellyContext pluginContext = new MavenJellyContext( baseContext );
project.pushContext( pluginContext );
pluginContext.setInherit( true );
pluginContext.setVariable( "context", pluginContext );
pluginContext.setVariable( "plugin", project );
pluginContext.setVariable( "plugin.dir", housing.getPluginDirectory() );
pluginContext.setVariable( "plugin.resources", new File( housing.getPluginDirectory(), "plugin-resources" ) );