Coverage Report - org.apache.maven.plugin.war.AbstractWarMojo
 
Classes in this File Line Coverage Branch Coverage Complexity
AbstractWarMojo
68%
90/131
85%
24/28
1,267
AbstractWarMojo$DefaultWarPackagingContext
80%
28/35
66%
4/6
1,267
 
 1  
 package org.apache.maven.plugin.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 org.apache.maven.archiver.MavenArchiveConfiguration;
 23  
 import org.apache.maven.artifact.factory.ArtifactFactory;
 24  
 import org.apache.maven.execution.MavenSession;
 25  
 import org.apache.maven.model.Resource;
 26  
 import org.apache.maven.plugin.AbstractMojo;
 27  
 import org.apache.maven.plugin.MojoExecutionException;
 28  
 import org.apache.maven.plugin.MojoFailureException;
 29  
 import org.apache.maven.plugin.logging.Log;
 30  
 import org.apache.maven.plugin.war.overlay.OverlayManager;
 31  
 import org.apache.maven.plugin.war.packaging.DependenciesAnalysisPackagingTask;
 32  
 import org.apache.maven.plugin.war.packaging.OverlayPackagingTask;
 33  
 import org.apache.maven.plugin.war.packaging.SaveWebappStructurePostPackagingTask;
 34  
 import org.apache.maven.plugin.war.packaging.WarPackagingContext;
 35  
 import org.apache.maven.plugin.war.packaging.WarPackagingTask;
 36  
 import org.apache.maven.plugin.war.packaging.WarPostPackagingTask;
 37  
 import org.apache.maven.plugin.war.packaging.WarProjectPackagingTask;
 38  
 import org.apache.maven.plugin.war.util.WebappStructure;
 39  
 import org.apache.maven.plugin.war.util.WebappStructureSerializer;
 40  
 import org.apache.maven.plugins.annotations.Component;
 41  
 import org.apache.maven.plugins.annotations.Parameter;
 42  
 import org.apache.maven.project.MavenProject;
 43  
 import org.apache.maven.shared.filtering.MavenFileFilter;
 44  
 import org.apache.maven.shared.filtering.MavenFilteringException;
 45  
 import org.apache.maven.shared.filtering.MavenResourcesExecution;
 46  
 import org.apache.maven.shared.filtering.MavenResourcesFiltering;
 47  
 import org.codehaus.plexus.archiver.Archiver;
 48  
 import org.codehaus.plexus.archiver.jar.JarArchiver;
 49  
 import org.codehaus.plexus.archiver.manager.ArchiverManager;
 50  
 import org.codehaus.plexus.util.FileUtils;
 51  
 import org.codehaus.plexus.util.StringUtils;
 52  
 
 53  
 import java.io.File;
 54  
 import java.io.IOException;
 55  
 import java.util.ArrayList;
 56  
 import java.util.Arrays;
 57  
 import java.util.Collections;
 58  
 import java.util.List;
 59  
 
 60  
 /**
 61  
  * Contains common jobs for WAR mojos.
 62  
  *
 63  
  * @version $Id: AbstractWarMojo.java 1391186 2012-09-27 19:36:49Z krosenvold $
 64  
  */
 65  1884
 public abstract class AbstractWarMojo
 66  
     extends AbstractMojo
 67  
 {
 68  
     public static final String DEFAULT_FILE_NAME_MAPPING = "@{artifactId}@-@{version}@.@{extension}@";
 69  
 
 70  
     public static final String DEFAULT_FILE_NAME_MAPPING_CLASSIFIER =
 71  
         "@{artifactId}@-@{version}@-@{classifier}@.@{extension}@";
 72  
 
 73  2
     private static final String[] EMPTY_STRING_ARRAY = {};
 74  
 
 75  
     private static final String META_INF = "META-INF";
 76  
 
 77  
     private static final String WEB_INF = "WEB-INF";
 78  
 
 79  
     /**
 80  
      * The Maven project.
 81  
      */
 82  
     @Component
 83  
     private MavenProject project;
 84  
 
 85  
     /**
 86  
      * The directory containing compiled classes.
 87  
      */
 88  
     @Parameter( defaultValue = "${project.build.outputDirectory}", required = true, readonly = true )
 89  
     private File classesDirectory;
 90  
 
 91  
     /**
 92  
      * Whether a JAR file will be created for the classes in the webapp. Using this optional configuration
 93  
      * parameter will make the compiled classes to be archived into a JAR file
 94  
      * and the classes directory will then be excluded from the webapp.
 95  
      *
 96  
      * @since 2.0.1
 97  
      */
 98  
     @Parameter( property = "archiveClasses", defaultValue = "false" )
 99  
     private boolean archiveClasses;
 100  
 
 101  
     /**
 102  
      * The encoding to use when copying filtered web resources.
 103  
      *
 104  
      * @since 2.3
 105  
      */
 106  
     @Parameter( property = "resourceEncoding", defaultValue = "${project.build.sourceEncoding}" )
 107  
     private String resourceEncoding;
 108  
 
 109  
     /**
 110  
      * The JAR archiver needed for archiving the classes directory into a JAR file under WEB-INF/lib.
 111  
      */
 112  
     @Component( role = Archiver.class, hint = "jar" )
 113  
     private JarArchiver jarArchiver;
 114  
 
 115  
     /**
 116  
      * The directory where the webapp is built.
 117  
      */
 118  
     @Parameter( defaultValue = "${project.build.directory}/${project.build.finalName}", required = true )
 119  
     private File webappDirectory;
 120  
 
 121  
     /**
 122  
      * Single directory for extra files to include in the WAR. This is where
 123  
      * you place your JSP files.
 124  
      */
 125  
     @Parameter( defaultValue = "${basedir}/src/main/webapp", required = true )
 126  
     private File warSourceDirectory;
 127  
 
 128  
     /**
 129  
      * The list of webResources we want to transfer.
 130  
      */
 131  
     @Parameter
 132  
     private Resource[] webResources;
 133  
 
 134  
     /**
 135  
      * Filters (property files) to include during the interpolation of the pom.xml.
 136  
      */
 137  
     @Parameter
 138  
     private List<String> filters;
 139  
 
 140  
     /**
 141  
      * The path to the web.xml file to use.
 142  
      */
 143  
     @Parameter( property = "maven.war.webxml" )
 144  
     private File webXml;
 145  
 
 146  
     /**
 147  
      * The path to a configuration file for the servlet container. Note that
 148  
      * the file name may be different for different servlet containers.
 149  
      * Apache Tomcat uses a configuration file named context.xml. The file will
 150  
      * be copied to the META-INF directory.
 151  
      */
 152  
     @Parameter( property = "maven.war.containerConfigXML" )
 153  
     private File containerConfigXML;
 154  
 
 155  
     /**
 156  
      * Directory to unpack dependent WARs into if needed.
 157  
      */
 158  
     @Parameter( defaultValue = "${project.build.directory}/war/work", required = true )
 159  
     private File workDirectory;
 160  
 
 161  
     /**
 162  
      * The file name mapping to use when copying libraries and TLDs. If no file mapping is
 163  
      * set (default) the files are copied with their standard names.
 164  
      *
 165  
      * @since 2.1-alpha-1
 166  
      */
 167  
     @Parameter
 168  
     private String outputFileNameMapping;
 169  
 
 170  
     /**
 171  
      * The file containing the webapp structure cache.
 172  
      *
 173  
      * @since 2.1-alpha-1
 174  
      */
 175  
     @Parameter( defaultValue = "${project.build.directory}/war/work/webapp-cache.xml", required = true )
 176  
     private File cacheFile;
 177  
 
 178  
     /**
 179  
      * Whether the cache should be used to save the status of the webapp
 180  
      * across multiple runs. Experimental feature so disabled by default.
 181  
      *
 182  
      * @since 2.1-alpha-1
 183  
      */
 184  
     @Parameter( property = "useCache", defaultValue = "false" )
 185  126
     private boolean useCache = false;
 186  
 
 187  
     /**
 188  
      */
 189  
     @Component( role = ArtifactFactory.class )
 190  
     private ArtifactFactory artifactFactory;
 191  
 
 192  
     /**
 193  
      * To look up Archiver/UnArchiver implementations.
 194  
      */
 195  
     @Component( role = ArchiverManager.class )
 196  
     private ArchiverManager archiverManager;
 197  
 
 198  
     /**
 199  
      */
 200  
     @Component( role = MavenFileFilter.class, hint = "default" )
 201  
     private MavenFileFilter mavenFileFilter;
 202  
 
 203  
     /**
 204  
      */
 205  
     @Component( role = MavenResourcesFiltering.class, hint = "default" )
 206  
     private MavenResourcesFiltering mavenResourcesFiltering;
 207  
 
 208  
     /**
 209  
      * The comma separated list of tokens to include when copying the content
 210  
      * of the warSourceDirectory.
 211  
      */
 212  
     @Parameter( alias = "includes", defaultValue = "**" )
 213  
     private String warSourceIncludes;
 214  
 
 215  
     /**
 216  
      * The comma separated list of tokens to exclude when copying the content
 217  
      * of the warSourceDirectory.
 218  
      */
 219  
     @Parameter( alias = "excludes" )
 220  
     private String warSourceExcludes;
 221  
 
 222  
     /**
 223  
      * The comma separated list of tokens to include when doing
 224  
      * a WAR overlay.
 225  
      * Default is '**'
 226  
      *
 227  
      * @deprecated Use &lt;overlay&gt;/&lt;includes&gt; instead
 228  
      */
 229  
     @Parameter
 230  126
     private String dependentWarIncludes = "**/**";
 231  
 
 232  
     /**
 233  
      * The comma separated list of tokens to exclude when doing
 234  
      * a WAR overlay.
 235  
      *
 236  
      * @deprecated Use &lt;overlay&gt;/&lt;excludes&gt; instead
 237  
      */
 238  
     @Parameter
 239  126
     private String dependentWarExcludes = "META-INF/**";
 240  
 
 241  
     /**
 242  
      * The overlays to apply.
 243  
      *
 244  
      * Each &lt;overlay&gt; element may contain:
 245  
      * <ul>
 246  
      *     <li>id (defaults to <tt>currentBuild</tt>)</li>
 247  
      *     <li>groupId (if this and artifactId are null, then the current project is treated as its own overlay)</li>
 248  
      *     <li>artifactId (see above)</li>
 249  
      *     <li>classifier</li>
 250  
      *     <li>type</li>
 251  
      *     <li>includes (a list of string patterns)</li>
 252  
      *     <li>excludes (a list of string patterns)</li>
 253  
      *     <li>filtered (defaults to false)</li>
 254  
      *     <li>skip (defaults to false)</li>
 255  
      *     <li>targetPath (defaults to root of webapp structure)</li>
 256  
      *
 257  
      * </ul>
 258  
      *
 259  
      *
 260  
      *
 261  
      * @since 2.1-alpha-1
 262  
      */
 263  
     @Parameter
 264  126
     private List<Overlay> overlays = new ArrayList<Overlay>();
 265  
 
 266  
     /**
 267  
      * A list of file extensions that should not be filtered.
 268  
      * <b>Will be used when filtering webResources and overlays.</b>
 269  
      *
 270  
      * @since 2.1-alpha-2
 271  
      */
 272  
     @Parameter
 273  
     private List<String> nonFilteredFileExtensions;
 274  
 
 275  
     /**
 276  
      * @since 2.1-alpha-2
 277  
      */
 278  
     @Component
 279  
     private MavenSession session;
 280  
 
 281  
     /**
 282  
      * To filter deployment descriptors. <b>Disabled by default.</b>
 283  
      *
 284  
      * @since 2.1-alpha-2
 285  
      */
 286  
     @Parameter( property = "maven.war.filteringDeploymentDescriptors", defaultValue = "false" )
 287  126
     private boolean filteringDeploymentDescriptors = false;
 288  
 
 289  
     /**
 290  
      * To escape interpolated values with Windows path
 291  
      * <code>c:\foo\bar</code> will be replaced with <code>c:\\foo\\bar</code>.
 292  
      *
 293  
      * @since 2.1-alpha-2
 294  
      */
 295  
     @Parameter( property = "maven.war.escapedBackslashesInFilePath", defaultValue = "false" )
 296  126
     private boolean escapedBackslashesInFilePath = false;
 297  
 
 298  
     /**
 299  
      * Expression preceded with this String won't be interpolated.
 300  
      * <code>\${foo}</code> will be replaced with <code>${foo}</code>.
 301  
      *
 302  
      * @since 2.1-beta-1
 303  
      */
 304  
     @Parameter( property = "maven.war.escapeString" )
 305  
     protected String escapeString;
 306  
 
 307  
     /**
 308  
      * Indicates if zip archives (jar,zip etc) being added to the war should be
 309  
      * compressed again. Compressing again can result in smaller archive size, but
 310  
      * gives noticeably longer execution time.
 311  
      *
 312  
      * @since 2.3
 313  
      */
 314  
     @Parameter( defaultValue = "false" )
 315  
     private boolean recompressZippedFiles;
 316  
 
 317  
     /**
 318  
      * The archive configuration to use.
 319  
      * See <a href="http://maven.apache.org/shared/maven-archiver/index.html">Maven Archiver Reference</a>.
 320  
      */
 321  
     @Parameter
 322  126
     private MavenArchiveConfiguration archive = new MavenArchiveConfiguration();
 323  
 
 324  126
     private final WebappStructureSerializer webappStructureSerialier = new WebappStructureSerializer();
 325  
 
 326  126
     private final Overlay currentProjectOverlay = Overlay.createInstance();
 327  
 
 328  
 
 329  
     public Overlay getCurrentProjectOverlay()
 330  
     {
 331  6
         return currentProjectOverlay;
 332  
     }
 333  
 
 334  
     /**
 335  
      * Returns a string array of the excludes to be used
 336  
      * when copying the content of the WAR source directory.
 337  
      *
 338  
      * @return an array of tokens to exclude
 339  
      */
 340  
     protected String[] getExcludes()
 341  
     {
 342  122
         List<String> excludeList = new ArrayList<String>();
 343  122
         if ( StringUtils.isNotEmpty( warSourceExcludes ) )
 344  
         {
 345  2
             excludeList.addAll( Arrays.asList( StringUtils.split( warSourceExcludes, "," ) ) );
 346  
         }
 347  
 
 348  
         // if webXML is specified, omit the one in the source directory
 349  122
         if ( webXml != null && StringUtils.isNotEmpty( webXml.getName() ) )
 350  
         {
 351  46
             excludeList.add( "**/" + WEB_INF + "/web.xml" );
 352  
         }
 353  
 
 354  
         // if contextXML is specified, omit the one in the source directory
 355  122
         if ( containerConfigXML != null && StringUtils.isNotEmpty( containerConfigXML.getName() ) )
 356  
         {
 357  4
             excludeList.add( "**/" + META_INF + "/" + containerConfigXML.getName() );
 358  
         }
 359  
 
 360  122
         return (String[]) excludeList.toArray( EMPTY_STRING_ARRAY );
 361  
     }
 362  
 
 363  
     /**
 364  
      * Returns a string array of the includes to be used
 365  
      * when assembling/copying the WAR.
 366  
      *
 367  
      * @return an array of tokens to include
 368  
      */
 369  
     protected String[] getIncludes()
 370  
     {
 371  122
         return StringUtils.split( StringUtils.defaultString( warSourceIncludes ), "," );
 372  
     }
 373  
 
 374  
     /**
 375  
      * Returns a string array of the excludes to be used
 376  
      * when adding dependent WAR as an overlay onto this WAR.
 377  
      *
 378  
      * @return an array of tokens to exclude
 379  
      */
 380  
     protected String[] getDependentWarExcludes()
 381  
     {
 382  
         String[] excludes;
 383  0
         if ( StringUtils.isNotEmpty( dependentWarExcludes ) )
 384  
         {
 385  0
             excludes = StringUtils.split( dependentWarExcludes, "," );
 386  
         }
 387  
         else
 388  
         {
 389  0
             excludes = EMPTY_STRING_ARRAY;
 390  
         }
 391  0
         return excludes;
 392  
     }
 393  
 
 394  
     /**
 395  
      * Returns a string array of the includes to be used
 396  
      * when adding dependent WARs as an overlay onto this WAR.
 397  
      *
 398  
      * @return an array of tokens to include
 399  
      */
 400  
     protected String[] getDependentWarIncludes()
 401  
     {
 402  0
         return StringUtils.split( StringUtils.defaultString( dependentWarIncludes ), "," );
 403  
     }
 404  
 
 405  
     public void buildExplodedWebapp( File webappDirectory )
 406  
         throws MojoExecutionException, MojoFailureException
 407  
     {
 408  124
         webappDirectory.mkdirs();
 409  
 
 410  
         try
 411  
         {
 412  124
             buildWebapp( project, webappDirectory );
 413  
         }
 414  0
         catch ( IOException e )
 415  
         {
 416  0
             throw new MojoExecutionException( "Could not build webapp", e );
 417  124
         }
 418  124
     }
 419  
 
 420  
 
 421  
     /**
 422  
      * Builds the webapp for the specified project with the new packaging task
 423  
      * thingy
 424  
      * <p/>
 425  
      * Classes, libraries and tld files are copied to
 426  
      * the <tt>webappDirectory</tt> during this phase.
 427  
      *
 428  
      * @param project         the maven project
 429  
      * @param webappDirectory the target directory
 430  
      * @throws MojoExecutionException if an error occurred while packaging the webapp
 431  
      * @throws MojoFailureException   if an unexpected error occurred while packaging the webapp
 432  
      * @throws IOException            if an error occurred while copying the files
 433  
      */
 434  
     @SuppressWarnings( "unchecked" )
 435  
     public void buildWebapp( MavenProject project, File webappDirectory )
 436  
         throws MojoExecutionException, MojoFailureException, IOException
 437  
     {
 438  
 
 439  
         WebappStructure cache;
 440  124
         if ( useCache && cacheFile.exists() )
 441  
         {
 442  16
             cache = new WebappStructure( project.getDependencies(), webappStructureSerialier.fromXml( cacheFile ) );
 443  
         }
 444  
         else
 445  
         {
 446  108
             cache = new WebappStructure( project.getDependencies(), null );
 447  
         }
 448  
 
 449  124
         final long startTime = System.currentTimeMillis();
 450  124
         getLog().info( "Assembling webapp [" + project.getArtifactId() + "] in [" + webappDirectory + "]" );
 451  
 
 452  124
         final OverlayManager overlayManager =
 453  
             new OverlayManager( overlays, project, dependentWarIncludes, dependentWarExcludes, currentProjectOverlay );
 454  124
         final List<WarPackagingTask> packagingTasks = getPackagingTasks( overlayManager );
 455  124
         List<FileUtils.FilterWrapper> defaultFilterWrappers = null;
 456  
         try
 457  
         {
 458  124
             MavenResourcesExecution mavenResourcesExecution = new MavenResourcesExecution();
 459  124
             mavenResourcesExecution.setEscapeString( escapeString );
 460  
 
 461  124
             defaultFilterWrappers = mavenFileFilter.getDefaultFilterWrappers( project, filters,
 462  
                                                                               escapedBackslashesInFilePath,
 463  
                                                                               this.session, mavenResourcesExecution );
 464  
 
 465  
         }
 466  0
         catch ( MavenFilteringException e )
 467  
         {
 468  0
             getLog().error( "fail to build filering wrappers " + e.getMessage() );
 469  0
             throw new MojoExecutionException( e.getMessage(), e );
 470  124
         }
 471  
 
 472  124
         final WarPackagingContext context = new DefaultWarPackagingContext( webappDirectory, cache, overlayManager,
 473  
                                                                             defaultFilterWrappers,
 474  
                                                                             getNonFilteredFileExtensions(),
 475  
                                                                             filteringDeploymentDescriptors,
 476  
                                                                             this.artifactFactory, resourceEncoding);
 477  124
         for ( WarPackagingTask warPackagingTask : packagingTasks )
 478  
         {
 479  216
             warPackagingTask.performPackaging( context );
 480  
         }
 481  
 
 482  
         // Post packaging
 483  124
         final List<WarPostPackagingTask> postPackagingTasks = getPostPackagingTasks();
 484  124
         for( WarPostPackagingTask task  : postPackagingTasks )
 485  
         {
 486  24
             task.performPostPackaging( context );
 487  
         }
 488  124
         getLog().info( "Webapp assembled in [" + ( System.currentTimeMillis() - startTime ) + " msecs]" );
 489  
 
 490  124
     }
 491  
 
 492  
     /**
 493  
      * Returns a <tt>List</tt> of the {@link org.apache.maven.plugin.war.packaging.WarPackagingTask}
 494  
      * instances to invoke to perform the packaging.
 495  
      *
 496  
      * @param overlayManager the overlay manager
 497  
      * @return the list of packaging tasks
 498  
      * @throws MojoExecutionException if the packaging tasks could not be built
 499  
      */
 500  
     private List<WarPackagingTask> getPackagingTasks( OverlayManager overlayManager )
 501  
         throws MojoExecutionException
 502  
     {
 503  124
         final List<WarPackagingTask> packagingTasks = new ArrayList<WarPackagingTask>();
 504  124
         if ( useCache )
 505  
         {
 506  24
             packagingTasks.add( new DependenciesAnalysisPackagingTask() );
 507  
         }
 508  
 
 509  124
         final List<Overlay> resolvedOverlays = overlayManager.getOverlays();
 510  124
         for ( Overlay overlay : resolvedOverlays )
 511  
         {
 512  192
             if ( overlay.isCurrentProject() )
 513  
             {
 514  124
                 packagingTasks.add( new WarProjectPackagingTask( webResources, webXml, containerConfigXML,
 515  
                                                                  currentProjectOverlay ) );
 516  
             }
 517  
             else
 518  
             {
 519  68
                 packagingTasks.add( new OverlayPackagingTask( overlay, currentProjectOverlay ) );
 520  
             }
 521  
         }
 522  124
         return packagingTasks;
 523  
     }
 524  
 
 525  
 
 526  
     /**
 527  
      * Returns a <tt>List</tt> of the {@link org.apache.maven.plugin.war.packaging.WarPostPackagingTask}
 528  
      * instances to invoke to perform the post-packaging.
 529  
      *
 530  
      * @return the list of post packaging tasks
 531  
      */
 532  
     private List<WarPostPackagingTask> getPostPackagingTasks()
 533  
     {
 534  124
         final List<WarPostPackagingTask> postPackagingTasks = new ArrayList<WarPostPackagingTask>();
 535  124
         if ( useCache )
 536  
         {
 537  24
             postPackagingTasks.add( new SaveWebappStructurePostPackagingTask( cacheFile ) );
 538  
         }
 539  
         // TODO add lib scanning to detect duplicates
 540  124
         return postPackagingTasks;
 541  
     }
 542  
 
 543  
     /**
 544  
      * WarPackagingContext default implementation
 545  
      */
 546  126
     private class DefaultWarPackagingContext
 547  
         implements WarPackagingContext
 548  
     {
 549  
 
 550  
         private final ArtifactFactory artifactFactory;
 551  
 
 552  
         private final String resourceEncoding;
 553  
 
 554  
         private final WebappStructure webappStructure;
 555  
 
 556  
         private final File webappDirectory;
 557  
 
 558  
         private final OverlayManager overlayManager;
 559  
 
 560  
         private final List<FileUtils.FilterWrapper> filterWrappers;
 561  
 
 562  
         private List<String> nonFilteredFileExtensions;
 563  
 
 564  
         private boolean filteringDeploymentDescriptors;
 565  
 
 566  
         public DefaultWarPackagingContext( File webappDirectory, final WebappStructure webappStructure,
 567  
                                            final OverlayManager overlayManager, List<FileUtils.FilterWrapper> filterWrappers,
 568  
                                            List<String> nonFilteredFileExtensions, boolean filteringDeploymentDescriptors,
 569  
                                            ArtifactFactory artifactFactory, String resourceEncoding )
 570  124
         {
 571  124
             this.webappDirectory = webappDirectory;
 572  124
             this.webappStructure = webappStructure;
 573  124
             this.overlayManager = overlayManager;
 574  124
             this.filterWrappers = filterWrappers;
 575  124
             this.artifactFactory = artifactFactory;
 576  124
             this.filteringDeploymentDescriptors = filteringDeploymentDescriptors;
 577  124
             this.nonFilteredFileExtensions = nonFilteredFileExtensions == null ? Collections.<String>emptyList()
 578  
                                                                               : nonFilteredFileExtensions;
 579  124
             this.resourceEncoding = resourceEncoding;
 580  
             // This is kinda stupid but if we loop over the current overlays and we request the path structure
 581  
             // it will register it. This will avoid wrong warning messages in a later phase
 582  124
             for ( String overlayId : overlayManager.getOverlayIds() )
 583  
             {
 584  192
                 webappStructure.getStructure( overlayId );
 585  
             }
 586  124
         }
 587  
 
 588  
         public MavenProject getProject()
 589  
         {
 590  124
             return project;
 591  
         }
 592  
 
 593  
         public File getWebappDirectory()
 594  
         {
 595  1274
             return webappDirectory;
 596  
         }
 597  
 
 598  
         public File getClassesDirectory()
 599  
         {
 600  496
             return classesDirectory;
 601  
         }
 602  
 
 603  
         public Log getLog()
 604  
         {
 605  2020
             return AbstractWarMojo.this.getLog();
 606  
         }
 607  
 
 608  
         public String getOutputFileNameMapping()
 609  
         {
 610  232
             return outputFileNameMapping;
 611  
         }
 612  
 
 613  
         public File getWebappSourceDirectory()
 614  
         {
 615  692
             return warSourceDirectory;
 616  
         }
 617  
 
 618  
         public String[] getWebappSourceIncludes()
 619  
         {
 620  122
             return getIncludes();
 621  
         }
 622  
 
 623  
         public String[] getWebappSourceExcludes()
 624  
         {
 625  122
             return getExcludes();
 626  
         }
 627  
 
 628  
         public boolean archiveClasses()
 629  
         {
 630  124
             return archiveClasses;
 631  
         }
 632  
 
 633  
         public File getOverlaysWorkDirectory()
 634  
         {
 635  66
             return workDirectory;
 636  
         }
 637  
 
 638  
         public ArchiverManager getArchiverManager()
 639  
         {
 640  0
             return archiverManager;
 641  
         }
 642  
 
 643  
         public MavenArchiveConfiguration getArchive()
 644  
         {
 645  0
             return archive;
 646  
         }
 647  
 
 648  
         public JarArchiver getJarArchiver()
 649  
         {
 650  0
             return jarArchiver;
 651  
         }
 652  
 
 653  
         public List<String> getFilters()
 654  
         {
 655  0
             return filters;
 656  
         }
 657  
 
 658  
         public WebappStructure getWebappStructure()
 659  
         {
 660  1074
             return webappStructure;
 661  
         }
 662  
 
 663  
         public List<String> getOwnerIds()
 664  
         {
 665  0
             return overlayManager.getOverlayIds();
 666  
         }
 667  
 
 668  
         public MavenFileFilter getMavenFileFilter()
 669  
         {
 670  12
             return mavenFileFilter;
 671  
         }
 672  
 
 673  
         public List<FileUtils.FilterWrapper> getFilterWrappers()
 674  
         {
 675  12
             return filterWrappers;
 676  
         }
 677  
 
 678  
         public boolean isNonFilteredExtension( String fileName )
 679  
         {
 680  12
             return !mavenResourcesFiltering.filteredFileExtension( fileName, nonFilteredFileExtensions );
 681  
         }
 682  
 
 683  
         public boolean isFilteringDeploymentDescriptors()
 684  
         {
 685  50
             return filteringDeploymentDescriptors;
 686  
         }
 687  
 
 688  
         public ArtifactFactory getArtifactFactory()
 689  
         {
 690  0
             return this.artifactFactory;
 691  
         }
 692  
 
 693  
         public MavenSession getSession()
 694  
         {
 695  0
             return session;
 696  
         }
 697  
 
 698  
         public String getResourceEncoding()
 699  
         {
 700  12
             return resourceEncoding;
 701  
         }
 702  
     }
 703  
 
 704  
     public MavenProject getProject()
 705  
     {
 706  78
         return project;
 707  
     }
 708  
 
 709  
     public void setProject( MavenProject project )
 710  
     {
 711  128
         this.project = project;
 712  128
     }
 713  
 
 714  
     public File getClassesDirectory()
 715  
     {
 716  0
         return classesDirectory;
 717  
     }
 718  
 
 719  
     public void setClassesDirectory( File classesDirectory )
 720  
     {
 721  116
         this.classesDirectory = classesDirectory;
 722  116
     }
 723  
 
 724  
     public File getWebappDirectory()
 725  
     {
 726  186
         return webappDirectory;
 727  
     }
 728  
 
 729  
     public void setWebappDirectory( File webappDirectory )
 730  
     {
 731  116
         this.webappDirectory = webappDirectory;
 732  116
     }
 733  
 
 734  
     public File getWarSourceDirectory()
 735  
     {
 736  14
         return warSourceDirectory;
 737  
     }
 738  
 
 739  
     public void setWarSourceDirectory( File warSourceDirectory )
 740  
     {
 741  128
         this.warSourceDirectory = warSourceDirectory;
 742  128
     }
 743  
 
 744  
     public File getWebXml()
 745  
     {
 746  16
         return webXml;
 747  
     }
 748  
 
 749  
     public void setWebXml( File webXml )
 750  
     {
 751  38
         this.webXml = webXml;
 752  38
     }
 753  
 
 754  
     public File getContainerConfigXML()
 755  
     {
 756  0
         return containerConfigXML;
 757  
     }
 758  
 
 759  
     public void setContainerConfigXML( File containerConfigXML )
 760  
     {
 761  4
         this.containerConfigXML = containerConfigXML;
 762  4
     }
 763  
 
 764  
     public String getOutputFileNameMapping()
 765  
     {
 766  0
         return outputFileNameMapping;
 767  
     }
 768  
 
 769  
     public void setOutputFileNameMapping( String outputFileNameMapping )
 770  
     {
 771  4
         this.outputFileNameMapping = outputFileNameMapping;
 772  4
     }
 773  
 
 774  
     public List<Overlay> getOverlays()
 775  
     {
 776  0
         return overlays;
 777  
     }
 778  
 
 779  
     public void setOverlays( List<Overlay> overlays )
 780  
     {
 781  16
         this.overlays = overlays;
 782  16
     }
 783  
 
 784  
     public void addOverlay( Overlay overlay )
 785  
     {
 786  26
         overlays.add( overlay );
 787  26
     }
 788  
 
 789  
     public boolean isArchiveClasses()
 790  
     {
 791  4
         return archiveClasses;
 792  
     }
 793  
 
 794  
     public void setArchiveClasses( boolean archiveClasses )
 795  
     {
 796  0
         this.archiveClasses = archiveClasses;
 797  0
     }
 798  
 
 799  
     public JarArchiver getJarArchiver()
 800  
     {
 801  4
         return jarArchiver;
 802  
     }
 803  
 
 804  
     public void setJarArchiver( JarArchiver jarArchiver )
 805  
     {
 806  0
         this.jarArchiver = jarArchiver;
 807  0
     }
 808  
 
 809  
     public Resource[] getWebResources()
 810  
     {
 811  0
         return webResources;
 812  
     }
 813  
 
 814  
     public void setWebResources( Resource[] webResources )
 815  
     {
 816  0
         this.webResources = webResources;
 817  0
     }
 818  
 
 819  
     public List<String> getFilters()
 820  
     {
 821  0
         return filters;
 822  
     }
 823  
 
 824  
     public void setFilters( List<String> filters )
 825  
     {
 826  0
         this.filters = filters;
 827  0
     }
 828  
 
 829  
     public File getWorkDirectory()
 830  
     {
 831  28
         return workDirectory;
 832  
     }
 833  
 
 834  
     public void setWorkDirectory( File workDirectory )
 835  
     {
 836  0
         this.workDirectory = workDirectory;
 837  0
     }
 838  
 
 839  
     public File getCacheFile()
 840  
     {
 841  0
         return cacheFile;
 842  
     }
 843  
 
 844  
     public void setCacheFile( File cacheFile )
 845  
     {
 846  0
         this.cacheFile = cacheFile;
 847  0
     }
 848  
 
 849  
     public String getWarSourceIncludes()
 850  
     {
 851  0
         return warSourceIncludes;
 852  
     }
 853  
 
 854  
     public void setWarSourceIncludes( String warSourceIncludes )
 855  
     {
 856  0
         this.warSourceIncludes = warSourceIncludes;
 857  0
     }
 858  
 
 859  
     public String getWarSourceExcludes()
 860  
     {
 861  0
         return warSourceExcludes;
 862  
     }
 863  
 
 864  
     public void setWarSourceExcludes( String warSourceExcludes )
 865  
     {
 866  0
         this.warSourceExcludes = warSourceExcludes;
 867  0
     }
 868  
 
 869  
 
 870  
     public boolean isUseCache()
 871  
     {
 872  0
         return useCache;
 873  
     }
 874  
 
 875  
     public void setUseCache( boolean useCache )
 876  
     {
 877  8
         this.useCache = useCache;
 878  8
     }
 879  
 
 880  
     public MavenArchiveConfiguration getArchive()
 881  
     {
 882  44
         return archive;
 883  
     }
 884  
 
 885  
     public List<String> getNonFilteredFileExtensions()
 886  
     {
 887  124
         return nonFilteredFileExtensions;
 888  
     }
 889  
 
 890  
     public void setNonFilteredFileExtensions( List<String> nonFilteredFileExtensions )
 891  
     {
 892  0
         this.nonFilteredFileExtensions = nonFilteredFileExtensions;
 893  0
     }
 894  
 
 895  
     public ArtifactFactory getArtifactFactory()
 896  
     {
 897  0
         return this.artifactFactory;
 898  
     }
 899  
 
 900  
     public void setArtifactFactory( ArtifactFactory artifactFactory )
 901  
     {
 902  0
         this.artifactFactory = artifactFactory;
 903  0
     }
 904  
     
 905  
     protected MavenSession getSession()
 906  
     {
 907  44
         return this.session;
 908  
     }
 909  
 
 910  
     protected boolean isRecompressZippedFiles()
 911  
     {
 912  30
         return recompressZippedFiles;
 913  
     }
 914  
 }