Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow referencing non-jarred artefacts (so that compile phase works). #87

Merged
merged 1 commit into from
Nov 9, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,10 @@ 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() {
Expand Down Expand Up @@ -363,11 +367,16 @@ public void info(String msg) {
if (signaturesFiles != null) {
sigFiles.addAll(Arrays.asList(signaturesFiles));
}

if (signaturesArtifacts != null) {
for (final SignaturesArtifact artifact : signaturesArtifacts) {
final File f = resolveSignaturesArtifact(artifact);
if (artifact.path != null) {
sigUrls.add(createJarUrl(f, artifact.path));
if (f.isDirectory()) {
sigUrls.add(createFileUrl(f, artifact.path));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, you could simply add the resolved file to sigFiles. This makes output for plain files nicer (it does not log an url, but a filename). It would simply handle the artifact as a plain file.

Something like: sigFiles.add(new File(f, artifact.path))

I am still confused, how this can work. It returns a directory instead of a file after artifact resolve????

} else {
sigUrls.add(createJarUrl(f, artifact.path));
}
} else {
sigFiles.add(f);
}
Expand Down