本文整理汇总了Java中org.apache.maven.toolchain.RequirementMatcherFactory类的典型用法代码示例。如果您正苦于以下问题:Java RequirementMatcherFactory类的具体用法?Java RequirementMatcherFactory怎么用?Java RequirementMatcherFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RequirementMatcherFactory类属于org.apache.maven.toolchain包,在下文中一共展示了RequirementMatcherFactory类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createToolchain
import org.apache.maven.toolchain.RequirementMatcherFactory; //导入依赖的package包/类
public ToolchainPrivate createToolchain( final ToolchainModel model )
throws MisconfiguredToolchainException
{
if ( model == null )
return null;
final PathsToolchain pathsToolchain = new PathsToolchain( model, this.logger );
final Properties provides = this.getProvidesProperties( model );
for ( final Map.Entry<Object, Object> provide : provides.entrySet() )
{
final String key = (String) provide.getKey();
final String value = (String) provide.getValue();
if ( value == null )
throw new MisconfiguredToolchainException( "Provides token '" + key
+ "' doesn't have any value configured." );
pathsToolchain.addProvideToken( key, RequirementMatcherFactory.createExactMatcher( value ) );
}
final Xpp3Dom config = (Xpp3Dom) model.getConfiguration();
if ( config == null )
return pathsToolchain;
final Xpp3Dom pathDom = config.getChild( "paths" );
if ( pathDom == null )
return pathsToolchain;
final Xpp3Dom[] pathDoms = pathDom.getChildren( "path" );
if ( pathDoms == null || pathDoms.length == 0 )
return pathsToolchain;
final List<String> paths = new ArrayList<String>( pathDoms.length );
for ( final Xpp3Dom pathdom : pathDoms )
{
final String pathString = pathdom.getValue();
if ( pathString == null )
throw new MisconfiguredToolchainException( "path element is empty" );
final String normalizedPath = FileUtils.normalize( pathString );
final File file = new File( normalizedPath );
if ( !file.exists() )
throw new MisconfiguredToolchainException( "Non-existing path '" + file.getAbsolutePath() + "'" );
paths.add( normalizedPath );
}
pathsToolchain.setPaths( paths );
return pathsToolchain;
}