Leave module-info.class in root of archive when repackaging

Closes gh-15810
This commit is contained in:
Andy Wilkinson
2019-02-01 13:46:22 +00:00
parent c84a0f530b
commit 2650a07dc9
5 changed files with 51 additions and 7 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -55,13 +55,15 @@ public class BootJar extends Jar implements BootArchive {
getMainSpec().with(this.bootInf);
this.bootInf.into("classes", classpathFiles(File::isDirectory));
this.bootInf.into("lib", classpathFiles(File::isFile));
this.bootInf.filesMatching("module-info.class", (details) -> {
details.setRelativePath(details.getRelativeSourcePath());
});
}
private Action<CopySpec> classpathFiles(Spec<File> filter) {
return (copySpec) -> copySpec
.from((Callable<Iterable<File>>) () -> (this.classpath != null)
? this.classpath.filter(filter) : Collections.emptyList());
}
@Override

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -54,6 +54,9 @@ public class BootWar extends War implements BootArchive {
(copySpec) -> copySpec.from(
(Callable<Iterable<File>>) () -> (this.providedClasspath != null)
? this.providedClasspath : Collections.emptyList()));
getRootSpec().filesMatching("module-info.class", (details) -> {
details.setRelativePath(details.getRelativeSourcePath());
});
}
@Override