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


Java InterpolationException类代码示例

本文整理汇总了Java中org.codehaus.plexus.interpolation.InterpolationException的典型用法代码示例。如果您正苦于以下问题:Java InterpolationException类的具体用法?Java InterpolationException怎么用?Java InterpolationException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


InterpolationException类属于org.codehaus.plexus.interpolation包,在下文中一共展示了InterpolationException类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getArtifactFinalName

import org.codehaus.plexus.interpolation.InterpolationException; //导入依赖的package包/类
/**
 * Returns the final name of the specified artifact.
 * <p/>
 * If the <tt>outputFileNameMapping</tt> is set, it is used, otherwise the standard naming scheme is used.
 *
 * @param context the packaging context
 * @param artifact the artifact
 * @return the converted filename of the artifact
 * @throws InterpolationException in case of interpolation problem.
 */
protected String getArtifactFinalName( WarPackagingContext context, Artifact artifact )
    throws InterpolationException
{
    if ( context.getOutputFileNameMapping() != null )
    {
        return MappingUtils.evaluateFileNameMapping( context.getOutputFileNameMapping(), artifact );
    }

    String classifier = artifact.getClassifier();
    if ( ( classifier != null ) && !( "".equals( classifier.trim() ) ) )
    {
        return MappingUtils.evaluateFileNameMapping( MappingUtils.DEFAULT_FILE_NAME_MAPPING_CLASSIFIER, artifact );
    }
    else
    {
        return MappingUtils.evaluateFileNameMapping( MappingUtils.DEFAULT_FILE_NAME_MAPPING, artifact );
    }

}
 
开发者ID:zhegexiaohuozi,项目名称:maven-seimicrawler-plugin,代码行数:30,代码来源:AbstractWarPackagingTask.java

示例2: findDuplicates

import org.codehaus.plexus.interpolation.InterpolationException; //导入依赖的package包/类
/**
 * Searches a set of artifacts for duplicate filenames and returns a list of duplicates.
 *
 * @param context the packaging context
 * @param artifacts set of artifacts
 * @return List of duplicated artifacts as bundling file names
 */
private List<String> findDuplicates( WarPackagingContext context, Set<Artifact> artifacts )
    throws InterpolationException
{
    List<String> duplicates = new ArrayList<String>();
    List<String> identifiers = new ArrayList<String>();
    for ( Artifact artifact : artifacts )
    {
        String candidate = getArtifactFinalName( context, artifact );
        if ( identifiers.contains( candidate ) )
        {
            duplicates.add( candidate );
        }
        else
        {
            identifiers.add( candidate );
        }
    }
    return duplicates;
}
 
开发者ID:zhegexiaohuozi,项目名称:maven-seimicrawler-plugin,代码行数:27,代码来源:ArtifactsPackagingTask.java

示例3: createProperties

import org.codehaus.plexus.interpolation.InterpolationException; //导入依赖的package包/类
public static List<PropertyElement> createProperties(final Model model, final Map<String, String> values, final PropertyGroup propertyGroup)
    throws IOException, InterpolationException
{
    checkNotNull(model, "model is null");
    checkNotNull(values, "values is null");
    checkNotNull(propertyGroup, "propertyGroup is null");

    final InterpolatorFactory interpolatorFactory = new InterpolatorFactory(Optional.of(model));

    final ImmutableList.Builder<PropertyElement> result = ImmutableList.builder();
    final Map<String, String> properties = propertyGroup.getProperties();

    for (String name : properties.keySet()) {
        final String value = propertyGroup.getPropertyValue(interpolatorFactory, name, values);
        result.add(new PropertyField(name, value));
    }
    return result.build();
}
 
开发者ID:basepom,项目名称:property-helper-maven-plugin,代码行数:19,代码来源:PropertyField.java

示例4: generateJarArchive

import org.codehaus.plexus.interpolation.InterpolationException; //导入依赖的package包/类
/**
 * @param context The warPackingContext.
 * @throws MojoExecutionException In casae of an error.
 */
