org.apache.maven.settings.Settings.isInteractiveMode()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(13.6k)|赞(0)|评价(0)|浏览(131)

本文整理了Java中org.apache.maven.settings.Settings.isInteractiveMode()方法的一些代码示例,展示了Settings.isInteractiveMode()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Settings.isInteractiveMode()方法的具体详情如下:
包路径:org.apache.maven.settings.Settings
类名称:Settings
方法名:isInteractiveMode

Settings.isInteractiveMode介绍

[英]Get whether Maven should attempt to interact with the user for input.
[中]获取Maven是否应该尝试与用户交互以获取输入。

代码示例

代码示例来源:origin: apache/maven

public Boolean getInteractiveMode()
{
  return Boolean.valueOf( isInteractiveMode() );
}

代码示例来源:origin: apache/maven

if ( settings.isInteractiveMode() != true )
  serializer.startTag( NAMESPACE, "interactiveMode" ).text( String.valueOf( settings.isInteractiveMode() ) ).endTag( NAMESPACE, "interactiveMode" );

代码示例来源:origin: org.apache.maven/maven-settings

public Boolean getInteractiveMode()
{
  return Boolean.valueOf( isInteractiveMode() );
}

代码示例来源:origin: apache/maven

request.setInteractiveMode( settings.isInteractiveMode() );

代码示例来源:origin: apache/maven

/**
   * @param settings could be null
   * @return a new instance of settings or null if settings was null.
   */
  public static Settings copySettings( Settings settings )
  {
    if ( settings == null )
    {
      return null;
    }

    Settings clone = new Settings();
    clone.setActiveProfiles( settings.getActiveProfiles() );
    clone.setInteractiveMode( settings.isInteractiveMode() );
    clone.setLocalRepository( settings.getLocalRepository() );
    clone.setMirrors( settings.getMirrors() );
    clone.setModelEncoding( settings.getModelEncoding() );
    clone.setOffline( settings.isOffline() );
    clone.setPluginGroups( settings.getPluginGroups() );
    clone.setProfiles( settings.getProfiles() );
    clone.setProxies( settings.getProxies() );
    clone.setServers( settings.getServers() );
    clone.setSourceLevel( settings.getSourceLevel() );
    clone.setUsePluginRegistry( settings.isUsePluginRegistry() );

    return clone;
  }
}

代码示例来源:origin: apache/maven

request.setInteractiveMode( settings.isInteractiveMode() );

代码示例来源:origin: org.apache.maven/maven-settings

if ( settings.isInteractiveMode() != true )
  serializer.startTag( NAMESPACE, "interactiveMode" ).text( String.valueOf( settings.isInteractiveMode() ) ).endTag( NAMESPACE, "interactiveMode" );

代码示例来源:origin: com.microsoft.azure/azure-maven-plugin-lib

public static MavenPluginQueryer getQueryer(Settings settings, Log log) {
    return (settings != null && !settings.isInteractiveMode()) ?
      new MavenPluginQueryerBatchModeDefaultImpl(log) :
      new MavenPluginQueryerDefaultImpl(log);
  }
}

代码示例来源:origin: Microsoft/azure-maven-plugins

public static MavenPluginQueryer getQueryer(Settings settings, Log log) {
    return (settings != null && !settings.isInteractiveMode()) ?
      new MavenPluginQueryerBatchModeDefaultImpl(log) :
      new MavenPluginQueryerDefaultImpl(log);
  }
}

代码示例来源:origin: Microsoft/azure-maven-plugins

protected void prepareFunctionName() throws MojoFailureException {
  info("Common parameter [Function Name]: name for both the new function and Java class");
  if (settings != null && !settings.isInteractiveMode()) {
    assureInputInBatchMode(getFunctionName(),
      str -> isNotEmpty(str) && str.matches(FUNCTION_NAME_REGEXP),
      this::setFunctionName,
      true);
  } else {
    assureInputFromUser("Enter value for Function Name: ",
      getFunctionName(),
      str -> isNotEmpty(str) && str.matches(FUNCTION_NAME_REGEXP),
      "Function name must start with a letter and can contain letters, digits, '_' and '-'",
      this::setFunctionName);
  }
}

