org.codehaus.plexus.logging.Logger.warn()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(8.1k)|赞(0)|评价(0)|浏览(185)

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

Logger.warn介绍

暂无

代码示例

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

public void warn( Throwable error )
{
  logger.warn( "", error );
}

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

public void warn( Throwable error )
{
  logger.warn( "", error );
}

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

private void cleanupTemporaryFiles( List<File> files )
{
  for ( File file : files )
  {
    // really don't care if it failed here only log warning
    if ( !file.delete() )
    {
      logger.warn( "skip failed to delete temporary file : " + file.getAbsolutePath() );
      file.deleteOnExit();
    }
  }
}

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

private void logError( String action, Throwable e, EventSpy spy )
{
  String msg = "Failed to " + action + " spy " + spy.getClass().getName() + ": " + e.getMessage();
  if ( logger.isDebugEnabled() )
  {
    logger.warn( msg, e );
  }
  else
  {
    logger.warn( msg );
  }
}

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

public void warn( CharSequence content )
{
  logger.warn( toString( content ) );
}

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

public void warn( CharSequence content, Throwable error )
{
  logger.warn( toString( content ), error );
}

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

@Override
public void artifactDescriptorMissing( RepositoryEvent event )
{
  logger.warn( "The POM for " + event.getArtifact() + " is missing, no dependency information available" );
}

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

public void warn( CharSequence content, Throwable error )
{
  logger.warn( toString( content ), error );
}

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

public void warn( CharSequence content )
{
  logger.warn( toString( content ) );
}

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

private void handleChecksumFailure( String checksumPolicy, String message, Throwable cause )
  throws ChecksumFailedException
{
  if ( ArtifactRepositoryPolicy.CHECKSUM_POLICY_FAIL.equals( checksumPolicy ) )
  {
    throw new ChecksumFailedException( message, cause );
  }
  else if ( !ArtifactRepositoryPolicy.CHECKSUM_POLICY_IGNORE.equals( checksumPolicy ) )
  {
    // warn if it is set to anything other than ignore
    logger.warn( "*** CHECKSUM FAILED - " + message + " - IGNORING" );
  }
  // otherwise it is ignore
}

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

private void validateActivatedProfiles( List<MavenProject> projects, List<String> activeProfileIds )
{
  Collection<String> notActivatedProfileIds = new LinkedHashSet<>( activeProfileIds );
  for ( MavenProject project : projects )
  {
    for ( List<String> profileIds : project.getInjectedProfileIds().values() )
    {
      notActivatedProfileIds.removeAll( profileIds );
    }
  }
  for ( String notActivatedProfileId : notActivatedProfileIds )
  {
    logger.warn( "The requested profile \"" + notActivatedProfileId
      + "\" could not be activated because it does not exist." );
  }
}

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

@Override
public void artifactDescriptorInvalid( RepositoryEvent event )
{
  StringBuilder buffer = new StringBuilder( 256 );
  buffer.append( "The POM for " );
  buffer.append( event.getArtifact() );
  buffer.append( " is invalid, transitive dependencies (if any) will not be available" );
  if ( logger.isDebugEnabled() )
  {
    logger.warn( buffer + ": " + event.getException().getMessage() );
  }
  else
  {
    logger.warn( buffer + ", enable debug logging for more details" );
  }
}

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

@Override
public void metadataResolved( RepositoryEvent event )
{
  Exception e = event.getException();
  if ( e != null )
  {
    if ( e instanceof MetadataNotFoundException )
    {
      logger.debug( e.getMessage() );
    }
    else if ( logger.isDebugEnabled() )
    {
      logger.warn( e.getMessage(), e );
    }
    else
    {
      logger.warn( e.getMessage() );
    }
  }
}

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

public void updateScopeCurrentPom( Artifact artifact, String ignoredScope )
{
  logger.debug( indent + artifact + " (not setting artifactScope to: " + ignoredScope + "; local artifactScope "
    + artifact.getScope() + " wins)" );
  // TODO better way than static? this might hide messages in a reactor
  if ( !ignoredArtifacts.contains( artifact ) )
  {
    logger.warn( "\n\tArtifact " + artifact + " retains local artifactScope '" + artifact.getScope()
      + "' overriding broader artifactScope '" + ignoredScope + "'\n"
      + "\tgiven by a dependency. If this is not intended, modify or remove the local artifactScope.\n" );
    ignoredArtifacts.add( artifact );
  }
}

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