protected void generateJarArchive( WarPackagingContext context )
    throws MojoExecutionException
{
    MavenProject project = context.getProject();
    ArtifactFactory factory = context.getArtifactFactory();
    Artifact artifact =
        factory.createBuildArtifact( project.getGroupId(), project.getArtifactId(), project.getVersion(), "jar" );
    String archiveName;
    try
    {
        archiveName = getArtifactFinalName( context, artifact );
    }
    catch ( InterpolationException e )
    {
        throw new MojoExecutionException( "Could not get the final name of the artifact [" + artifact.getGroupId()
            + ":" + artifact.getArtifactId() + ":" + artifact.getVersion() + "]", e );
    }
    final String targetFilename = LIB_PATH + archiveName;

    if ( context.getWebappStructure().registerFile( currentProjectOverlay.getId(), targetFilename ) )
    {
        final File libDirectory = new File( context.getWebappDirectory(), LIB_PATH );
        final File jarFile = new File( libDirectory, archiveName );
        final ClassesPackager packager = new ClassesPackager();
        packager.packageClasses( context.getClassesDirectory(), jarFile, context.getJarArchiver(),
                                 context.getSession(), project, context.getArchive() );
    }
    else
    {
        context.getLog().warn( "Could not generate archive classes file [" + targetFilename
                                   + "] has already been copied." );
    }
}
 
开发者ID:zhegexiaohuozi,项目名称:maven-seimicrawler-plugin,代码行数:38,代码来源:ClassesPackagingTask.java

示例5: interpolate

