@Override
 public void validate(final MavenEnvironment env) throws ValidationException {
   if (!env.outdir().exists()
       || "pom".equals(env.project().getPackaging())
       || env.exclude("dependencies", "")) {
     Logger.info(this, "No dependency analysis in this project");
     return;
   }
   final Collection<String> unused = DependenciesValidator.unused(env);
   if (!unused.isEmpty()) {
     Logger.warn(
         this,
         "Unused declared dependencies found:%s%s",
         DependenciesValidator.SEP,
         StringUtils.join(unused, DependenciesValidator.SEP));
   }
   final Collection<String> used = DependenciesValidator.used(env);
   if (!used.isEmpty()) {
     Logger.warn(
         this,
         "Used undeclared dependencies found:%s%s",
         DependenciesValidator.SEP,
         StringUtils.join(used, DependenciesValidator.SEP));
   }
   final Integer failures = used.size() + unused.size();
   if (failures > 0) {
     throw new ValidationException("%d dependency problem(s) found", failures);
   }
   Logger.info(this, "No dependency problems found");
 }
 /**
  * Analyze the project.
  *
  * @param env The environment
  * @return The result of analysis
  */
 private static ProjectDependencyAnalysis analyze(final MavenEnvironment env) {
   try {
     return ((ProjectDependencyAnalyzer)
             ((PlexusContainer) env.context().get(PlexusConstants.PLEXUS_KEY))
                 .lookup(ProjectDependencyAnalyzer.ROLE, "default"))
         .analyze(env.project());
   } catch (final ContextException ex) {
     throw new IllegalStateException(ex);
   } catch (final ComponentLookupException ex) {
     throw new IllegalStateException(ex);
   } catch (final ProjectDependencyAnalyzerException ex) {
     throw new IllegalStateException(ex);
   }
 }