mirror of https://github.com/apache/maven.git
[MNG-4625] Interpolation of settings.xml fails if an expression's value contains XML markup
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@931545 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
fc7636db41
commit
1f9e91da55
|
@ -38,6 +38,7 @@ import org.codehaus.plexus.component.annotations.Component;
|
||||||
import org.codehaus.plexus.component.annotations.Requirement;
|
import org.codehaus.plexus.component.annotations.Requirement;
|
||||||
import org.codehaus.plexus.interpolation.EnvarBasedValueSource;
|
import org.codehaus.plexus.interpolation.EnvarBasedValueSource;
|
||||||
import org.codehaus.plexus.interpolation.InterpolationException;
|
import org.codehaus.plexus.interpolation.InterpolationException;
|
||||||
|
import org.codehaus.plexus.interpolation.InterpolationPostProcessor;
|
||||||
import org.codehaus.plexus.interpolation.PropertiesBasedValueSource;
|
import org.codehaus.plexus.interpolation.PropertiesBasedValueSource;
|
||||||
import org.codehaus.plexus.interpolation.RegexBasedInterpolator;
|
import org.codehaus.plexus.interpolation.RegexBasedInterpolator;
|
||||||
|
|
||||||
|
@ -189,6 +190,20 @@ public class DefaultSettingsBuilder
|
||||||
+ e.getMessage(), -1, -1, e );
|
+ e.getMessage(), -1, -1, e );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interpolator.addPostProcessor( new InterpolationPostProcessor()
|
||||||
|
{
|
||||||
|
public Object execute( String expression, Object value )
|
||||||
|
{
|
||||||
|
if ( value != null )
|
||||||
|
{
|
||||||
|
// we're going to parse this back in as XML so we need to escape XML markup
|
||||||
|
value = value.toString().replace( "&", "&" ).replace( "<", "<" ).replace( ">", ">" );
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
serializedSettings = interpolator.interpolate( serializedSettings, "settings" );
|
serializedSettings = interpolator.interpolate( serializedSettings, "settings" );
|
||||||
|
|
Loading…
Reference in New Issue