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.custom;
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 import org.apache.maven.plugins.shade.resource.ReproducibleResourceTransformer;
28
29
30
31
32
33 public class CustomReproducibleResourceTransformer implements ReproducibleResourceTransformer {
34 @Override
35 public boolean canTransformResource(final String resource) {
36 return true;
37 }
38
39
40
41
42 @Override
43 public final void processResource(final String resource, final InputStream is, final List<Relocator> relocators)
44 throws IOException {
45 System.out.println("Custom ResourceTransformer called through old API");
46
47 processResource(resource, is, relocators, 0);
48 }
49
50
51
52
53 @Override
54 public void processResource(
55 final String resource, final InputStream is, final List<Relocator> relocators, long time)
56 throws IOException {
57 System.out.println("Custom ResourceTransformer called through new Reprodcible API");
58 }
59
60 @Override
61 public boolean hasTransformedResource() {
62 return true;
63 }
64
65 @Override
66 public void modifyOutputStream(JarOutputStream os) throws IOException {
67
68 }
69 }