// -----------------------------------------------
// merge settings file
// -----------------------------------------------
SettingsXpp3Writer settingsWriter = new SettingsXpp3Writer();
File mergedSettingsFile;
Settings mergedSettings = this.settings;
if ( mergeUserSettings )
{
if ( interpolatedSettingsFile != null )
{
// Have to merge the specified settings file (dominant) and the one of the invoking Maven process
try
{
Settings dominantSettings = settingsBuilder.buildSettings( interpolatedSettingsFile, false );
Settings recessiveSettings = cloneSettings();
SettingsUtils.merge( dominantSettings, recessiveSettings, TrackableBase.USER_LEVEL );
mergedSettings = dominantSettings;
getLog().debug( "Merged specified settings file with settings of invoking process" );
}
catch ( XmlPullParserException e )
{
throw new MojoExecutionException( "Could not read specified settings file", e );
}
catch ( IOException e )
{
throw new MojoExecutionException( "Could not read specified settings file", e );
}
}
}
if ( this.settingsFile != null && !mergeUserSettings )
{
mergedSettingsFile = interpolatedSettingsFile;
}
else
{
try
{
mergedSettingsFile = File.createTempFile( "invoker-settings", ".xml" );
FileWriter fileWriter = null;
try
{
fileWriter = new FileWriter( mergedSettingsFile );
settingsWriter.write( fileWriter, mergedSettings );
}
finally
{
IOUtil.close( fileWriter );
}