private void logMissingSiblingProjectArtifact( Artifact artifact )
{
  if ( logger == null || !logger.isDebugEnabled() )
  {
    return;
  }
  
  if ( logger.isDebugEnabled() )
  {
    StringBuffer message = new StringBuffer();
    message.append( "WARNING: A dependency of the current project (or of one the plugins used in its build) was found in the reactor, " );
    message.append( "\nbut had not been built at the time it was requested. It will be resolved from the repository instead." );
    message.append( "\n\nCurrent Project: " ).append( getName() );
    message.append( "\nRequested Dependency: " ).append( artifact.getId() );
    message.append( "\n\nNOTE: You may need to run this build to the 'compile' lifecycle phase, or farther, in order to build the dependency artifact." );
    message.append( "\n" );
    
    logger.debug( message.toString() );
  }
  else
  {
    logger.warn( "Requested project artifact: " + artifact.getId() + " is not available at this time. Resolving externally." );
  }
}

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

private void validatePrerequisitesForNonMavenPluginProjects( List<MavenProject> projects )
{
  for ( MavenProject mavenProject : projects )
  {
    if ( !"maven-plugin".equals( mavenProject.getPackaging() ) )
    {
      Prerequisites prerequisites = mavenProject.getPrerequisites();
      if ( prerequisites != null && prerequisites.getMaven() != null )
      {
        logger.warn( "The project " + mavenProject.getId() + " uses prerequisites"
          + " which is only intended for maven-plugin projects "
          + "but not for non maven-plugin projects. "
          + "For such purposes you should use the maven-enforcer-plugin. "
          + "See https://maven.apache.org/enforcer/enforcer-rules/requireMavenVersion.html" );
      }
    }
  }
}

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

public void addProfile( Profile profile )
{
  String profileId = profile.getId();
  Profile existing = profilesById.get( profileId );
  if ( existing != null )
  {
    logger.warn( "Overriding profile: \'" + profileId + "\' (source: " + existing.getSource()
      + ") with new instance from source: " + profile.getSource() );
  }
  profilesById.put( profile.getId(), profile );
  Activation activation = profile.getActivation();
  if ( activation != null && activation.isActiveByDefault() )
  {
    activateAsDefault( profileId );
  }
}

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

public void addProfile( Profile profile )
{
  String profileId = profile.getId();
  Profile existing = (Profile) profilesById.get( profileId );
  if ( existing != null )
  {
    container.getLogger().warn( "Overriding profile: \'" + profileId + "\' (source: " + existing.getSource() +
      ") with new instance from source: " + profile.getSource() );
  }
  profilesById.put( profile.getId(), profile );
  Activation activation = profile.getActivation();
  if ( activation != null && activation.isActiveByDefault() )
  {
    activateAsDefault( profileId );
  }
}

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

public void checkRequiredMavenVersion( PluginDescriptor pluginDescriptor )
  throws PluginIncompatibleException
{
  String requiredMavenVersion = pluginDescriptor.getRequiredMavenVersion();
  if ( StringUtils.isNotBlank( requiredMavenVersion ) )
  {
    try
    {
      if ( !runtimeInformation.isMavenVersion( requiredMavenVersion ) )
      {
        throw new PluginIncompatibleException( pluginDescriptor.getPlugin(),
                            "The plugin " + pluginDescriptor.getId()
                              + " requires Maven version " + requiredMavenVersion );
      }
    }
    catch ( RuntimeException e )
    {
      logger.warn( "Could not verify plugin's Maven prerequisite: " + e.getMessage() );
    }
  }
}

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

private Result<? extends ProjectDependencyGraph> buildGraph( MavenSession session, MavenExecutionResult result )
{
  Result<? extends ProjectDependencyGraph> graphResult = graphBuilder.build( session );
  for ( ModelProblem problem : graphResult.getProblems() )
  {
    if ( problem.getSeverity() == ModelProblem.Severity.WARNING )
    {
      logger.warn( problem.toString() );
    }
    else
    {
      logger.error( problem.toString() );
    }
  }
  if ( !graphResult.hasErrors() )
  {
    ProjectDependencyGraph projectDependencyGraph = graphResult.get();
    session.setProjects( projectDependencyGraph.getSortedProjects() );
    session.setAllProjects( projectDependencyGraph.getAllProjects() );
    session.setProjectDependencyGraph( projectDependencyGraph );
  }
  return graphResult;
}

相关文章