1 package org.apache.maven.plugins.shade.custom;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.io.IOException;
23 import java.io.InputStream;
24 import java.util.List;
25 import java.util.jar.JarOutputStream;
26
27 import org.apache.maven.plugins.shade.relocation.Relocator;
28 import org.apache.maven.plugins.shade.resource.ReproducibleResourceTransformer;
29
30
31
32
33
34 public class CustomReproducibleResourceTransformer
35 implements ReproducibleResourceTransformer
36 {
37 @Override
38 public boolean canTransformResource( final String resource )
39 {
40 return true;
41 }
42
43
44
45
46 @Override
47 public final void processResource( final String resource, final InputStream is, final List<Relocator> relocators )
48 throws IOException
49 {
50 System.out.println( "Custom ResourceTransformer called through old API" );
51
52 processResource( resource, is, relocators, 0 );
53 }
54
55
56
57
58 @Override
59 public void processResource( final String resource, final InputStream is, final List<Relocator> relocators,
60 long time )
61 throws IOException
62 {
63 System.out.println( "Custom ResourceTransformer called through new Reprodcible API" );
64 }
65
66 @Override
67 public boolean hasTransformedResource()
68 {
69 return true;
70 }
71
72 @Override
73 public void modifyOutputStream( JarOutputStream os )
74 throws IOException
75 {
76
77 }
78 }