代码示例来源:origin: com.itemis.maven.plugins/unleash-maven-plugin

@Override
public void execute(ExecutionContext context) throws MojoExecutionException, MojoFailureException {
 this.log.info("Calculating required versions for all modules.");
 for (MavenProject project : this.reactorProjects) {
  this.log.info("\tVersions of module " + ProjectToString.EXCLUDE_VERSION.apply(project) + ":");
  ArtifactCoordinates preReleaseCoordinates = this.metadata
    .getArtifactCoordinatesByPhase(project.getGroupId(), project.getArtifactId()).get(ReleasePhase.PRE_RELEASE);
  this.log.info("\t\t" + ReleasePhase.PRE_RELEASE + " = " + preReleaseCoordinates.getVersion());
  Optional<Prompter> prompterToUse = this.settings.isInteractiveMode() ? Optional.of(this.prompter)
    : Optional.<Prompter> absent();
  String releaseVersion = calculateReleaseVersion(project.getVersion(), prompterToUse);
  ArtifactCoordinates releaseCoordinates = new ArtifactCoordinates(project.getGroupId(), project.getArtifactId(),
    releaseVersion, PomUtil.ARTIFACT_TYPE_POM);
  this.metadata.addArtifactCoordinates(releaseCoordinates, ReleasePhase.RELEASE);
  this.log.info("\t\t" + ReleasePhase.RELEASE + " = " + releaseVersion);
  String nextDevVersion = calculateDevelopmentVersion(project.getVersion(), prompterToUse);
  ArtifactCoordinates postReleaseCoordinates = new ArtifactCoordinates(project.getGroupId(),
    project.getArtifactId(), nextDevVersion, PomUtil.ARTIFACT_TYPE_POM);
  this.metadata.addArtifactCoordinates(postReleaseCoordinates, ReleasePhase.POST_RELEASE);
  this.log.info("\t\t" + ReleasePhase.POST_RELEASE + " = " + nextDevVersion);
 }
}

代码示例来源:origin: shillner/unleash-maven-plugin

@Override
public void execute(ExecutionContext context) throws MojoExecutionException, MojoFailureException {
 this.log.info("Calculating required versions for all modules.");
 for (MavenProject project : this.reactorProjects) {
  this.log.info("\tVersions of module " + ProjectToString.EXCLUDE_VERSION.apply(project) + ":");
  ArtifactCoordinates preReleaseCoordinates = this.metadata
    .getArtifactCoordinatesByPhase(project.getGroupId(), project.getArtifactId()).get(ReleasePhase.PRE_RELEASE);
  this.log.info("\t\t" + ReleasePhase.PRE_RELEASE + " = " + preReleaseCoordinates.getVersion());
  Optional<Prompter> prompterToUse = this.settings.isInteractiveMode() ? Optional.of(this.prompter)
    : Optional.<Prompter> absent();
  String releaseVersion = calculateReleaseVersion(project.getVersion(), prompterToUse);
  ArtifactCoordinates releaseCoordinates = new ArtifactCoordinates(project.getGroupId(), project.getArtifactId(),
    releaseVersion, PomUtil.ARTIFACT_TYPE_POM);
  this.metadata.addArtifactCoordinates(releaseCoordinates, ReleasePhase.RELEASE);
  this.log.info("\t\t" + ReleasePhase.RELEASE + " = " + releaseVersion);
  String nextDevVersion = calculateDevelopmentVersion(project.getVersion(), prompterToUse);
  ArtifactCoordinates postReleaseCoordinates = new ArtifactCoordinates(project.getGroupId(),
    project.getArtifactId(), nextDevVersion, PomUtil.ARTIFACT_TYPE_POM);
  this.metadata.addArtifactCoordinates(postReleaseCoordinates, ReleasePhase.POST_RELEASE);
  this.log.info("\t\t" + ReleasePhase.POST_RELEASE + " = " + nextDevVersion);
 }
}

代码示例来源:origin: Microsoft/azure-maven-plugins

