View Javadoc
1   package org.apache.maven.plugin.assembly.mojos;
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.repository.ArtifactRepository;
24  import org.apache.maven.execution.MavenSession;
25  import org.apache.maven.plugin.AbstractMojo;
26  import org.apache.maven.plugin.MojoExecutionException;
27  import org.apache.maven.plugin.MojoFailureException;
28  import org.apache.maven.plugin.assembly.AssemblerConfigurationSource;
29  import org.apache.maven.plugin.assembly.InvalidAssemblerConfigurationException;
30  import org.apache.maven.plugin.assembly.archive.ArchiveCreationException;
31  import org.apache.maven.plugin.assembly.archive.AssemblyArchiver;
32  import org.apache.maven.plugin.assembly.format.AssemblyFormattingException;
33  import org.apache.maven.plugin.assembly.io.AssemblyReadException;
34  import org.apache.maven.plugin.assembly.io.AssemblyReader;
35  import org.apache.maven.plugin.assembly.model.Assembly;
36  import org.apache.maven.plugin.assembly.utils.AssemblyFormatUtils;
37  import org.apache.maven.plugin.assembly.utils.InterpolationConstants;
38  import org.apache.maven.plugin.logging.Log;
39  import org.apache.maven.plugins.annotations.Component;
40  import org.apache.maven.plugins.annotations.Parameter;
41  import org.apache.maven.project.MavenProject;
42  import org.apache.maven.project.MavenProjectHelper;
43  import org.apache.maven.shared.filtering.MavenReaderFilter;
44  import org.apache.maven.shared.utils.cli.CommandLineUtils;
45  import org.codehaus.plexus.configuration.PlexusConfiguration;
46  import org.codehaus.plexus.interpolation.fixed.FixedStringSearchInterpolator;
47  import org.codehaus.plexus.interpolation.fixed.PrefixedPropertiesValueSource;
48  import org.codehaus.plexus.interpolation.fixed.PropertiesBasedValueSource;
49  
50  import javax.annotation.Nonnull;
51  import java.io.File;
52  import java.util.Collections;
53  import java.util.List;
54  import java.util.Properties;
55  
56  /**
57   * @author <a href="mailto:brett@apache.org">Brett Porter</a>
58   * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
59   * @version $Id: AbstractAssemblyMojo.java 1639422 2014-11-13 18:08:07Z krosenvold $
60   * @threadSafe
61   */
62  public abstract class AbstractAssemblyMojo
63      extends AbstractMojo
64      implements AssemblerConfigurationSource
65  {
66      /**
67       * The character encoding scheme to be applied when filtering resources.
68       */
69      @Parameter( property = "encoding", defaultValue = "${project.build.sourceEncoding}" )
70      private String encoding;
71  
72      /**
73       * Expressions preceded with this String won't be interpolated.
74       * If you use "\" as the escape string then \${foo} will be replaced with ${foo}.
75       *
76       * @since 2.4
77       */
78      @Parameter( property = "assembly.escapeString" )
79      private String escapeString;
80  
81      /**
82       * Flag allowing one or more executions of the assembly plugin to be configured as skipped for a particular build.
83       * This makes the assembly plugin more controllable from profiles.
84       */
85      @Parameter( property = "assembly.skipAssembly", defaultValue = "false" )
86      private boolean skipAssembly;
87  
88      /**
89       * If this flag is set, everything up to the call to Archiver.createArchive() will be executed.
90       */
91      @Parameter( property = "assembly.dryRun", defaultValue = "false" )
92      private boolean dryRun;
93  
94      /**
95       * If this flag is set, the ".dir" suffix will be suppressed in the output directory name when using assembly/format
96       * == 'dir' and other formats that begin with 'dir'. <br/>
97       * <b>NOTE:</b> Since 2.2-beta-3, the default-value for this is true, NOT false as it used to be.
98       */
99      @Parameter( defaultValue = "true" )
100     private boolean ignoreDirFormatExtensions;
101 
102     /**
103      * Local Maven repository where artifacts are cached during the build process.
104      */
105     @Parameter( defaultValue = "${localRepository}", required = true, readonly = true )
106     private ArtifactRepository localRepository;
107 
108     /**
109      */
110     @Parameter( defaultValue = "${project.remoteArtifactRepositories}", required = true, readonly = true )
111     private List<ArtifactRepository> remoteRepositories;
112 
113     /**
114      * Contains the full list of projects in the reactor.
115      */
116     @Parameter( defaultValue = "${reactorProjects}", required = true, readonly = true )
117     private List<MavenProject> reactorProjects;
118 
119     /**
120      * The output directory of the assembled distribution file.
121      */
122     @Parameter( defaultValue = "${project.build.directory}", required = true )
123     private File outputDirectory;
124 
125     /**
126      * The filename of the assembled distribution file.
127      */
128     @Parameter( defaultValue = "${project.build.finalName}", required = true )
129     private String finalName;
130 
131     /**
132      * Directory to unpack JARs into if needed
133      */
134     @Parameter( defaultValue = "${project.build.directory}/assembly/work", required = true )
135     private File workDirectory;
136 
137     /**
138      * Specifies the formats of the assembly.
139      * Multiple formats can be supplied and the Assembly Plugin will generate an archive for each desired formats.
140      * When deploying your project, all file formats specified will also be deployed. A format is specified by supplying
141      * one of the following
142      * values in a &lt;format&gt; subelement:
143      * <ul>
144      * <li><em>dir</em> - Creates a directory</li>
145      * <li><em>zip</em> - Creates a ZIP file format</li>
146      * <li><em>tar</em> - Creates a TAR format</li>
147      * <li><em>tar.gz</em> or <em>tgz</em> - Creates a gzip'd TAR format</li>
148      * <li><em>tar.bz2</em> or <em>tbz2</em> - Creates a bzip'd TAR format</li>
149      * </ul>
150      */
151     @Parameter
152     private List<String> formats;
153 
154     /**
155      * This is the artifact classifier to be used for the resultant assembly artifact. Normally, you would use the
156      * assembly-id instead of specifying this here.
157      *
158      * @deprecated Please use the Assembly's id for classifier instead
159      */
160     @Deprecated
161     @Parameter( property = "classifier" )
162     private String classifier;
163 
164     /**
165      * A list of descriptor files to generate from.
166      */
167     @Parameter
168     private String[] descriptors;
169 
170     /**
171      * A list of references to assembly descriptors available on the plugin's classpath. The default classpath
172      * includes these built-in descriptors: <code>bin</code>, <code>jar-with-dependencies</code>, <code>src</code>, and
173      * <code>project</code>. You can add others by adding dependencies
174      * to the plugin.
175      */
176     @Parameter
177     private String[] descriptorRefs;
178 
179     /**
180      * Directory to scan for descriptor files in. <b>NOTE:</b> This may not work correctly with assembly components.
181      */
182     @Parameter
183     private File descriptorSourceDirectory;
184 
185     /**
186      * This is the base directory from which archive files are created. This base directory pre-pended to any
187      * <code>&lt;directory&gt;</code> specifications in the assembly descriptor. This is an optional parameter.
188      */
189     @Parameter
190     private File archiveBaseDirectory;
191 
192     /**
193      * Predefined Assembly Descriptor Id's. You can select bin, jar-with-dependencies, or src.
194      *
195      * @deprecated Please use descriptorRefs instead
196      */
197     @Deprecated
198     @Parameter( property = "descriptorId" )
199     private String descriptorId;
200 
201     /**
202      * Assembly XML Descriptor file. This must be the path to your customized descriptor file.
203      *
204      * @deprecated Please use descriptors instead
205      */
206     @Deprecated
207     @Parameter( property = "descriptor" )
208     private String descriptor;
209 
210     /**
211      * Sets the TarArchiver behavior on file paths with more than 100 characters length. Valid values are: "warn"
212      * (default), "fail", "truncate", "gnu", "posix", "posix_warn" or "omit".
213      */
214     @Parameter( property = "assembly.tarLongFileMode", defaultValue = "warn" )
215     private String tarLongFileMode;
216 
217     /**
218      * Base directory of the project.
219      */
220     @Parameter( defaultValue = "${project.basedir}", required = true, readonly = true )
221     private File basedir;
222 
223     /**
224      * Maven ProjectHelper.
225      */
226     @Component
227     private MavenProjectHelper projectHelper;
228 
229     /**
230      * Maven shared filtering utility.
231      */
232     @Component
233     private MavenReaderFilter mavenReaderFilter;
234 
235     /**
236      * The Maven Session Object
237      */
238     @Parameter( defaultValue = "${session}", readonly = true, required = true )
239     private MavenSession mavenSession;
240 
241     /**
242      * Temporary directory that contain the files to be assembled.
243      */
244     @Parameter( defaultValue = "${project.build.directory}/archive-tmp", required = true, readonly = true )
245     private File tempRoot;
246 
247     /**
248      * Directory for site generated.
249      */
250     @Parameter( defaultValue = "${project.reporting.outputDirectory}", readonly = true )
251     private File siteDirectory;
252 
253     /**
254      * Set to true to include the site generated by site:site goal.
255      *
256      * @deprecated Please set this variable in the assembly descriptor instead
257      */
258     @Deprecated
259     @Parameter( property = "includeSite", defaultValue = "false" )
260     private boolean includeSite;
261 
262     /**
263      * Set to false to exclude the assembly id from the assembly final name.
264      */
265     @Parameter( property = "assembly.appendAssemblyId", defaultValue = "true" )
266     boolean appendAssemblyId;
267 
268     /**
269      * Set to true in order to not fail when a descriptor is missing.
270      */
271     @Parameter( property = "assembly.ignoreMissingDescriptor", defaultValue = "false" )
272     private boolean ignoreMissingDescriptor;
273 
274     /**
275      * This is a set of instructions to the archive builder, especially for building .jar files. It enables you to
276      * specify a Manifest file for the jar, in addition to other options.
277      * See <a href="http://maven.apache.org/shared/maven-archiver/index.html">Maven Archiver Reference</a>.
278      */
279     @Parameter
280     private MavenArchiveConfiguration archive;
281 
282     /**
283      * The list of extra filter properties files to be used along with System properties, project
284      * properties, and filter properties files specified in the POM build/filters section, which
285      * should be used for the filtering during the current mojo execution. <br/>
286      * Normally, these will be configured from a plugin's execution section, to provide a different
287      * set of filters for a particular execution.
288      */
289     @Parameter
290     private List<String> filters;
291 
292     /**
293      * If True (default) then the ${project.build.filters} are also used in addition to any
294      * further filters defined for the Assembly.
295      *
296      * @since 2.4.2
297      */
298     @Parameter( property = "assembly.includeProjectBuildFilters", defaultValue = "true" )
299     private boolean includeProjectBuildFilters;
300 
301     /**
302      * Controls whether the assembly plugin tries to attach the resulting assembly to the project.
303      *
304      * @since 2.2-beta-1
305      */
306     @Parameter( property = "assembly.attach", defaultValue = "true" )
307     private boolean attach;
308 
309     /**
310      * Indicates if zip archives (jar,zip etc) being added to the assembly should be compressed again.
311      * Compressing again can result in smaller archive size, but gives noticeably longer execution time.
312      *
313      * @since 2.4
314      */
315     @Parameter( defaultValue = "true" )
316     private boolean recompressZippedFiles;
317 
318     /**
319      */
320     @Component
321     private AssemblyArchiver assemblyArchiver;
322 
323     /**
324      */
325     @Component
326     private AssemblyReader assemblyReader;
327 
328     /**
329      * Allows additional configuration options that are specific to a particular type of archive format. This is
330      * intended to capture an XML configuration that will be used to reflectively setup the options on the archiver
331      * instance. <br/>
332      * For instance, to direct an assembly with the "ear" format to use a particular deployment descriptor, you should
333      * specify the following for the archiverConfig value in your plugin configuration: <br/>
334      * <p/>
335      * <p/>
336      * <pre>
337      * &lt;appxml&gt;${project.basedir}/somepath/app.xml&lt;/appxml&gt;
338      * </pre>
339      *
340      * @since 2.2-beta-3
341      */
342     @Parameter
343     private PlexusConfiguration archiverConfig;
344 
345     /**
346      * This will cause the assembly to run only at the top of a given module tree. That is, run in the project contained
347      * in the same folder where the mvn execution was launched.
348      *
349      * @since 2.2-beta-4
350      */
351     @Parameter( property = "assembly.runOnlyAtExecutionRoot", defaultValue = "false" )
352     private boolean runOnlyAtExecutionRoot;
353 
354     /**
355      * This will cause the assembly to only update an existing archive, if it exists.
356      * <p>
357      * <strong>Note:</strong> The property that can be used on the command line was misspelled as "assembly.updatOnly"
358      * in versions prior to version 2.4.
359      * </p>
360      *
361      * @since 2.2
362      */
363     @Parameter( property = "assembly.updateOnly", defaultValue = "false" )
364     private boolean updateOnly;
365 
366     /**
367      * <p>
368      * will use the jvm chmod, this is available for user and all level group level will be ignored As of
369      * assembly-plugin 2.5, this flag is ignored for users of java7+
370      * </p>
371      *
372      * @since 2.2
373      */
374     @Parameter( property = "assembly.useJvmChmod", defaultValue = "false" )
375     private boolean useJvmChmod;
376 
377     /**
378      * <p>
379      * Set to <code>true</code> in order to avoid all chmod calls.
380      * </p>
381      * <p/>
382      * <p>
383      * <b>NOTE:</b> This will cause the assembly plugin to <b>DISREGARD</b> all fileMode/directoryMode settings in the
384      * assembly descriptor, and all file permissions in unpacked dependencies!
385      * </p>
386      *
387      * @since 2.2
388      */
389     @Parameter( property = "assembly.ignorePermissions", defaultValue = "false" )
390     private boolean ignorePermissions;
391 
392     /**
393      * <p>
394      * Set of delimiters for expressions to filter within the resources. These delimiters are specified in the form
395      * 'beginToken*endToken'. If no '*' is given, the delimiter is assumed to be the same for start and end.
396      * </p>
397      * <p>
398      * So, the default filtering delimiters might be specified as:
399      * </p>
400      * <p/>
401      * <pre>
402      * &lt;delimiters&gt;
403      *   &lt;delimiter&gt;${*}&lt;/delimiter&gt;
404      *   &lt;delimiter&gt;@&lt;/delimiter&gt;
405      * &lt;/delimiters&gt;
406      * </pre>
407      * <p>
408      * Since the '@' delimiter is the same on both ends, we don't need to specify '@*@' (though we can).
409      * </p>
410      *
411      * @since 2.4
412      */
413     @Parameter
414     private List<String> delimiters;
415 
416     protected FixedStringSearchInterpolator commanndLinePropertiesInterpolator;
417 
418     protected FixedStringSearchInterpolator envInterpolator;
419 
420     protected FixedStringSearchInterpolator mainProjectInterpolator;
421 
422     protected FixedStringSearchInterpolator rootInterpolator;
423 
424     /**
425      * Create the binary distribution.
426      *
427      * @throws org.apache.maven.plugin.MojoExecutionException
428      */
429     public void execute()
430         throws MojoExecutionException, MojoFailureException
431     {
432 
433         if ( skipAssembly )
434         {
435             getLog().info( "Assemblies have been skipped per configuration of the skipAssembly parameter." );
436             return;
437         }
438 
439         // run only at the execution root.
440         if ( runOnlyAtExecutionRoot && !isThisTheExecutionRoot() )
441         {
442             getLog().info( "Skipping the assembly in this project because it's not the Execution Root" );
443             return;
444         }
445 
446         List<Assembly> assemblies;
447         try
448         {
449             assemblies = assemblyReader.readAssemblies( this );
450         }
451         catch ( final AssemblyReadException e )
452         {
453             throw new MojoExecutionException( "Error reading assemblies: " + e.getMessage(), e );
454         }
455         catch ( final InvalidAssemblerConfigurationException e )
456         {
457             throw new MojoFailureException( assemblyReader, e.getMessage(),
458                                             "Mojo configuration is invalid: " + e.getMessage() );
459         }
460 
461         FixedStringSearchInterpolator rootInterpolator = createRepositoryInterpolator();
462 
463         // TODO: include dependencies marked for distribution under certain formats
464         // TODO: how, might we plug this into an installer, such as NSIS?
465 
466         boolean warnedAboutMainProjectArtifact = false;
467         for ( final Assembly assembly : assemblies )
468         {
469             try
470             {
471                 final String fullName = AssemblyFormatUtils.getDistributionName( assembly, this );
472 
473                 List<String> effectiveFormats = formats;
474                 if ( effectiveFormats == null || effectiveFormats.size() == 0 )
475                 {
476                     effectiveFormats = assembly.getFormats();
477                 }
478                 if ( effectiveFormats == null || effectiveFormats.size() == 0 )
479                 {
480                     throw new MojoFailureException(
481                         "No formats specified in the execution parameters or the assembly descriptor." );
482                 }
483 
484                 for ( final String format : effectiveFormats )
485                 {
486                     final File destFile =
487                         assemblyArchiver.createArchive( assembly, fullName, format, this, isRecompressZippedFiles() );
488 
489                     final MavenProject project = getProject();
490                     final String classifier = getClassifier();
491                     final String type = project.getArtifact().getType();
492 
493                     if ( attach && destFile.isFile() )
494                     {
495                         if ( isAssemblyIdAppended() )
496                         {
497                             projectHelper.attachArtifact( project, format, assembly.getId(), destFile );
498                         }
499                         else if ( classifier != null )
500                         {
501                             projectHelper.attachArtifact( project, format, classifier, destFile );
502                         }
503                         else if ( !"pom".equals( type ) && format.equals( type ) )
504                         {
505                             if ( !warnedAboutMainProjectArtifact )
506                             {
507                                 final StringBuilder message = new StringBuilder();
508 
509                                 message.append(
510                                     "Configuration options: 'appendAssemblyId' is set to false, and 'classifier' is missing." );
511                                 message.append( "\nInstead of attaching the assembly file: " ).append(
512                                     destFile ).append( ", it will become the file for main project artifact." );
513                                 message.append(
514                                     "\nNOTE: If multiple descriptors or descriptor-formats are provided for this project, the value of this file will be non-deterministic!" );
515 
516                                 getLog().warn( message );
517                                 warnedAboutMainProjectArtifact = true;
518                             }
519 
520                             final File existingFile = project.getArtifact().getFile();
521                             if ( ( existingFile != null ) && existingFile.exists() )
522                             {
523                                 getLog().warn( "Replacing pre-existing project main-artifact file: " + existingFile
524                                                    + "\nwith assembly file: " + destFile );
525                             }
526 
527                             project.getArtifact().setFile( destFile );
528                         }
529                         else
530                         {
531                             projectHelper.attachArtifact( project, format, null, destFile );
532                         }
533                     }
534                     else if ( attach )
535                     {
536                         getLog().warn( "Assembly file: " + destFile
537                                            + " is not a regular file (it may be a directory). It cannot be attached to the project build for installation or deployment." );
538                     }
539                 }
540             }
541             catch ( final ArchiveCreationException e )
542             {
543                 throw new MojoExecutionException( "Failed to create assembly: " + e.getMessage(), e );
544             }
545             catch ( final AssemblyFormattingException e )
546             {
547                 throw new MojoExecutionException( "Failed to create assembly: " + e.getMessage(), e );
548             }
549             catch ( final InvalidAssemblerConfigurationException e )
550             {
551                 throw new MojoFailureException( assembly, "Assembly is incorrectly configured: " + assembly.getId(),
552                                                 "Assembly: " + assembly.getId() + " is not configured correctly: "
553                                                     + e.getMessage() );
554             }
555         }
556     }
557 
558     private FixedStringSearchInterpolator createRepositoryInterpolator()
559     {
560         final Properties settingsProperties = new Properties();
561         final MavenSession session = getMavenSession();
562 
563         if ( getLocalRepository() != null )
564         {
565             settingsProperties.setProperty( "localRepository", getLocalRepository().getBasedir() );
566             settingsProperties.setProperty( "settings.localRepository", getLocalRepository().getBasedir() );
567         }
568         else if ( session != null && session.getSettings() != null )
569         {
570             settingsProperties.setProperty( "localRepository", session.getSettings().getLocalRepository() );
571             settingsProperties.setProperty( "settings.localRepository", getLocalRepository().getBasedir() );
572         }
573 
574         return FixedStringSearchInterpolator.create( new PropertiesBasedValueSource( settingsProperties ) );
575 
576     }
577 
578     private FixedStringSearchInterpolator createCommandLinePropertiesInterpolator()
579     {
580         Properties commandLineProperties = System.getProperties();
581         final MavenSession session = getMavenSession();
582 
583         if ( session != null )
584         {
585             commandLineProperties = new Properties();
586             if ( session.getExecutionProperties() != null )
587             {
588                 commandLineProperties.putAll( session.getExecutionProperties() );
589             }
590 
591             if ( session.getUserProperties() != null )
592             {
593                 commandLineProperties.putAll( session.getUserProperties() );
594             }
595         }
596 
597         PropertiesBasedValueSource cliProps = new PropertiesBasedValueSource( commandLineProperties );
598         return FixedStringSearchInterpolator.create( cliProps );
599 
600     }
601 
602     private FixedStringSearchInterpolator createEnvInterpolator()
603     {
604         PrefixedPropertiesValueSource envProps = new PrefixedPropertiesValueSource( Collections.singletonList( "env." ),
605                                                                                     CommandLineUtils.getSystemEnvVars(
606                                                                                         false ), true );
607         return FixedStringSearchInterpolator.create( envProps );
608     }
609 
610     /**
611      * Returns true if the current project is located at the Execution Root Directory (where mvn was launched)
612      *
613      * @return if this is the execution root
614      */
615     boolean isThisTheExecutionRoot()
616     {
617         final Log log = getLog();
618         log.debug( "Root Folder:" + mavenSession.getExecutionRootDirectory() );
619         log.debug( "Current Folder:" + basedir );
620         final boolean result = mavenSession.getExecutionRootDirectory().equalsIgnoreCase( basedir.toString() );
621         if ( result )
622         {
623             log.debug( "This is the execution root." );
624         }
625         else
626         {
627             log.debug( "This is NOT the execution root." );
628         }
629 
630         return result;
631     }
632 
633     AssemblyArchiver getAssemblyArchiver()
634     {
635         return assemblyArchiver;
636     }
637 
638     AssemblyReader getAssemblyReader()
639     {
640         return assemblyReader;
641     }
642 
643     public File getBasedir()
644     {
645         return basedir;
646     }
647 
648     /**
649      * {@inheritDoc}
650      *
651      * @deprecated This has been replaced by {@link #getDescriptors()}
652      */
653     @Deprecated
654     public String getDescriptor()
655     {
656         return descriptor;
657     }
658 
659     /**
660      * {@inheritDoc}
661      *
662      * @deprecated This has been replaced by {@link #getDescriptorReferences()}
663      */
664     @Deprecated
665     public String getDescriptorId()
666     {
667         return descriptorId;
668     }
669 
670     public String[] getDescriptorReferences()
671     {
672         return descriptorRefs;
673     }
674 
675     public File getDescriptorSourceDirectory()
676     {
677         return descriptorSourceDirectory;
678     }
679 
680     public String[] getDescriptors()
681     {
682         return descriptors;
683     }
684 
685     public abstract MavenProject getProject();
686 
687     public File getSiteDirectory()
688     {
689         return siteDirectory;
690     }
691 
692     public boolean isSiteIncluded()
693     {
694         return includeSite;
695     }
696 
697     public String getFinalName()
698     {
699         return finalName;
700     }
701 
702     public boolean isAssemblyIdAppended()
703     {
704         return appendAssemblyId;
705     }
706 
707     public String getTarLongFileMode()
708     {
709         return tarLongFileMode;
710     }
711 
712     public File getOutputDirectory()
713     {
714         return outputDirectory;
715     }
716 
717     public MavenArchiveConfiguration getJarArchiveConfiguration()
718     {
719         return archive;
720     }
721 
722     public File getWorkingDirectory()
723     {
724         return workDirectory;
725     }
726 
727     public ArtifactRepository getLocalRepository()
728     {
729         return localRepository;
730     }
731 
732     public File getTemporaryRootDirectory()
733     {
734         return tempRoot;
735     }
736 
737     public File getArchiveBaseDirectory()
738     {
739         return archiveBaseDirectory;
740     }
741 
742     public List<String> getFilters()
743     {
744         if ( filters == null )
745         {
746             filters = getProject().getBuild().getFilters();
747             if ( filters == null )
748             {
749                 filters = Collections.emptyList();
750             }
751         }
752         return filters;
753     }
754 
755     public boolean isIncludeProjectBuildFilters()
756     {
757         return includeProjectBuildFilters;
758     }
759 
760     public List<MavenProject> getReactorProjects()
761     {
762         return reactorProjects;
763     }
764 
765     public String getClassifier()
766     {
767         // TODO Auto-generated method stub
768         return null;
769     }
770 
771     protected MavenProjectHelper getProjectHelper()
772     {
773         return projectHelper;
774     }
775 
776     public void setAppendAssemblyId( final boolean appendAssemblyId )
777     {
778         this.appendAssemblyId = appendAssemblyId;
779     }
780 
781     public void setArchive( final MavenArchiveConfiguration archive )
782     {
783         this.archive = archive;
784     }
785 
786 
787     public void setBasedir( final File basedir )
788     {
789         this.basedir = basedir;
790     }
791 
792     public void setClassifier( final String classifier )
793     {
794         this.classifier = classifier;
795     }
796 
797     /**
798      * {@inheritDoc}
799      *
800      * @deprecated This has been replaced by {@link #setDescriptors(String[])}
801      */
802     @Deprecated
803     public void setDescriptor( final String descriptor )
804     {
805         this.descriptor = descriptor;
806     }
807 
808     /**
809      * {@inheritDoc}
810      *
811      * @deprecated This has been replaced by {@link #setDescriptorRefs(String[])}
812      */
813     @Deprecated
814     public void setDescriptorId( final String descriptorId )
815     {
816         this.descriptorId = descriptorId;
817     }
818 
819     public void setDescriptorRefs( final String[] descriptorRefs )
820     {
821         this.descriptorRefs = descriptorRefs;
822     }
823 
824     public void setDescriptors( final String[] descriptors )
825     {
826         this.descriptors = descriptors;
827     }
828 
829     public void setDescriptorSourceDirectory( final File descriptorSourceDirectory )
830     {
831         this.descriptorSourceDirectory = descriptorSourceDirectory;
832     }
833 
834     public void setFilters( final List<String> filters )
835     {
836         this.filters = filters;
837     }
838 
839     public void setFinalName( final String finalName )
840     {
841         this.finalName = finalName;
842     }
843 
844     public void setIncludeSite( final boolean includeSite )
845     {
846         this.includeSite = includeSite;
847     }
848 
849     public void setLocalRepository( final ArtifactRepository localRepository )
850     {
851         this.localRepository = localRepository;
852     }
853 
854     public void setOutputDirectory( final File outputDirectory )
855     {
856         this.outputDirectory = outputDirectory;
857     }
858 
859     public void setProjectHelper( final MavenProjectHelper projectHelper )
860     {
861         this.projectHelper = projectHelper;
862     }
863 
864     public void setReactorProjects( final List<MavenProject> reactorProjects )
865     {
866         this.reactorProjects = reactorProjects;
867     }
868 
869     public void setSiteDirectory( final File siteDirectory )
870     {
871         this.siteDirectory = siteDirectory;
872     }
873 
874     public void setTarLongFileMode( final String tarLongFileMode )
875     {
876         this.tarLongFileMode = tarLongFileMode;
877     }
878 
879     public void setTempRoot( final File tempRoot )
880     {
881         this.tempRoot = tempRoot;
882     }
883 
884     public void setWorkDirectory( final File workDirectory )
885     {
886         this.workDirectory = workDirectory;
887     }
888 
889     public List<ArtifactRepository> getRemoteRepositories()
890     {
891         return remoteRepositories;
892     }
893 
894     public boolean isDryRun()
895     {
896         return dryRun;
897     }
898 
899     public boolean isIgnoreDirFormatExtensions()
900     {
901         return ignoreDirFormatExtensions;
902     }
903 
904     public boolean isIgnoreMissingDescriptor()
905     {
906         return ignoreMissingDescriptor;
907     }
908 
909     public void setIgnoreMissingDescriptor( final boolean ignoreMissingDescriptor )
910     {
911         this.ignoreMissingDescriptor = ignoreMissingDescriptor;
912     }
913 
914     public MavenSession getMavenSession()
915     {
916         return mavenSession;
917     }
918 
919     public String getArchiverConfig()
920     {
921         return archiverConfig == null ? null : archiverConfig.toString();
922     }
923 
924     public MavenReaderFilter getMavenReaderFilter()
925     {
926         return mavenReaderFilter;
927     }
928 
929     public boolean isUpdateOnly()
930     {
931         return updateOnly;
932     }
933 
934     public boolean isUseJvmChmod()
935     {
936         return useJvmChmod;
937     }
938 
939     public boolean isIgnorePermissions()
940     {
941         return ignorePermissions;
942     }
943 
944     public String getEncoding()
945     {
946         return encoding;
947     }
948 
949     boolean isRecompressZippedFiles()
950     {
951         return recompressZippedFiles;
952     }
953 
954     public String getEscapeString()
955     {
956         return escapeString;
957     }
958 
959     public List<String> getDelimiters()
960     {
961         return delimiters;
962     }
963 
964     public FixedStringSearchInterpolator getCommandLinePropsInterpolator()
965     {
966         if ( commanndLinePropertiesInterpolator == null )
967         {
968             this.commanndLinePropertiesInterpolator = createCommandLinePropertiesInterpolator();
969         }
970         return commanndLinePropertiesInterpolator;
971     }
972 
973     @Nonnull
974     public FixedStringSearchInterpolator getEnvInterpolator()
975     {
976         if ( envInterpolator == null )
977         {
978             this.envInterpolator = createEnvInterpolator();
979         }
980         return envInterpolator;
981     }
982 
983     public FixedStringSearchInterpolator getRepositoryInterpolator()
984     {
985         if ( rootInterpolator == null )
986         {
987             this.rootInterpolator = createRepositoryInterpolator();
988         }
989         return rootInterpolator;
990     }
991 
992 
993     @Nonnull
994     public FixedStringSearchInterpolator getMainProjectInterpolator()
995     {
996         if ( mainProjectInterpolator == null )
997         {
998             this.mainProjectInterpolator = mainProjectInterpolator( getProject() );
999         }
1000         return mainProjectInterpolator;
1001     }
1002 
1003     public static FixedStringSearchInterpolator mainProjectInterpolator( MavenProject mainProject )
1004     {
1005         if ( mainProject != null )
1006         {
1007             // 5
1008             return FixedStringSearchInterpolator.create(
1009                 new org.codehaus.plexus.interpolation.fixed.PrefixedObjectValueSource(
1010                     InterpolationConstants.PROJECT_PREFIXES, mainProject, true ),
1011 
1012                 // 6
1013                 new org.codehaus.plexus.interpolation.fixed.PrefixedPropertiesValueSource(
1014                     InterpolationConstants.PROJECT_PROPERTIES_PREFIXES, mainProject.getProperties(), true ) );
1015         }
1016         else
1017         {
1018             return FixedStringSearchInterpolator.empty();
1019         }
1020     }
1021 
1022 
1023     public void setDelimiters( List<String> delimiters )
1024     {
1025         this.delimiters = delimiters;
1026     }
1027 
1028 }