当前位置: 首页>>代码示例>>Java>>正文


Java RequirementMatcherFactory类代码示例

本文整理汇总了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;
}
 
开发者ID:mojohaus,项目名称:exec-maven-plugin,代码行数:52,代码来源:PathsToolchainFactory.java


注:本文中的org.apache.maven.toolchain.RequirementMatcherFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。