protected void preparePackageName() throws MojoFailureException {
  info("Common parameter [Package Name]: package name of the new Java class");
  if (settings != null && !settings.isInteractiveMode()) {
    assureInputInBatchMode(getFunctionPackageName(),
      str -> isNotEmpty(str) && isName(str),
      this::setFunctionPackageName,
      true);
  } else {
    assureInputFromUser("Enter value for Package Name: ",
      getFunctionPackageName(),
      str -> isNotEmpty(str) && isName(str),
      "Input should be a valid Java package name.",
      this::setFunctionPackageName);
  }
}

代码示例来源:origin: Microsoft/azure-maven-plugins

protected FunctionTemplate getFunctionTemplate(final List<FunctionTemplate> templates) throws Exception {
  info("");
  info(FIND_TEMPLATE);
  if (settings != null && !settings.isInteractiveMode()) {
    assureInputInBatchMode(getFunctionTemplate(),
      str -> getTemplateNames(templates)
        .stream()
        .filter(Objects::nonNull)
        .anyMatch(o -> o.equalsIgnoreCase(str)),
      this::setFunctionTemplate,
      true);
  } else {
    assureInputFromUser("template for new function",
      getFunctionTemplate(),
      getTemplateNames(templates),
      this::setFunctionTemplate);
  }
  return findTemplateByName(templates, getFunctionTemplate());
}

代码示例来源:origin: aleksandr-m/gitflow-maven-plugin

private String getNextSnapshotVersion(String currentVersion) throws MojoFailureException, VersionParseException {
  // get next snapshot version
  final String nextSnapshotVersion;
  if (!settings.isInteractiveMode()
      && StringUtils.isNotBlank(developmentVersion)) {
    nextSnapshotVersion = developmentVersion;
  } else {
    GitFlowVersionInfo versionInfo = new GitFlowVersionInfo(
        currentVersion);
    if (digitsOnlyDevVersion) {
      versionInfo = versionInfo.digitsVersionInfo();
    }
    nextSnapshotVersion = versionInfo
        .nextSnapshotVersion(versionDigitToIncrement);
  }
  if (StringUtils.isBlank(nextSnapshotVersion)) {
    throw new MojoFailureException(
        "Next snapshot version is blank.");
  }
  return nextSnapshotVersion;
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-maven-embedder

/**
 * Method updateSettings.
 * 
 * @param value
 * @param element
 * @param counter
 * @param xmlTag
 */
protected void updateSettings(Settings value, String xmlTag, Counter counter, Element element)
{
  Element root = element;
  Counter innerCount = new Counter(counter.getDepth() + 1);
  findAndReplaceSimpleElement(innerCount, root,  "localRepository", value.getLocalRepository(), null);
  findAndReplaceSimpleElement(innerCount, root,  "interactiveMode", value.isInteractiveMode() == true ? null : String.valueOf( value.isInteractiveMode() ), "true");
  findAndReplaceSimpleElement(innerCount, root,  "usePluginRegistry", value.isUsePluginRegistry() == false ? null : String.valueOf( value.isUsePluginRegistry() ), "false");
  findAndReplaceSimpleElement(innerCount, root,  "offline", value.isOffline() == false ? null : String.valueOf( value.isOffline() ), "false");
  iterateProxy(innerCount, root, value.getProxies(),"proxies","proxy");
  iterateServer(innerCount, root, value.getServers(),"servers","server");
  iterateMirror(innerCount, root, value.getMirrors(),"mirrors","mirror");
  iterateProfile(innerCount, root, value.getProfiles(),"profiles","profile");
  findAndReplaceSimpleLists(innerCount, root, value.getActiveProfiles(), "activeProfiles", "activeProfile");
  findAndReplaceSimpleLists(innerCount, root, value.getPluginGroups(), "pluginGroups", "pluginGroup");
} //-- void updateSettings(Settings, String, Counter, Element)

代码示例来源:origin: org.codehaus.mevenide/nb-mvn-embedder

/**
 * Method updateSettings
 * 
 * @param value
 * @param element
 * @param counter
 * @param xmlTag
 */
protected void updateSettings(Settings value, String xmlTag, Counter counter, Element element)
{
  Element root = element;
  Counter innerCount = new Counter(counter.getDepth() + 1);
  findAndReplaceSimpleElement(innerCount, root,  "localRepository", value.getLocalRepository(), null);
  findAndReplaceSimpleElement(innerCount, root,  "interactiveMode", value.isInteractiveMode() == true ? null : String.valueOf( value.isInteractiveMode() ), "true");
  findAndReplaceSimpleElement(innerCount, root,  "usePluginRegistry", value.isUsePluginRegistry() == false ? null : String.valueOf( value.isUsePluginRegistry() ), "false");
  findAndReplaceSimpleElement(innerCount, root,  "offline", value.isOffline() == false ? null : String.valueOf( value.isOffline() ), "false");
  iterateProxy(innerCount, root, value.getProxies(),"proxies","proxy");
  iterateServer(innerCount, root, value.getServers(),"servers","server");
  iterateMirror(innerCount, root, value.getMirrors(),"mirrors","mirror");
  iterateProfile(innerCount, root, value.getProfiles(),"profiles","profile");
  findAndReplaceSimpleLists(innerCount, root, value.getActiveProfiles(), "activeProfiles", "activeProfile");
  findAndReplaceSimpleLists(innerCount, root, value.getPluginGroups(), "pluginGroups", "pluginGroup");
} //-- void updateSettings(Settings, String, Counter, Element)

代码示例来源:origin: com.atlassian.maven.plugins/maven-jgitflow-plugin

@Override
  public void execute() throws MojoExecutionException, MojoFailureException
  {
    ReleaseContext ctx = new ReleaseContext(getBasedir());
    ctx.setInteractive(getSettings().isInteractiveMode())
        .setNoDeploy(false)
        .setEnableFeatureVersions(true)
        .setFlowInitContext(getFlowInitContext().getJGitFlowContext());

    try
    {
      releaseManager.deploy(ctx, getReactorProjects(), session, buildNumber, goals);
    }
    catch (JGitFlowReleaseException e)
    {
      throw new MojoExecutionException("Error finishing feature: " + e.getMessage(),e);
    }
  }
}

