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


Java Activation.getJdk方法代码示例

本文整理汇总了Java中org.apache.maven.model.Activation.getJdk方法的典型用法代码示例。如果您正苦于以下问题:Java Activation.getJdk方法的具体用法?Java Activation.getJdk怎么用?Java Activation.getJdk使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.maven.model.Activation的用法示例。


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

示例1: writeActivation

import org.apache.maven.model.Activation; //导入方法依赖的package包/类
private void writeActivation(Activation activation, String tagName, XmlSerializer serializer)
        throws java.io.IOException {
    serializer.startTag(NAMESPACE, tagName);
    flush(serializer);
    StringBuffer b = b(serializer);
    int start = b.length();
    if (activation.isActiveByDefault() != false) {
        writeValue(serializer, "activeByDefault", String.valueOf(activation.isActiveByDefault()), activation);
    }
    if (activation.getJdk() != null) {
        writeValue(serializer, "jdk", activation.getJdk(), activation);
    }
    if (activation.getOs() != null) {
        writeActivationOS((ActivationOS) activation.getOs(), "os", serializer);
    }
    if (activation.getProperty() != null) {
        writeActivationProperty((ActivationProperty) activation.getProperty(), "property", serializer);
    }
    if (activation.getFile() != null) {
        writeActivationFile((ActivationFile) activation.getFile(), "file", serializer);
    }
    serializer.endTag(NAMESPACE, tagName).flush();
    logLocation(activation, "", start, b.length());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:LocationAwareMavenXpp3Writer.java

示例2: isActive

import org.apache.maven.model.Activation; //导入方法依赖的package包/类
public boolean isActive( Profile profile )
    throws ProfileActivationException
{
    Activation activation = profile.getActivation();

    String jdk = activation.getJdk();

    // null case is covered by canDetermineActivation(), so we can do a straight startsWith() here.
    if ( jdk.startsWith( "[" ) || jdk.startsWith( "(" ) )
    {
        try
        {
            return matchJdkVersionRange( jdk );
        }
        catch ( InvalidVersionSpecificationException e )
        {
            throw new ProfileActivationException( "Invalid JDK version in profile '" + profile.getId() + "': "
                + e.getMessage() );
        }
    }

    boolean reverse = false;

    if ( jdk.startsWith( "!" ) )
    {
        reverse = true;
        jdk = jdk.substring( 1 );
    }

    if ( getJdkVersion().startsWith( jdk ) )
    {
        return !reverse;
    }
    else
    {
        return reverse;
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:39,代码来源:JdkPrefixProfileActivator.java

示例3: isActive

import org.apache.maven.model.Activation; //导入方法依赖的package包/类
public boolean isActive( Profile profile, ProfileActivationContext context, ModelProblemCollector problems )
{
    Activation activation = profile.getActivation();

    if ( activation == null )
    {
        return false;
    }

    String jdk = activation.getJdk();

    if ( jdk == null )
    {
        return false;
    }

    String version = context.getSystemProperties().get( "java.version" );

    if ( version == null || version.length() <= 0 )
    {
        problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE )
                .setMessage( "Failed to determine Java version for profile " + profile.getId() )
                .setLocation(activation.getLocation( "jdk" ) ) );
        return false;
    }

    if ( jdk.startsWith( "!" ) )
    {
        return !version.startsWith( jdk.substring( 1 ) );
    }
    else if ( isRange( jdk ) )
    {
        return isInRange( version, getRange( jdk ) );
    }
    else
    {
        return version.startsWith( jdk );
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:40,代码来源:JdkVersionProfileActivator.java


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