Skip to content

Commit

Permalink
Add logging
Browse files Browse the repository at this point in the history
  • Loading branch information
velo committed Mar 6, 2018
1 parent 0055640 commit 671487d
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.jar.JarFile;
import java.util.jar.Manifest;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import org.apache.maven.artifact.Artifact;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
Expand Down Expand Up @@ -50,11 +49,14 @@ public class ManifestValidatorMojo extends AbstractMojo {

@Override
public void execute() throws MojoExecutionException, MojoFailureException {
final Stream<Artifact> artifacts = project.getAttachedArtifacts().stream()
final List<Artifact> artifacts = project.getAttachedArtifacts().stream()
.filter(artifact -> "jar".equals(artifact.getType()))
.filter(artifact -> included(artifact.getArtifactId()));
.filter(artifact -> included(artifact.getArtifactId()))
.collect(Collectors.toList());

getLog().info("Validating " + artifacts.size() + " artifact(s)");

final String message = artifacts
final String message = artifacts.stream()
.map(artifact -> evaluate(artifact))
.filter(result -> result.hasWarnings())
.map(result -> result.message())
Expand All @@ -66,6 +68,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
}

private Result evaluate(Artifact artifact) {
getLog().info("Validating: " + artifact);
final File file = artifact.getFile();

if (!file.exists())
Expand Down

0 comments on commit 671487d

Please sign in to comment.