import org.codehaus.plexus.interpolation.InterpolationException; //导入依赖的package包/类
private static String interpolate(Interpolator interpolator, String value) {
	try {
		return interpolator.interpolate(value);
	}
	catch (InterpolationException ex) {
		return value;
	}
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:9,代码来源:RepositoryConfigurationFactory.java

示例6: create

import org.codehaus.plexus.interpolation.InterpolationException; //导入依赖的package包/类
/**
 * Used by GenericDaemonGenerator.
 */
public static Dependency create( Artifact artifact, ArtifactRepositoryLayout layout, String outputFileNameMapping )
{
    Dependency dependency = new Dependency();
    dependency.setGroupId( artifact.getGroupId() );
    dependency.setArtifactId( artifact.getArtifactId() );
    dependency.setVersion( artifact.getVersion() );
    dependency.setClassifier( artifact.getClassifier() );

    String path = layout.pathOf( artifact );
    if ( StringUtils.isNotEmpty( outputFileNameMapping ) )
    {
        // Replace the file name part of the path with one that has been mapped
        File directory = new File( path ).getParentFile();

        try
        {
            String fileName = MappingUtils.evaluateFileNameMapping( outputFileNameMapping, artifact );
            File file = new File( directory, fileName );
            // Always use forward slash as path separator, because that's what layout.pathOf( artifact ) uses
            path = file.getPath().replace( '\\', '/' );
        }
        catch ( InterpolationException e )
        {
            // TODO Handle exceptions!
            // throw new MojoExecutionException("Unable to map file name.", e);
        }
    }
    dependency.setRelativePath( path );

    return dependency;
}
 
开发者ID:mojohaus,项目名称:appassembler,代码行数:35,代码来源:DependencyFactory.java

示例7: getPropertyValue

import org.codehaus.plexus.interpolation.InterpolationException; //导入依赖的package包/类
public String getPropertyValue(final InterpolatorFactory interpolatorFactory, final String propertyName, final Map<String, String> propElements) throws IOException, InterpolationException
{
    final Map<String, PropertyDefinition> propertyMap = Maps.uniqueIndex(Arrays.asList(properties), getNameFunction());

    if (!propertyMap.keySet().contains(propertyName)) {
        return "";
    }

    final PropertyDefinition propertyDefinition = propertyMap.get(propertyName);

    final String result = interpolatorFactory.interpolate(propertyDefinition.getValue(), getOnMissingProperty(), propElements);
    return TransformerRegistry.applyTransformers(propertyDefinition.getTransformers(), result);
}
 
开发者ID:basepom,项目名称:property-helper-maven-plugin,代码行数:14,代码来源:PropertyGroup.java

示例8: interpolate

import org.codehaus.plexus.interpolation.InterpolationException; //导入依赖的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

示例9: interp

import org.codehaus.plexus.interpolation.InterpolationException; //导入依赖的package包/类
public String interp( String value ) throws ManipulationException
{
    try
    {
        return interp.interpolate( value, ri );
    }
    catch ( final InterpolationException e )
    {
        throw new ManipulationException( "Failed to interpolate: %s. Reason: %s", e, value, e.getMessage() );
    }
}
 
开发者ID:release-engineering,项目名称:pom-manipulation-ext,代码行数:12,代码来源:PropertyInterpolator.java

示例10: computePath

import org.codehaus.plexus.interpolation.InterpolationException; //导入依赖的package包/类
private static Path computePath(Artifact artifact, ManifestConfiguration config) throws MojoExecutionException {
  String layoutType = config.getClasspathLayoutType();
  String layout = config.getCustomClasspathLayout();

  Interpolator interpolator = new StringSearchInterpolator();

  List<ValueSource> valueSources = new ArrayList<>();

  valueSources.add(new PrefixedObjectValueSource(ARTIFACT_EXPRESSION_PREFIXES, artifact, true));
  valueSources.add(new PrefixedObjectValueSource(ARTIFACT_EXPRESSION_PREFIXES, artifact.getArtifactHandler(), true));

  Properties extraExpressions = new Properties();
  if (!artifact.isSnapshot()) {
    extraExpressions.setProperty("baseVersion", artifact.getVersion());
  }

  extraExpressions.setProperty("groupIdPath", artifact.getGroupId().replace('.', '/'));
  if (artifact.hasClassifier()) {
    extraExpressions.setProperty("dashClassifier", "-" + artifact.getClassifier());
    extraExpressions.setProperty("dashClassifier?", "-" + artifact.getClassifier());
  } else {
    extraExpressions.setProperty("dashClassifier", "");
    extraExpressions.setProperty("dashClassifier?", "");
  }
  valueSources.add(new PrefixedPropertiesValueSource(ARTIFACT_EXPRESSION_PREFIXES, extraExpressions, true));

  for (ValueSource vs : valueSources) {
    interpolator.addValueSource(vs);
  }

  RecursionInterceptor recursionInterceptor = new PrefixAwareRecursionInterceptor(ARTIFACT_EXPRESSION_PREFIXES);

  try {
    boolean useUniqueVersionsLayout = config.isUseUniqueVersions();

    final String resolvedLayout;
    switch (layoutType) {
      case ManifestConfiguration.CLASSPATH_LAYOUT_TYPE_SIMPLE:
        resolvedLayout = useUniqueVersionsLayout ? SIMPLE_LAYOUT : SIMPLE_LAYOUT_NONUNIQUE;
        break;
      case ManifestConfiguration.CLASSPATH_LAYOUT_TYPE_REPOSITORY:
        resolvedLayout = useUniqueVersionsLayout ? REPOSITORY_LAYOUT : REPOSITORY_LAYOUT_NONUNIQUE;
        break;
      case ManifestConfiguration.CLASSPATH_LAYOUT_TYPE_CUSTOM:
        resolvedLayout = layout;
        break;
      default:
        throw new MojoExecutionException("Unknown classpath layout type: " + layoutType);
    }

    return Paths.get(interpolator.interpolate(resolvedLayout, recursionInterceptor));
  } catch (InterpolationException e) {
    throw new MojoExecutionException("Error computing path for classpath entry", e);
  }
}
 
开发者ID:HubSpot,项目名称:SlimFast,代码行数:56,代码来源:ArtifactHelper.java


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