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

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

本文整理了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

  1. public void warn( Throwable error )
  2. {
  3. logger.warn( "", error );
  4. }

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

  1. public void warn( Throwable error )
  2. {
  3. logger.warn( "", error );
  4. }

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

  1. private void cleanupTemporaryFiles( List<File> files )
  2. {
  3. for ( File file : files )
  4. {
  5. // really don't care if it failed here only log warning
  6. if ( !file.delete() )
  7. {
  8. logger.warn( "skip failed to delete temporary file : " + file.getAbsolutePath() );
  9. file.deleteOnExit();
  10. }
  11. }
  12. }

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

  1. private void logError( String action, Throwable e, EventSpy spy )
  2. {
  3. String msg = "Failed to " + action + " spy " + spy.getClass().getName() + ": " + e.getMessage();
  4. if ( logger.isDebugEnabled() )
  5. {
  6. logger.warn( msg, e );
  7. }
  8. else
  9. {
  10. logger.warn( msg );
  11. }
  12. }

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

  1. public void warn( CharSequence content )
  2. {
  3. logger.warn( toString( content ) );
  4. }

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

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

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

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

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

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

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

  1. public void warn( CharSequence content )
  2. {
  3. logger.warn( toString( content ) );
  4. }

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

  1. private void handleChecksumFailure( String checksumPolicy, String message, Throwable cause )
  2. throws ChecksumFailedException
  3. {
  4. if ( ArtifactRepositoryPolicy.CHECKSUM_POLICY_FAIL.equals( checksumPolicy ) )
  5. {
  6. throw new ChecksumFailedException( message, cause );
  7. }
  8. else if ( !ArtifactRepositoryPolicy.CHECKSUM_POLICY_IGNORE.equals( checksumPolicy ) )
  9. {
  10. // warn if it is set to anything other than ignore
  11. logger.warn( "*** CHECKSUM FAILED - " + message + " - IGNORING" );
  12. }
  13. // otherwise it is ignore
  14. }

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

  1. private void validateActivatedProfiles( List<MavenProject> projects, List<String> activeProfileIds )
  2. {
  3. Collection<String> notActivatedProfileIds = new LinkedHashSet<>( activeProfileIds );
  4. for ( MavenProject project : projects )
  5. {
  6. for ( List<String> profileIds : project.getInjectedProfileIds().values() )
  7. {
  8. notActivatedProfileIds.removeAll( profileIds );
  9. }
  10. }
  11. for ( String notActivatedProfileId : notActivatedProfileIds )
  12. {
  13. logger.warn( "The requested profile \"" + notActivatedProfileId
  14. + "\" could not be activated because it does not exist." );
  15. }
  16. }

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

  1. @Override
  2. public void artifactDescriptorInvalid( RepositoryEvent event )
  3. {
  4. StringBuilder buffer = new StringBuilder( 256 );
  5. buffer.append( "The POM for " );
  6. buffer.append( event.getArtifact() );
  7. buffer.append( " is invalid, transitive dependencies (if any) will not be available" );
  8. if ( logger.isDebugEnabled() )
  9. {
  10. logger.warn( buffer + ": " + event.getException().getMessage() );
  11. }
  12. else
  13. {
  14. logger.warn( buffer + ", enable debug logging for more details" );
  15. }
  16. }

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

  1. @Override
  2. public void metadataResolved( RepositoryEvent event )
  3. {
  4. Exception e = event.getException();
  5. if ( e != null )
  6. {
  7. if ( e instanceof MetadataNotFoundException )
  8. {
  9. logger.debug( e.getMessage() );
  10. }
  11. else if ( logger.isDebugEnabled() )
  12. {
  13. logger.warn( e.getMessage(), e );
  14. }
  15. else
  16. {
  17. logger.warn( e.getMessage() );
  18. }
  19. }
  20. }

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

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

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

  1. private void logMissingSiblingProjectArtifact( Artifact artifact )
  2. {
  3. if ( logger == null || !logger.isDebugEnabled() )
  4. {
  5. return;
  6. }
  7. if ( logger.isDebugEnabled() )
  8. {
  9. StringBuffer message = new StringBuffer();
  10. message.append( "WARNING: A dependency of the current project (or of one the plugins used in its build) was found in the reactor, " );
  11. message.append( "\nbut had not been built at the time it was requested. It will be resolved from the repository instead." );
  12. message.append( "\n\nCurrent Project: " ).append( getName() );
  13. message.append( "\nRequested Dependency: " ).append( artifact.getId() );
  14. 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." );
  15. message.append( "\n" );
  16. logger.debug( message.toString() );
  17. }
  18. else
  19. {
  20. logger.warn( "Requested project artifact: " + artifact.getId() + " is not available at this time. Resolving externally." );
  21. }
  22. }

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

  1. private void validatePrerequisitesForNonMavenPluginProjects( List<MavenProject> projects )
  2. {
  3. for ( MavenProject mavenProject : projects )
  4. {
  5. if ( !"maven-plugin".equals( mavenProject.getPackaging() ) )
  6. {
  7. Prerequisites prerequisites = mavenProject.getPrerequisites();
  8. if ( prerequisites != null && prerequisites.getMaven() != null )
  9. {
  10. logger.warn( "The project " + mavenProject.getId() + " uses prerequisites"
  11. + " which is only intended for maven-plugin projects "
  12. + "but not for non maven-plugin projects. "
  13. + "For such purposes you should use the maven-enforcer-plugin. "
  14. + "See https://maven.apache.org/enforcer/enforcer-rules/requireMavenVersion.html" );
  15. }
  16. }
  17. }
  18. }

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

  1. public void addProfile( Profile profile )
  2. {
  3. String profileId = profile.getId();
  4. Profile existing = profilesById.get( profileId );
  5. if ( existing != null )
  6. {
  7. logger.warn( "Overriding profile: \'" + profileId + "\' (source: " + existing.getSource()
  8. + ") with new instance from source: " + profile.getSource() );
  9. }
  10. profilesById.put( profile.getId(), profile );
  11. Activation activation = profile.getActivation();
  12. if ( activation != null && activation.isActiveByDefault() )
  13. {
  14. activateAsDefault( profileId );
  15. }
  16. }

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

  1. public void addProfile( Profile profile )
  2. {
  3. String profileId = profile.getId();
  4. Profile existing = (Profile) profilesById.get( profileId );
  5. if ( existing != null )
  6. {
  7. container.getLogger().warn( "Overriding profile: \'" + profileId + "\' (source: " + existing.getSource() +
  8. ") with new instance from source: " + profile.getSource() );
  9. }
  10. profilesById.put( profile.getId(), profile );
  11. Activation activation = profile.getActivation();
  12. if ( activation != null && activation.isActiveByDefault() )
  13. {
  14. activateAsDefault( profileId );
  15. }
  16. }

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

  1. public void checkRequiredMavenVersion( PluginDescriptor pluginDescriptor )
  2. throws PluginIncompatibleException
  3. {
  4. String requiredMavenVersion = pluginDescriptor.getRequiredMavenVersion();
  5. if ( StringUtils.isNotBlank( requiredMavenVersion ) )
  6. {
  7. try
  8. {
  9. if ( !runtimeInformation.isMavenVersion( requiredMavenVersion ) )
  10. {
  11. throw new PluginIncompatibleException( pluginDescriptor.getPlugin(),
  12. "The plugin " + pluginDescriptor.getId()
  13. + " requires Maven version " + requiredMavenVersion );
  14. }
  15. }
  16. catch ( RuntimeException e )
  17. {
  18. logger.warn( "Could not verify plugin's Maven prerequisite: " + e.getMessage() );
  19. }
  20. }
  21. }

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

  1. private Result<? extends ProjectDependencyGraph> buildGraph( MavenSession session, MavenExecutionResult result )
  2. {
  3. Result<? extends ProjectDependencyGraph> graphResult = graphBuilder.build( session );
  4. for ( ModelProblem problem : graphResult.getProblems() )
  5. {
  6. if ( problem.getSeverity() == ModelProblem.Severity.WARNING )
  7. {
  8. logger.warn( problem.toString() );
  9. }
  10. else
  11. {
  12. logger.error( problem.toString() );
  13. }
  14. }
  15. if ( !graphResult.hasErrors() )
  16. {
  17. ProjectDependencyGraph projectDependencyGraph = graphResult.get();
  18. session.setProjects( projectDependencyGraph.getSortedProjects() );
  19. session.setAllProjects( projectDependencyGraph.getAllProjects() );
  20. session.setProjectDependencyGraph( projectDependencyGraph );
  21. }
  22. return graphResult;
  23. }

相关文章