View Javadoc
1   package org.apache.maven.plugins.war;
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.io.IOException;
24  import java.util.ArrayList;
25  import java.util.Arrays;
26  import java.util.Collections;
27  import java.util.LinkedHashSet;
28  import java.util.List;
29  
30  import org.apache.maven.archiver.MavenArchiveConfiguration;
31  import org.apache.maven.artifact.factory.ArtifactFactory;
32  import org.apache.maven.execution.MavenSession;
33  import org.apache.maven.model.Resource;
34  import org.apache.maven.plugin.AbstractMojo;
35  import org.apache.maven.plugin.MojoExecutionException;
36  import org.apache.maven.plugin.MojoFailureException;
37  import org.apache.maven.plugin.logging.Log;
38  import org.apache.maven.plugins.annotations.Component;
39  import org.apache.maven.plugins.annotations.Parameter;
40  import org.apache.maven.plugins.war.overlay.OverlayManager;
41  import org.apache.maven.plugins.war.packaging.CopyUserManifestTask;
42  import org.apache.maven.plugins.war.packaging.DependenciesAnalysisPackagingTask;
43  import org.apache.maven.plugins.war.packaging.OverlayPackagingTask;
44  import org.apache.maven.plugins.war.packaging.SaveWebappStructurePostPackagingTask;
45  import org.apache.maven.plugins.war.packaging.WarPackagingContext;
46  import org.apache.maven.plugins.war.packaging.WarPackagingTask;
47  import org.apache.maven.plugins.war.packaging.WarPostPackagingTask;
48  import org.apache.maven.plugins.war.packaging.WarProjectPackagingTask;
49  import org.apache.maven.plugins.war.util.WebappStructure;
50  import org.apache.maven.plugins.war.util.WebappStructureSerializer;
51  import org.apache.maven.project.MavenProject;
52  import org.apache.maven.shared.filtering.MavenFileFilter;
53  import org.apache.maven.shared.filtering.MavenFilteringException;
54  import org.apache.maven.shared.filtering.MavenResourcesExecution;
55  import org.apache.maven.shared.filtering.MavenResourcesFiltering;
56  import org.apache.maven.shared.utils.StringUtils;
57  import org.apache.maven.shared.utils.io.FileUtils;
58  import org.codehaus.plexus.archiver.Archiver;
59  import org.codehaus.plexus.archiver.jar.JarArchiver;
60  import org.codehaus.plexus.archiver.manager.ArchiverManager;
61  
62  /**
63   * Contains common jobs for WAR mojos.
64   *
65   * @version $Id: AbstractWarMojo.java 1781709 2017-02-04 21:11:45Z michaelo $
66   */
67  public abstract class AbstractWarMojo
68      extends AbstractMojo
69  {
70      private static final String META_INF = "META-INF";
71  
72      private static final String WEB_INF = "WEB-INF";
73  
74      /**
75       * The Maven project.
76       */
77      @Parameter( defaultValue = "${project}", readonly = true, required = true )
78      private MavenProject project;
79  
80      /**
81       * The directory containing compiled classes.
82       */
83      @Parameter( defaultValue = "${project.build.outputDirectory}", required = true, readonly = true )
84      private File classesDirectory;
85  
86      /**
87       * Whether a JAR file will be created for the classes in the webapp. Using this optional configuration parameter
88       * will make the compiled classes to be archived into a JAR file and the classes directory will then be excluded
89       * from the webapp.
90       *
91       * @since 2.0.1
92       */
93      @Parameter( defaultValue = "false" )
94      private boolean archiveClasses;
95  
96      /**
97       * The encoding to use when copying filtered web resources.
98       *
99       * @since 2.3
100      */
101     @Parameter( defaultValue = "${project.build.sourceEncoding}" )
102     private String resourceEncoding;
103 
104     /**
105      * The JAR archiver needed for archiving the classes directory into a JAR file under WEB-INF/lib.
106      */
107     @Component( role = Archiver.class, hint = "jar" )
108     private JarArchiver jarArchiver;
109 
110     /**
111      * The directory where the webapp is built.
112      */
113     @Parameter( defaultValue = "${project.build.directory}/${project.build.finalName}", required = true )
114     private File webappDirectory;
115 
116     /**
117      * Single directory for extra files to include in the WAR. This is where you place your JSP files.
118      */
119     @Parameter( defaultValue = "${basedir}/src/main/webapp", required = true )
120     private File warSourceDirectory;
121 
122     /**
123      * The list of webResources we want to transfer.
124      */
125     @Parameter
126     private Resource[] webResources;
127 
128     /**
129      * Filters (property files) to include during the interpolation of the pom.xml.
130      */
131     @Parameter
132     private List<String> filters;
133 
134     /**
135      * <p>
136      * Set of delimiters for expressions to filter within the resources. These delimiters are specified in the form
137      * 'beginToken*endToken'. If no '*' is given, the delimiter is assumed to be the same for start and end.
138      * </p>
139      * <p>
140      * So, the default filtering delimiters might be specified as:
141      * </p>
142      * 
143      * <pre>
144      * &lt;delimiters&gt;
145      *   &lt;delimiter&gt;${*}&lt;/delimiter&gt;
146      *   &lt;delimiter&gt;@&lt;/delimiter&gt;
147      * &lt;/delimiters&gt;
148      * </pre>
149      * <p>
150      * Since the '@' delimiter is the same on both ends, we don't need to specify '@*@' (though we can).
151      * </p>
152      *
153      * @since 3.0.0
154      */
155     @Parameter
156     private LinkedHashSet<String> delimiters;
157 
158     /**
159      * Use default delimiters in addition to custom delimiters, if any.
160      *
161      * @since 3.0.0
162      */
163     @Parameter( defaultValue = "true" )
164     private boolean useDefaultDelimiters;
165 
166     /**
167      * The path to the web.xml file to use.
168      */
169     @Parameter
170     private File webXml;
171 
172     /**
173      * The path to a configuration file for the servlet container. Note that the file name may be different for
174      * different servlet containers. Apache Tomcat uses a configuration file named context.xml. The file will be copied
175      * to the META-INF directory.
176      */
177     @Parameter
178     private File containerConfigXML;
179 
180     /**
181      * Directory to unpack dependent WARs into if needed.
182      */
183     @Parameter( defaultValue = "${project.build.directory}/war/work", required = true )
184     private File workDirectory;
185 
186     /**
187      * The file name mapping to use when copying libraries and TLDs. If no file mapping is set (default) the files are
188      * copied with their standard names.
189      *
190      * @since 2.1-alpha-1
191      */
192     @Parameter
193     private String outputFileNameMapping;
194 
195     /**
196      * The file containing the webapp structure cache.
197      *
198      * @since 2.1-alpha-1
199      */
200     @Parameter( defaultValue = "${project.build.directory}/war/work/webapp-cache.xml", required = true )
201     private File cacheFile;
202 
203     /**
204      * Whether the cache should be used to save the status of the webapp across multiple runs. Experimental feature so
205      * disabled by default.
206      *
207      * @since 2.1-alpha-1
208      */
209     @Parameter( defaultValue = "false" )
210     private boolean useCache;
211 
212     /**
213      */
214     @Component( role = ArtifactFactory.class )
215     private ArtifactFactory artifactFactory;
216 
217     /**
218      * To look up Archiver/UnArchiver implementations.
219      */
220     @Component( role = ArchiverManager.class )
221     private ArchiverManager archiverManager;
222 
223     /**
224      */
225     @Component( role = MavenFileFilter.class, hint = "default" )
226     private MavenFileFilter mavenFileFilter;
227 
228     /**
229      */
230     @Component( role = MavenResourcesFiltering.class, hint = "default" )
231     private MavenResourcesFiltering mavenResourcesFiltering;
232 
233     /**
234      * The comma separated list of tokens to include when copying the content of the warSourceDirectory.
235      */
236     @Parameter( defaultValue = "**" )
237     private String warSourceIncludes;
238 
239     /**
240      * The comma separated list of tokens to exclude when copying the content of the warSourceDirectory.
241      */
242     @Parameter
243     private String warSourceExcludes;
244 
245     /**
246      * The comma separated list of tokens to include when doing a WAR overlay. Default is 
247      * {@link org.apache.maven.plugins.war.Overlay#DEFAULT_INCLUDES}
248      *
249      */
250     @Parameter
251     private String dependentWarIncludes = StringUtils.join( Overlay.DEFAULT_INCLUDES, "," );
252 
253     /**
254      * The comma separated list of tokens to exclude when doing a WAR overlay. Default is 
255      * {@link org.apache.maven.plugins.war.Overlay#DEFAULT_EXCLUDES}
256      *
257      */
258     @Parameter
259     private String dependentWarExcludes = StringUtils.join( Overlay.DEFAULT_EXCLUDES, "," );
260 
261     /**
262      * The overlays to apply. Each &lt;overlay&gt; element may contain:
263      * <ul>
264      * <li>id (defaults to <tt>currentBuild</tt>)</li>
265      * <li>groupId (if this and artifactId are null, then the current project is treated as its own overlay)</li>
266      * <li>artifactId (see above)</li>
267      * <li>classifier</li>
268      * <li>type</li>
269      * <li>includes (a list of string patterns)</li>
270      * <li>excludes (a list of string patterns)</li>
271      * <li>filtered (defaults to false)</li>
272      * <li>skip (defaults to false)</li>
273      * <li>targetPath (defaults to root of webapp structure)</li>
274      * </ul>
275      *
276      * @since 2.1-alpha-1
277      */
278     @Parameter
279     private List<Overlay> overlays = new ArrayList<Overlay>();
280 
281     /**
282      * A list of file extensions that should not be filtered. <b>Will be used when filtering webResources and
283      * overlays.</b>
284      *
285      * @since 2.1-alpha-2
286      */
287     @Parameter
288     private List<String> nonFilteredFileExtensions;
289 
290     /**
291      * @since 2.1-alpha-2
292      */
293     @Parameter( defaultValue = "${session}", readonly = true, required = true )
294     private MavenSession session;
295 
296     /**
297      * To filter deployment descriptors. <b>Disabled by default.</b>
298      *
299      * @since 2.1-alpha-2
300      */
301     @Parameter( defaultValue = "false" )
302     private boolean filteringDeploymentDescriptors;
303 
304     /**
305      * To escape interpolated values with Windows path <code>c:\foo\bar</code> will be replaced with
306      * <code>c:\\foo\\bar</code>.
307      *
308      * @since 2.1-alpha-2
309      */
310     @Parameter( defaultValue = "false" )
311     private boolean escapedBackslashesInFilePath;
312 
313     /**
314      * Expression preceded with this String won't be interpolated. <code>\${foo}</code> will be replaced with
315      * <code>${foo}</code>.
316      *
317      * @since 2.1-beta-1
318      */
319     @Parameter
320     protected String escapeString;
321 
322     /**
323      * Indicates if zip archives (jar,zip etc) being added to the war should be compressed again. Compressing again can
324      * result in smaller archive size, but gives noticeably longer execution time.
325      *
326      * @since 2.3
327      */
328     @Parameter( defaultValue = "true" )
329     private boolean recompressZippedFiles;
330 
331     /**
332      * @since 2.4
333      */
334     @Parameter( defaultValue = "false" )
335     private boolean includeEmptyDirectories;
336 
337     /**
338      * Stop searching endToken at the end of line
339      * 
340      * @since 2.4
341      */
342     @Parameter( defaultValue = "false" )
343     private boolean supportMultiLineFiltering;
344 
345     /**
346      * use jvmChmod rather that cli chmod and forking process
347      * 
348      * @since 2.4
349      */
350     @Parameter( defaultValue = "true" )
351     private boolean useJvmChmod;
352 
353     /**
354      * The archive configuration to use. See <a href="http://maven.apache.org/shared/maven-archiver/index.html">Maven
355      * Archiver Reference</a>.
356      */
357     @Parameter
358     private MavenArchiveConfiguration archive = new MavenArchiveConfiguration();
359 
360     private final WebappStructureSerializer webappStructureSerialier = new WebappStructureSerializer();
361 
362     private final Overlay currentProjectOverlay = Overlay.createInstance();
363 
364     /**
365      * @return The current overlay.
366      */
367     public Overlay getCurrentProjectOverlay()
368     {
369         return currentProjectOverlay;
370     }
371 
372     /**
373      * Returns a string array of the excludes to be used when copying the content of the WAR source directory.
374      *
375      * @return an array of tokens to exclude
376      */
377     protected String[] getExcludes()
378     {
379         List<String> excludeList = new ArrayList<String>();
380         if ( StringUtils.isNotEmpty( warSourceExcludes ) )
381         {
382             excludeList.addAll( Arrays.asList( StringUtils.split( warSourceExcludes, "," ) ) );
383         }
384 
385         // if webXML is specified, omit the one in the source directory
386         if ( webXml != null && StringUtils.isNotEmpty( webXml.getName() ) )
387         {
388             excludeList.add( "**/" + WEB_INF + "/web.xml" );
389         }
390 
391         // if contextXML is specified, omit the one in the source directory
392         if ( containerConfigXML != null && StringUtils.isNotEmpty( containerConfigXML.getName() ) )
393         {
394             excludeList.add( "**/" + META_INF + "/" + containerConfigXML.getName() );
395         }
396 
397         return excludeList.toArray( new String[excludeList.size()] );
398     }
399 
400     /**
401      * Returns a string array of the includes to be used when assembling/copying the WAR.
402      *
403      * @return an array of tokens to include
404      */
405     protected String[] getIncludes()
406     {
407         return StringUtils.split( StringUtils.defaultString( warSourceIncludes ), "," );
408     }
409 
410     /**
411      * Returns a string array of the excludes to be used when adding dependent WAR as an overlay onto this WAR.
412      *
413      * @return an array of tokens to exclude
414      */
415     protected String[] getDependentWarExcludes()
416     {
417         return StringUtils.split( StringUtils.defaultString( dependentWarExcludes ), "," );
418     }
419 
420     /**
421      * Returns a string array of the includes to be used when adding dependent WARs as an overlay onto this WAR.
422      *
423      * @return an array of tokens to include
424      */
425     protected String[] getDependentWarIncludes()
426     {
427         return StringUtils.split( StringUtils.defaultString( dependentWarIncludes ), "," );
428     }
429 
430     /**
431      * @param webapplicationDirectory The web application directory.
432      * @throws MojoExecutionException In case of failure.
433      * @throws MojoFailureException In case of failure.
434      */
435     public void buildExplodedWebapp( File webapplicationDirectory )
436         throws MojoExecutionException, MojoFailureException
437     {
438         webapplicationDirectory.mkdirs();
439 
440         try
441         {
442             buildWebapp( project, webapplicationDirectory );
443         }
444         catch ( IOException e )
445         {
446             throw new MojoExecutionException( "Could not build webapp", e );
447         }
448     }
449 
450     /**
451      * Builds the webapp for the specified project with the new packaging task thingy.
452      * Classes, libraries and tld files are copied to the <tt>webappDirectory</tt> during this phase.
453      *
454      * @param mavenProject the maven project
455      * @param webapplicationDirectory the target directory
456      * @throws MojoExecutionException if an error occurred while packaging the webapp
457      * @throws MojoFailureException if an unexpected error occurred while packaging the webapp
458      * @throws IOException if an error occurred while copying the files
459      */
460     public void buildWebapp( MavenProject mavenProject, File webapplicationDirectory )
461         throws MojoExecutionException, MojoFailureException, IOException
462     {
463 
464         WebappStructure cache;
465         if ( useCache && cacheFile.exists() )
466         {
467             // CHECKSTYLE_OFF: LineLength
468             cache = new WebappStructure( mavenProject.getDependencies(), webappStructureSerialier.fromXml( cacheFile ) );
469             // CHECKSTYLE_ON: LineLength
470         }
471         else
472         {
473             cache = new WebappStructure( mavenProject.getDependencies(), null );
474         }
475 
476         // CHECKSTYLE_OFF: LineLength
477         final long startTime = System.currentTimeMillis();
478         getLog().info( "Assembling webapp [" + mavenProject.getArtifactId() + "] in [" + webapplicationDirectory + "]" );
479 
480         final OverlayManager overlayManager =
481             new OverlayManager( overlays, mavenProject, getDependentWarIncludes(), getDependentWarExcludes(),
482                                 currentProjectOverlay );
483         final List<WarPackagingTask> packagingTasks = getPackagingTasks( overlayManager );
484         // CHECKSTYLE_ON: LineLength
485         List<FileUtils.FilterWrapper> defaultFilterWrappers;
486         try
487         {
488             MavenResourcesExecution mavenResourcesExecution = new MavenResourcesExecution();
489             mavenResourcesExecution.setEscapeString( escapeString );
490             mavenResourcesExecution.setSupportMultiLineFiltering( supportMultiLineFiltering );
491             mavenResourcesExecution.setMavenProject( mavenProject );
492 
493             // if these are NOT set, just use the defaults, which are '${*}' and '@'.
494             mavenResourcesExecution.setDelimiters( delimiters, useDefaultDelimiters );
495 
496             if ( nonFilteredFileExtensions != null )
497             {
498                 mavenResourcesExecution.setNonFilteredFileExtensions( nonFilteredFileExtensions );
499             }
500             
501             if ( filters == null )
502             {
503                 filters = getProject().getBuild().getFilters();
504             }
505             mavenResourcesExecution.setFilters( filters );
506             mavenResourcesExecution.setEscapedBackslashesInFilePath( escapedBackslashesInFilePath );
507             mavenResourcesExecution.setMavenSession( this.session );
508             mavenResourcesExecution.setEscapeString( this.escapeString );
509             mavenResourcesExecution.setSupportMultiLineFiltering( supportMultiLineFiltering );
510 
511             defaultFilterWrappers = mavenFileFilter.getDefaultFilterWrappers( mavenResourcesExecution );
512 
513         }
514         catch ( MavenFilteringException e )
515         {
516             getLog().error( "fail to build filering wrappers " + e.getMessage() );
517             throw new MojoExecutionException( e.getMessage(), e );
518         }
519 
520         final WarPackagingContext context =
521             new DefaultWarPackagingContext( webapplicationDirectory, cache, overlayManager, defaultFilterWrappers,
522                                             getNonFilteredFileExtensions(), filteringDeploymentDescriptors,
523                                             this.artifactFactory, resourceEncoding, useJvmChmod );
524         for ( WarPackagingTask warPackagingTask : packagingTasks )
525         {
526             warPackagingTask.performPackaging( context );
527         }
528 
529         // Post packaging
530         final List<WarPostPackagingTask> postPackagingTasks = getPostPackagingTasks();
531         for ( WarPostPackagingTask task : postPackagingTasks )
532         {
533             task.performPostPackaging( context );
534         }
535         getLog().info( "Webapp assembled in [" + ( System.currentTimeMillis() - startTime ) + " msecs]" );
536 
537     }
538 
539     /**
540      * Returns a <tt>List</tt> of the {@link org.apache.maven.plugins.war.packaging.WarPackagingTask}
541      * instances to invoke to perform the packaging.
542      *
543      * @param overlayManager the overlay manager
544      * @return the list of packaging tasks
545      * @throws MojoExecutionException if the packaging tasks could not be built
546      */
547     private List<WarPackagingTask> getPackagingTasks( OverlayManager overlayManager )
548         throws MojoExecutionException
549     {
550         final List<WarPackagingTask> packagingTasks = new ArrayList<WarPackagingTask>();
551 
552         packagingTasks.add( new CopyUserManifestTask() );
553 
554         if ( useCache )
555         {
556             packagingTasks.add( new DependenciesAnalysisPackagingTask() );
557 
558         }
559 
560         final List<Overlay> resolvedOverlays = overlayManager.getOverlays();
561         for ( Overlay overlay : resolvedOverlays )
562         {
563             if ( overlay.isCurrentProject() )
564             {
565                 packagingTasks.add( new WarProjectPackagingTask( webResources, webXml, containerConfigXML,
566                                                                  currentProjectOverlay ) );
567             }
568             else
569             {
570                 packagingTasks.add( new OverlayPackagingTask( overlay, currentProjectOverlay ) );
571             }
572         }
573         return packagingTasks;
574     }
575 
576     /**
577      * Returns a <tt>List</tt> of the {@link org.apache.maven.plugins.war.packaging.WarPostPackagingTask} instances to
578      * invoke to perform the post-packaging.
579      *
580      * @return the list of post packaging tasks
581      */
582     private List<WarPostPackagingTask> getPostPackagingTasks()
583     {
584         final List<WarPostPackagingTask> postPackagingTasks = new ArrayList<WarPostPackagingTask>();
585         if ( useCache )
586         {
587             postPackagingTasks.add( new SaveWebappStructurePostPackagingTask( cacheFile ) );
588         }
589         // TODO add lib scanning to detect duplicates
590         return postPackagingTasks;
591     }
592 
593     /**
594      * WarPackagingContext default implementation
595      */
596     private class DefaultWarPackagingContext
597         implements WarPackagingContext
598     {
599 
600         private final ArtifactFactory artifactFactory;
601 
602         private final String resourceEncoding;
603 
604         private final WebappStructure webappStructure;
605 
606         private final File webappDirectory;
607 
608         private final OverlayManager overlayManager;
609 
610         private final List<FileUtils.FilterWrapper> filterWrappers;
611 
612         private List<String> nonFilteredFileExtensions;
613 
614         private boolean filteringDeploymentDescriptors;
615 
616         private boolean useJvmChmod = true;
617 
618         /**
619          * @param webappDirectory The web application directory.
620          * @param webappStructure The web app structure.
621          * @param overlayManager The overlay manager.
622          * @param filterWrappers The filter wrappers
623          * @param nonFilteredFileExtensions The non filtered file extensions.
624          * @param filteringDeploymentDescriptors The filtering deployment descriptors.
625          * @param artifactFactory The artifact factory.
626          * @param resourceEncoding The resource encoding.
627          * @param useJvmChmod use Jvm chmod or not.
628          */
629         public DefaultWarPackagingContext( File webappDirectory, final WebappStructure webappStructure,
630                                            final OverlayManager overlayManager,
631                                            List<FileUtils.FilterWrapper> filterWrappers,
632                                            List<String> nonFilteredFileExtensions,
633                                            boolean filteringDeploymentDescriptors, ArtifactFactory artifactFactory,
634                                            String resourceEncoding, boolean useJvmChmod )
635         {
636             this.webappDirectory = webappDirectory;
637             this.webappStructure = webappStructure;
638             this.overlayManager = overlayManager;
639             this.filterWrappers = filterWrappers;
640             this.artifactFactory = artifactFactory;
641             this.filteringDeploymentDescriptors = filteringDeploymentDescriptors;
642             this.nonFilteredFileExtensions =
643                 nonFilteredFileExtensions == null ? Collections.<String>emptyList() : nonFilteredFileExtensions;
644             this.resourceEncoding = resourceEncoding;
645             // This is kinda stupid but if we loop over the current overlays and we request the path structure
646             // it will register it. This will avoid wrong warning messages in a later phase
647             for ( String overlayId : overlayManager.getOverlayIds() )
648             {
649                 webappStructure.getStructure( overlayId );
650             }
651             this.useJvmChmod = useJvmChmod;
652         }
653 
654         /**
655          * {@inheritDoc}
656          */
657         public MavenProject getProject()
658         {
659             return project;
660         }
661 
662         /**
663          * {@inheritDoc}
664          */
665         public File getWebappDirectory()
666         {
667             return webappDirectory;
668         }
669 
670         /**
671          * {@inheritDoc}
672          */
673         public File getClassesDirectory()
674         {
675             return classesDirectory;
676         }
677 
678         /**
679          * {@inheritDoc}
680          */
681         public Log getLog()
682         {
683             return AbstractWarMojo.this.getLog();
684         }
685 
686         /**
687          * {@inheritDoc}
688          */
689         public String getOutputFileNameMapping()
690         {
691             return outputFileNameMapping;
692         }
693 
694         /**
695          * {@inheritDoc}
696          */
697         public File getWebappSourceDirectory()
698         {
699             return warSourceDirectory;
700         }
701 
702         /**
703          * {@inheritDoc}
704          */
705         public String[] getWebappSourceIncludes()
706         {
707             return getIncludes();
708         }
709 
710         /**
711          * {@inheritDoc}
712          */
713         public String[] getWebappSourceExcludes()
714         {
715             return getExcludes();
716         }
717 
718         /**
719          * {@inheritDoc}
720          */
721         public boolean isWebappSourceIncludeEmptyDirectories()
722         {
723             return includeEmptyDirectories;
724         }
725 
726         /**
727          * {@inheritDoc}
728          */
729         public boolean archiveClasses()
730         {
731             return archiveClasses;
732         }
733 
734         /**
735          * {@inheritDoc}
736          */
737         public File getOverlaysWorkDirectory()
738         {
739             return workDirectory;
740         }
741 
742         /**
743          * {@inheritDoc}
744          */
745         public ArchiverManager getArchiverManager()
746         {
747             return archiverManager;
748         }
749 
750         /**
751          * {@inheritDoc}
752          */
753         public MavenArchiveConfiguration getArchive()
754         {
755             return archive;
756         }
757 
758         /**
759          * {@inheritDoc}
760          */
761         public JarArchiver getJarArchiver()
762         {
763             return jarArchiver;
764         }
765 
766         /**
767          * {@inheritDoc}
768          */
769         public List<String> getFilters()
770         {
771             return filters;
772         }
773 
774         /**
775          * {@inheritDoc}
776          */
777         public WebappStructure getWebappStructure()
778         {
779             return webappStructure;
780         }
781 
782         /**
783          * {@inheritDoc}
784          */
785         public List<String> getOwnerIds()
786         {
787             return overlayManager.getOverlayIds();
788         }
789 
790         /**
791          * {@inheritDoc}
792          */
793         public MavenFileFilter getMavenFileFilter()
794         {
795             return mavenFileFilter;
796         }
797 
798         /**
799          * {@inheritDoc}
800          */
801         public List<FileUtils.FilterWrapper> getFilterWrappers()
802         {
803             return filterWrappers;
804         }
805 
806         /**
807          * {@inheritDoc}
808          */
809         public boolean isNonFilteredExtension( String fileName )
810         {
811             return !mavenResourcesFiltering.filteredFileExtension( fileName, nonFilteredFileExtensions );
812         }
813 
814         /**
815          * {@inheritDoc}
816          */
817         public boolean isFilteringDeploymentDescriptors()
818         {
819             return filteringDeploymentDescriptors;
820         }
821 
822         /**
823          * {@inheritDoc}
824          */
825         public ArtifactFactory getArtifactFactory()
826         {
827             return this.artifactFactory;
828         }
829 
830         /**
831          * {@inheritDoc}
832          */
833         public MavenSession getSession()
834         {
835             return session;
836         }
837 
838         /**
839          * {@inheritDoc}
840          */
841         public String getResourceEncoding()
842         {
843             return resourceEncoding;
844         }
845 
846         /**
847          * {@inheritDoc}
848          */
849         public boolean isUseJvmChmod()
850         {
851             return useJvmChmod;
852         }
853     }
854 
855     /**
856      * @return The Maven Project.
857      */
858     public MavenProject getProject()
859     {
860         return project;
861     }
862 
863     /**
864      * @param project The project to be set.
865      */
866     public void setProject( MavenProject project )
867     {
868         this.project = project;
869     }
870 
871     /**
872      * @return the classes directory.
873      */
874     public File getClassesDirectory()
875     {
876         return classesDirectory;
877     }
878 
879     /**
880      * @param classesDirectory The classes directory to be set.
881      */
882     public void setClassesDirectory( File classesDirectory )
883     {
884         this.classesDirectory = classesDirectory;
885     }
886 
887     /**
888      * @return {@link #webappDirectory}
889      */
890     public File getWebappDirectory()
891     {
892         return webappDirectory;
893     }
894 
895     /**
896      * @param webappDirectory The web application directory.
897      */
898     public void setWebappDirectory( File webappDirectory )
899     {
900         this.webappDirectory = webappDirectory;
901     }
902 
903     /**
904      * @return {@link #warSourceDirectory}
905      */
906     public File getWarSourceDirectory()
907     {
908         return warSourceDirectory;
909     }
910 
911     /**
912      * @param warSourceDirectory {@link #warSourceDirectory}
913      */
914     public void setWarSourceDirectory( File warSourceDirectory )
915     {
916         this.warSourceDirectory = warSourceDirectory;
917     }
918 
919     /**
920      * @return The {@link #webXml}
921      */
922     public File getWebXml()
923     {
924         return webXml;
925     }
926 
927     /**
928      * @param webXml The {@link #webXml}
929      */
930     public void setWebXml( File webXml )
931     {
932         this.webXml = webXml;
933     }
934 
935     /**
936      * @return {@link #containerConfigXML}
937      */
938     public File getContainerConfigXML()
939     {
940         return containerConfigXML;
941     }
942 
943     /**
944      * @param containerConfigXML {@link #containerConfigXML}
945      */
946     public void setContainerConfigXML( File containerConfigXML )
947     {
948         this.containerConfigXML = containerConfigXML;
949     }
950 
951     /**
952      * @return {@link #outputFileNameMapping}
953      */
954     public String getOutputFileNameMapping()
955     {
956         return outputFileNameMapping;
957     }
958 
959     /**
960      * @param outputFileNameMapping {@link #outputFileNameMapping}
961      */
962     public void setOutputFileNameMapping( String outputFileNameMapping )
963     {
964         this.outputFileNameMapping = outputFileNameMapping;
965     }
966 
967     /**
968      * @return {@link #overlays}
969      */
970     public List<Overlay> getOverlays()
971     {
972         return overlays;
973     }
974 
975     /**
976      * @param overlays {@link #overlays}
977      */
978     public void setOverlays( List<Overlay> overlays )
979     {
980         this.overlays = overlays;
981     }
982 
983     /**
984      * @param overlay add {@link #overlays}.
985      */
986     public void addOverlay( Overlay overlay )
987     {
988         overlays.add( overlay );
989     }
990 
991     /**
992      * @return {@link #archiveClasses}
993      */
994     public boolean isArchiveClasses()
995     {
996         return archiveClasses;
997     }
998 
999     /**
1000      * @param archiveClasses {@link #archiveClasses}
1001      */
1002     public void setArchiveClasses( boolean archiveClasses )
1003     {
1004         this.archiveClasses = archiveClasses;
1005     }
1006 
1007     /**
1008      * @return {@link JarArchiver}
1009      */
1010     public JarArchiver getJarArchiver()
1011     {
1012         return jarArchiver;
1013     }
1014 
1015     /**
1016      * @param jarArchiver {@link JarArchiver}
1017      */
1018     public void setJarArchiver( JarArchiver jarArchiver )
1019     {
1020         this.jarArchiver = jarArchiver;
1021     }
1022 
1023     /**
1024      * @return {@link #webResources}.
1025      */
1026     public Resource[] getWebResources()
1027     {
1028         return webResources;
1029     }
1030 
1031     /**
1032      * @param webResources {@link #webResources}.
1033      */
1034     public void setWebResources( Resource[] webResources )
1035     {
1036         this.webResources = webResources;
1037     }
1038 
1039     /**
1040      * @return {@link #filters}
1041      */
1042     public List<String> getFilters()
1043     {
1044         return filters;
1045     }
1046 
1047     /**
1048      * @param filters {@link #filters}
1049      */
1050     public void setFilters( List<String> filters )
1051     {
1052         this.filters = filters;
1053     }
1054 
1055     /**
1056      * @return {@link #workDirectory}
1057      */
1058     public File getWorkDirectory()
1059     {
1060         return workDirectory;
1061     }
1062 
1063     /**
1064      * @param workDirectory {@link #workDirectory}
1065      */
1066     public void setWorkDirectory( File workDirectory )
1067     {
1068         this.workDirectory = workDirectory;
1069     }
1070 
1071     /**
1072      * @return {@link #cacheFile}
1073      */
1074     public File getCacheFile()
1075     {
1076         return cacheFile;
1077     }
1078 
1079     /**
1080      * @param cacheFile {@link #cacheFile}
1081      */
1082     public void setCacheFile( File cacheFile )
1083     {
1084         this.cacheFile = cacheFile;
1085     }
1086 
1087     /**
1088      * @return {@link #warSourceIncludes}
1089      */
1090     public String getWarSourceIncludes()
1091     {
1092         return warSourceIncludes;
1093     }
1094 
1095     /**
1096      * @param warSourceIncludes {@link #warSourceIncludes}
1097      */
1098     public void setWarSourceIncludes( String warSourceIncludes )
1099     {
1100         this.warSourceIncludes = warSourceIncludes;
1101     }
1102 
1103     /**
1104      * @return {@link #warSourceExcludes}
1105      */
1106     public String getWarSourceExcludes()
1107     {
1108         return warSourceExcludes;
1109     }
1110 
1111     /**
1112      * @param warSourceExcludes {@link #warSourceExcludes}
1113      */
1114     public void setWarSourceExcludes( String warSourceExcludes )
1115     {
1116         this.warSourceExcludes = warSourceExcludes;
1117     }
1118 
1119     /**
1120      * @return {@link #useCache}
1121      */
1122     public boolean isUseCache()
1123     {
1124         return useCache;
1125     }
1126 
1127     /**
1128      * @param useCache {@link #useCache}
1129      */
1130     public void setUseCache( boolean useCache )
1131     {
1132         this.useCache = useCache;
1133     }
1134 
1135     /**
1136      * @return {@link #archive}
1137      */
1138     public MavenArchiveConfiguration getArchive()
1139     {
1140         return archive;
1141     }
1142 
1143     /**
1144      * @return {@link #nonFilteredFileExtensions}
1145      */
1146     public List<String> getNonFilteredFileExtensions()
1147     {
1148         return nonFilteredFileExtensions;
1149     }
1150 
1151     /**
1152      * @param nonFilteredFileExtensions {@link #nonFilteredFileExtensions}
1153      */
1154     public void setNonFilteredFileExtensions( List<String> nonFilteredFileExtensions )
1155     {
1156         this.nonFilteredFileExtensions = nonFilteredFileExtensions;
1157     }
1158 
1159     /**
1160      * @return {@link #artifactFactory}
1161      */
1162     public ArtifactFactory getArtifactFactory()
1163     {
1164         return this.artifactFactory;
1165     }
1166 
1167     /**
1168      * @param artifactFactory {@link #artifactFactory}
1169      */
1170     public void setArtifactFactory( ArtifactFactory artifactFactory )
1171     {
1172         this.artifactFactory = artifactFactory;
1173     }
1174 
1175     /**
1176      * @return {@link #session}
1177      */
1178     protected MavenSession getSession()
1179     {
1180         return this.session;
1181     }
1182 
1183     /**
1184      * @return {@link #recompressZippedFiles}
1185      */
1186     protected boolean isRecompressZippedFiles()
1187     {
1188         return recompressZippedFiles;
1189     }
1190 
1191     /**
1192      * @return {@link #includeEmptyDirectories}
1193      */
1194     protected boolean isIncludeEmptyDirectories()
1195     {
1196         return includeEmptyDirectories;
1197     }
1198 }