1 package org.apache.maven.plugin.war.packaging;
2
3 /*
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 */
21
22 import java.io.File;
23 import java.util.List;
24
25 import org.apache.maven.archiver.MavenArchiveConfiguration;
26 import org.apache.maven.artifact.factory.ArtifactFactory;
27 import org.apache.maven.execution.MavenSession;
28 import org.apache.maven.plugin.logging.Log;
29 import org.apache.maven.plugin.war.util.WebappStructure;
30 import org.apache.maven.project.MavenProject;
31 import org.apache.maven.shared.filtering.MavenFileFilter;
32 import org.apache.maven.shared.utils.io.FileUtils.FilterWrapper;
33 import org.codehaus.plexus.archiver.jar.JarArchiver;
34 import org.codehaus.plexus.archiver.manager.ArchiverManager;
35
36 /**
37 * The packaging context.
38 *
39 * @author Stephane Nicoll
40 * @version $Id: WarPackagingContext.html 925069 2014-10-08 17:03:57Z khmarbaise $
41 */
42 public interface WarPackagingContext
43 {
44 /**
45 * Returns the maven project.
46 *
47 * @return the project
48 */
49 MavenProject getProject();
50
51 /**
52 * Returns the webapp directory. Packaging tasks should use this directory to generate the webapp.
53 *
54 * @return the webapp directory
55 */
56 File getWebappDirectory();
57
58 /**
59 * Returns the main webapp source directory.
60 *
61 * @return the webapp source directory
62 */
63 File getWebappSourceDirectory();
64
65 /**
66 * Returns the webapp source includes.
67 *
68 * @return the webapp source includes
69 */
70 String[] getWebappSourceIncludes();
71
72 /**
73 * Returns {@code true} if empty directories should be includes, othewrwise {@code false}
74 *
75 * @return {@code true} if empty directories should be includes, othewrwise {@code false}
76 */
77 boolean isWebappSourceIncludeEmptyDirectories();
78
79 /**
80 * Returns the webapp source excludes.
81 *
82 * @return the webapp source excludes
83 */
84 String[] getWebappSourceExcludes();
85
86 /**
87 * Returns the directory holding generated classes.
88 *
89 * @return the classes directory
90 */
91 File getClassesDirectory();
92
93 /**
94 * Specify whether the classes resources should be archived in the <tt>WEB-INF/lib</tt> of the generated web app.
95 *
96 * @return true if the classes should be archived, false otherwise
97 */
98 boolean archiveClasses();
99
100 /**
101 * Returns the logger to use to output logging event.
102 *
103 * @return the logger
104 */
105 Log getLog();
106
107 /**
108 * Returns the directory to unpack dependent WARs into if needed.
109 *
110 * @return the overlays work directory
111 */
112 File getOverlaysWorkDirectory();
113
114 /**
115 * Returns the archiver manager to use.
116 *
117 * @return the archiver manager
118 */
119 ArchiverManager getArchiverManager();
120
121 /**
122 * The maven archive configuration to use.
123 *
124 * @return the maven archive configuration
125 */
126 MavenArchiveConfiguration getArchive();
127
128 /**
129 * Returns the Jar archiver needed for archiving classes directory into jar file under WEB-INF/lib.
130 *
131 * @return the jar archiver to user
132 */
133 JarArchiver getJarArchiver();
134
135 /**
136 * Returns the output file name mapping to use, if any. Returns <tt>null</tt> if no file name mapping is set.
137 *
138 * @return the output file name mapping or <tt>null</tt>
139 */
140 String getOutputFileNameMapping();
141
142 /**
143 * Returns the list of filter files to use.
144 *
145 * @return a list of filter files
146 */
147 List<String> getFilters();
148
149 /**
150 * Returns the {@link WebappStructure}.
151 *
152 * @return the webapp structure
153 */
154 WebappStructure getWebappStructure();
155
156 /**
157 * Returns the list of registered overlays for this session. This list might differ from the one returned by the
158 * cache; in this case, it means that the project's configuration has changed. The plugin will handle those cases
159 * nicely but it would be better in general to invoke the clean goal.
160 *
161 * @return the list of registered overlays, including the current project
162 */
163 List<String> getOwnerIds();
164
165 /**
166 * Returns the {@link MavenFileFilter} instance to use.
167 *
168 * @return the maven file filter to use
169 * @since 2.1-alpha-2
170 */
171 MavenFileFilter getMavenFileFilter();
172
173 /**
174 * @return {@link List} of {@link FilterWrapper}
175 * @since 2.1-alpha-2
176 */
177 List<FilterWrapper> getFilterWrappers();
178
179 /**
180 * Specify if the given <tt>fileName</tt> belongs to the list of extensions that must not be filtered
181 *
182 * @param fileName the name of file
183 * @return <tt>true</tt> if it should not be filtered, <tt>false</tt> otherwise
184 * @since 2.1-alpha-2
185 */
186 boolean isNonFilteredExtension( String fileName );
187
188 boolean isFilteringDeploymentDescriptors();
189
190 ArtifactFactory getArtifactFactory();
191
192 /**
193 * Returns the Maven session.
194 *
195 * @return the Maven session
196 * @since 2.2
197 */
198 MavenSession getSession();
199
200 /**
201 * Returns the encoding to use for resources.
202 *
203 * @return the resource encoding
204 * @since 2.3
205 */
206 String getResourceEncoding();
207
208 /**
209 * @return to use jvmChmod rather than forking chmod cli
210 * @since 2.4
211 */
212 boolean isUseJvmChmod();
213 }