예제 #1
0
 @Override
 public Logger getLogger(final String name) {
   final Log log = StaticLoggerBinder.getSingleton().getLog();
   if (log == null) {
     throw new UnsupportedOperationException(
         "you must use another factory method:" + " getLogger(String name, Log log)");
   } else {
     return getLogger(name, log);
   }
 }
 @Override
 public void execute() throws MojoExecutionException, MojoFailureException {
   StaticLoggerBinder.getSingleton().setMavenLog(this.getLog());
   try {
     final List<Artifact> artifacts = getListOfArtifacts();
     LOG.debug("artifacts={}", artifacts);
     final ArrayList<File> files =
         new ArrayList<File>(Collections2.transform(artifacts, toFileFunction));
     final ArrayList<String> hashBaseNames =
         new ArrayList<String>(Collections2.transform(files, toBomStringFunction));
     addHashEntryForPom(hashBaseNames);
     writeResults(hashBaseNames);
   } catch (IOException ex) {
     throw new MojoExecutionException(ex.toString(), ex);
   }
 }
예제 #3
0
  public static Logger getLogger(final String name, final Log log) {

    final MavenLoggerFactory factory =
        (MavenLoggerFactory) StaticLoggerBinder.getSingleton().getLoggerFactory();

    MavenLogger logger = null;

    synchronized (factory) {
      logger = factory.loggerMap.get(name);

      if (logger == null) {
        logger = new MavenLogger(name, log);
        factory.loggerMap.put(name, logger);
      }
    }

    return logger;
  }