1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.plugins.shade.resource;
20
21 import java.io.IOException;
22 import java.io.InputStream;
23 import java.util.List;
24 import java.util.jar.JarOutputStream;
25
26 import org.apache.maven.plugins.shade.relocation.Relocator;
27
28
29
30
31 public class ApacheLicenseResourceTransformer extends AbstractCompatibilityTransformer {
32 private static final String LICENSE_PATH = "META-INF/LICENSE";
33
34 private static final String LICENSE_TXT_PATH = "META-INF/LICENSE.txt";
35
36 private static final String LICENSE_MD_PATH = "META-INF/LICENSE.md";
37
38 public boolean canTransformResource(String resource) {
39 return LICENSE_PATH.equalsIgnoreCase(resource)
40 || LICENSE_TXT_PATH.regionMatches(true, 0, resource, 0, LICENSE_TXT_PATH.length())
41 || LICENSE_MD_PATH.regionMatches(true, 0, resource, 0, LICENSE_MD_PATH.length());
42 }
43
44 public void processResource(String resource, InputStream is, List<Relocator> relocators, long time)
45 throws IOException {
46
47 }
48
49 public boolean hasTransformedResource() {
50 return false;
51 }
52
53 public void modifyOutputStream(JarOutputStream os) throws IOException {
54
55 }
56 }