本文整理汇总了Java中org.codehaus.plexus.interpolation.EnvarBasedValueSource类的典型用法代码示例。如果您正苦于以下问题:Java EnvarBasedValueSource类的具体用法?Java EnvarBasedValueSource怎么用?Java EnvarBasedValueSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EnvarBasedValueSource类属于org.codehaus.plexus.interpolation包,在下文中一共展示了EnvarBasedValueSource类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: interpolate
import org.codehaus.plexus.interpolation.EnvarBasedValueSource; //导入依赖的package包/类
private void interpolate() throws Exception {
Interpolator interpolator = new StringSearchInterpolator();
interpolator.addValueSource(new MapBasedValueSource(properties));
interpolator.addValueSource(new MapBasedValueSource(System.getProperties()));
interpolator.addValueSource(new EnvarBasedValueSource());
for (Entry<String, String> entry : properties.entrySet()) {
properties.put(entry.getKey(), interpolator.interpolate(entry.getValue()));
}
}
开发者ID:sonatype,项目名称:nexus-public,代码行数:11,代码来源:ConfigurationBuilder.java
示例2: interpolate
import org.codehaus.plexus.interpolation.EnvarBasedValueSource; //导入依赖的package包/类
public String interpolate(final String value, final IgnoreWarnFail onMissingProperty, final Map<String, String> properties)
throws IOException, InterpolationException
{
checkNotNull(value, "value is null");
checkNotNull(properties, "properties is null");
final Interpolator interpolator = new StringSearchInterpolator(PREFIX, POSTFIX);
interpolator.addValueSource(new EnvarBasedValueSource());
interpolator.addValueSource(new PropertiesBasedValueSource(System.getProperties()));
if (model.isPresent()) {
final Model pomModel = model.get();
interpolator.addValueSource(new PrefixedValueSourceWrapper(new ObjectBasedValueSource(pomModel),
SYNONYM_PREFIXES,
true));
interpolator.addValueSource(new PrefixedValueSourceWrapper(new PropertiesBasedValueSource(pomModel.getProperties()),
SYNONYM_PREFIXES,
true));
}
interpolator.addValueSource(new MapBasedValueSource(properties));
final String result = interpolator.interpolate(value, new PrefixAwareRecursionInterceptor(SYNONYM_PREFIXES, true));
final String stripped = result.replaceAll(Pattern.quote(PREFIX) + ".*?" + Pattern.quote(POSTFIX), "");
IgnoreWarnFail.checkState(onMissingProperty, stripped.equals(result), "property");
return stripped;
}
开发者ID:basepom,项目名称:property-helper-maven-plugin,代码行数:29,代码来源:InterpolatorFactory.java
示例3: buildProfiles
import org.codehaus.plexus.interpolation.EnvarBasedValueSource; //导入依赖的package包/类
public ProfilesRoot buildProfiles( File basedir )
throws IOException, XmlPullParserException
{
File profilesXml = new File( basedir, PROFILES_XML_FILE );
ProfilesRoot profilesRoot = null;
if ( profilesXml.exists() )
{
ProfilesXpp3Reader reader = new ProfilesXpp3Reader();
Reader profileReader = null;
try
{
profileReader = ReaderFactory.newXmlReader( profilesXml );
StringWriter sWriter = new StringWriter();
IOUtil.copy( profileReader, sWriter );
String rawInput = sWriter.toString();
try
{
RegexBasedInterpolator interpolator = new RegexBasedInterpolator();
interpolator.addValueSource( new EnvarBasedValueSource() );
rawInput = interpolator.interpolate( rawInput, "settings" );
}
catch ( Exception e )
{
getLogger().warn( "Failed to initialize environment variable resolver. Skipping environment "
+ "substitution in " + PROFILES_XML_FILE + "." );
getLogger().debug( "Failed to initialize envar resolver. Skipping resolution.", e );
}
StringReader sReader = new StringReader( rawInput );
profilesRoot = reader.read( sReader );
}
finally
{
IOUtil.close( profileReader );
}
}
return profilesRoot;
}
开发者ID:gems-uff,项目名称:oceano,代码行数:48,代码来源:DefaultMavenProfilesBuilder.java
注:本文中的org.codehaus.plexus.interpolation.EnvarBasedValueSource类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论