代码示例来源:origin: com.atlassian.maven.plugins/maven-jgitflow-plugin

@Override
  public void execute() throws MojoExecutionException, MojoFailureException
  {
    ReleaseContext ctx = new ReleaseContext(getBasedir());
    ctx.setInteractive(getSettings().isInteractiveMode())
        .setDefaultFeatureName(featureName)
        .setEnableFeatureVersions(enableFeatureVersions)
        .setEnableSshAgent(enableSshAgent)
        .setAllowUntracked(allowUntracked)
        .setPushFeatures(pushFeatures)
        .setStartCommit(startCommit)
        .setAllowRemote(isRemoteAllowed())
        .setDefaultOriginUrl(defaultOriginUrl)
        .setScmCommentPrefix(scmCommentPrefix)
        .setFlowInitContext(getFlowInitContext().getJGitFlowContext());

    try
    {
      releaseManager.start(ctx,getReactorProjects(),session);
    }
    catch (JGitFlowReleaseException e)
    {
      throw new MojoExecutionException("Error starting feature: " + e.getMessage(),e);
    }
  }
}

代码示例来源:origin: com.atlassian.maven.plugins/maven-jgitflow-plugin

@Override
  public void execute() throws MojoExecutionException, MojoFailureException
  {
    ReleaseContext ctx = new ReleaseContext(getBasedir());
    ctx.setAutoVersionSubmodules(autoVersionSubmodules)
      .setInteractive(getSettings().isInteractiveMode())
      .setDefaultReleaseVersion(releaseVersion)
      .setAllowSnapshots(allowSnapshots)
      .setUpdateDependencies(updateDependencies)
      .setEnableSshAgent(enableSshAgent)
      .setAllowUntracked(allowUntracked)
      .setPushHotfixes(pushHotfixes)
      .setStartCommit(startCommit)
      .setAllowRemote(isRemoteAllowed())
      .setDefaultOriginUrl(defaultOriginUrl)
      .setScmCommentPrefix(scmCommentPrefix)
      .setFlowInitContext(getFlowInitContext().getJGitFlowContext());

    try
    {
      releaseManager.start(ctx,getReactorProjects(),session);
    }
    catch (JGitFlowReleaseException e)
    {
      throw new MojoExecutionException("Error starting hotfix: " + e.getMessage(),e);
    }
  }
}

相关文章