From 44fd34120b3bdb8262a3cf0ceac606f46a0fe9b2 Mon Sep 17 00:00:00 2001 From: Uwe Schindler Date: Mon, 9 Nov 2015 22:43:10 +0100 Subject: [PATCH] Simplify Dawid's PR (#87): Refer directly to signatures file if not jarred (this makes logging cleaner). --- .../thetaphi/forbiddenapis/maven/AbstractCheckMojo.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/main/java/de/thetaphi/forbiddenapis/maven/AbstractCheckMojo.java b/src/main/java/de/thetaphi/forbiddenapis/maven/AbstractCheckMojo.java index ed1c254d..d0506ae3 100644 --- a/src/main/java/de/thetaphi/forbiddenapis/maven/AbstractCheckMojo.java +++ b/src/main/java/de/thetaphi/forbiddenapis/maven/AbstractCheckMojo.java @@ -247,10 +247,6 @@ private URL createJarUrl(File f, String jarPath) throws MalformedURLException { return new URL(jarBaseUrl, encodeUrlPath(jarPath)); } - private URL createFileUrl(File f, String relativePath) throws MalformedURLException { - return new File(f, relativePath).toURI().toURL(); - } - @Override public void execute() throws MojoExecutionException { final Logger log = new Logger() { @@ -373,7 +369,9 @@ public void info(String msg) { final File f = resolveSignaturesArtifact(artifact); if (artifact.path != null) { if (f.isDirectory()) { - sigUrls.add(createFileUrl(f, artifact.path)); + // if Maven did not yet jarred the artifact, it returns the classes + // folder of the foreign Maven project, just use that one: + sigFiles.add(new File(f, artifact.path)); } else { sigUrls.add(createJarUrl(f, artifact.path)); }