View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.maven.plugins.shade;
20  
21  import java.io.File;
22  import java.util.List;
23  import java.util.Set;
24  
25  import org.apache.maven.plugins.shade.filter.Filter;
26  import org.apache.maven.plugins.shade.relocation.Relocator;
27  import org.apache.maven.plugins.shade.resource.ResourceTransformer;
28  
29  /**
30   * Parameter object used to pass multitude of args to Shader.shade()
31   * @since 2.0
32   */
33  public class ShadeRequest {
34  
35      private Set<File> jars;
36  
37      private File uberJar;
38  
39      private List<Filter> filters;
40  
41      private List<Relocator> relocators;
42  
43      private List<ResourceTransformer> resourceTransformers;
44  
45      private boolean shadeSourcesContent;
46  
47      public Set<File> getJars() {
48          return jars;
49      }
50  
51      /**
52       * Which jars to shade.
53       *
54       * @param jars The jars.
55       */
56      public void setJars(Set<File> jars) {
57          this.jars = jars;
58      }
59  
60      public File getUberJar() {
61          return uberJar;
62      }
63  
64      /**
65       * Output jar.
66       *
67       * @param uberJar The ueberJar file.
68       */
69      public void setUberJar(File uberJar) {
70          this.uberJar = uberJar;
71      }
72  
73      public List<Filter> getFilters() {
74          return filters;
75      }
76  
77      /**
78       * The filters.
79       *
80       * @param filters The filters
81       */
82      public void setFilters(List<Filter> filters) {
83          this.filters = filters;
84      }
85  
86      public List<Relocator> getRelocators() {
87          return relocators;
88      }
89  
90      /**
91       * The relocators.
92       *
93       * @param relocators The relocators.
94       */
95      public void setRelocators(List<Relocator> relocators) {
96          this.relocators = relocators;
97      }
98  
99      public List<ResourceTransformer> getResourceTransformers() {
100         return resourceTransformers;
101     }
102 
103     /**
104      * The transformers.
105      *
106      * @param resourceTransformers List of resourceTransformers.
107      */
108     public void setResourceTransformers(List<ResourceTransformer> resourceTransformers) {
109         this.resourceTransformers = resourceTransformers;
110     }
111 
112     public boolean isShadeSourcesContent() {
113         return shadeSourcesContent;
114     }
115 
116     /**
117      * When true, it will attempt to shade the contents of the java source files when creating the sources jar.
118      * When false, it will just relocate the java source files to the shaded paths, but will not modify the
119      * actual contents of the java source files.
120      *
121      * @param shadeSourcesContent {@code true} or {@code false}.
122      */
123     public void setShadeSourcesContent(boolean shadeSourcesContent) {
124         this.shadeSourcesContent = shadeSourcesContent;
125     }
126 }