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 1682730 2015-05-31 12:59:49Z 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         // TODO: include dependencies marked for distribution under certain formats
462         // TODO: how, might we plug this into an installer, such as NSIS?
463 
464         boolean warnedAboutMainProjectArtifact = false;
465         for ( final Assembly assembly : assemblies )
466         {
467             try
468             {
469                 final String fullName = AssemblyFormatUtils.getDistributionName( assembly, this );
470 
471                 List<String> effectiveFormats = formats;
472                 if ( effectiveFormats == null || effectiveFormats.size() == 0 )
473                 {
474                     effectiveFormats = assembly.getFormats();
475                 }
476                 if ( effectiveFormats == null || effectiveFormats.size() == 0 )
477                 {
478                     throw new MojoFailureException(
479                         "No formats specified in the execution parameters or the assembly descriptor." );
480                 }
481 
482                 for ( final String format : effectiveFormats )
483                 {
484                     final File destFile =
485                         assemblyArchiver.createArchive( assembly, fullName, format, this, isRecompressZippedFiles() );
486 
487                     final MavenProject project = getProject();
488                     final String classifier = getClassifier();
489                     final String type = project.getArtifact().getType();
490 
491                     if ( attach && destFile.isFile() )
492                     {
493                         if ( isAssemblyIdAppended() )
494                         {
495                             projectHelper.attachArtifact( project, format, assembly.getId(), destFile );
496                         }
497                         else if ( classifier != null )
498                         {
499                             projectHelper.attachArtifact( project, format, classifier, destFile );
500                         }
501                         else if ( !"pom".equals( type ) && format.equals( type ) )
502                         {
503                             if ( !warnedAboutMainProjectArtifact )
504                             {
505                                 final StringBuilder message = new StringBuilder();
506 
507                                 message.append( "Configuration options: 'appendAssemblyId' is set to false, "
508                                     + "and 'classifier' is missing." );
509                                 message.append( "\nInstead of attaching the assembly file: " ).append( destFile );
510                                 message.append( ", it will become the file for main project artifact." );
511                                 message.append( "\nNOTE: If multiple descriptors or descriptor-formats are provided "
512                                     + "for this project, the value of this file will be non-deterministic!" );
513 
514                                 getLog().warn( message );
515                                 warnedAboutMainProjectArtifact = true;
516                             }
517 
518                             final File existingFile = project.getArtifact().getFile();
519                             if ( ( existingFile != null ) && existingFile.exists() )
520                             {
521                                 getLog().warn( "Replacing pre-existing project main-artifact file: " + existingFile
522                                                    + "\nwith assembly file: " + destFile );
523                             }
524 
525                             project.getArtifact().setFile( destFile );
526                         }
527                         else
528                         {
529                             projectHelper.attachArtifact( project, format, null, destFile );
530                         }
531                     }
532                     else if ( attach )
533                     {
534                         getLog().warn( "Assembly file: " + destFile + " is not a regular file (it may be a directory). "
535                                        + "It cannot be attached to the project build for installation or deployment." );
536                     }
537                 }
538             }
539             catch ( final ArchiveCreationException e )
540             {
541                 throw new MojoExecutionException( "Failed to create assembly: " + e.getMessage(), e );
542             }
543             catch ( final AssemblyFormattingException e )
544             {
545                 throw new MojoExecutionException( "Failed to create assembly: " + e.getMessage(), e );
546             }
547             catch ( final InvalidAssemblerConfigurationException e )
548             {
549                 throw new MojoFailureException( assembly, "Assembly is incorrectly configured: " + assembly.getId(),
550                                                 "Assembly: " + assembly.getId() + " is not configured correctly: "
551                                                     + e.getMessage() );
552             }
553         }
554     }
555 
556     private FixedStringSearchInterpolator createRepositoryInterpolator()
557     {
558         final Properties settingsProperties = new Properties();
559         final MavenSession session = getMavenSession();
560 
561         if ( getLocalRepository() != null )
562         {
563             settingsProperties.setProperty( "localRepository", getLocalRepository().getBasedir() );
564             settingsProperties.setProperty( "settings.localRepository", getLocalRepository().getBasedir() );
565         }
566         else if ( session != null && session.getSettings() != null )
567         {
568             settingsProperties.setProperty( "localRepository", session.getSettings().getLocalRepository() );
569             settingsProperties.setProperty( "settings.localRepository", getLocalRepository().getBasedir() );
570         }
571 
572         return FixedStringSearchInterpolator.create( new PropertiesBasedValueSource( settingsProperties ) );
573 
574     }
575 
576     private FixedStringSearchInterpolator createCommandLinePropertiesInterpolator()
577     {
578         Properties commandLineProperties = System.getProperties();
579         final MavenSession session = getMavenSession();
580 
581         if ( session != null )
582         {
583             commandLineProperties = new Properties();
584             if ( session.getExecutionProperties() != null )
585             {
586                 commandLineProperties.putAll( session.getExecutionProperties() );
587             }
588 
589             if ( session.getUserProperties() != null )
590             {
591                 commandLineProperties.putAll( session.getUserProperties() );
592             }
593         }
594 
595         PropertiesBasedValueSource cliProps = new PropertiesBasedValueSource( commandLineProperties );
596         return FixedStringSearchInterpolator.create( cliProps );
597 
598     }
599 
600     private FixedStringSearchInterpolator createEnvInterpolator()
601     {
602         PrefixedPropertiesValueSource envProps = new PrefixedPropertiesValueSource( Collections.singletonList( "env." ),
603                                                                                     CommandLineUtils.getSystemEnvVars(
604                                                                                         false ), true );
605         return FixedStringSearchInterpolator.create( envProps );
606     }
607 
608     /**
609      * Returns true if the current project is located at the Execution Root Directory (where mvn was launched)
610      *
611      * @return if this is the execution root
612      */
613     boolean isThisTheExecutionRoot()
614     {
615         final Log log = getLog();
616         log.debug( "Root Folder:" + mavenSession.getExecutionRootDirectory() );
617         log.debug( "Current Folder:" + basedir );
618         final boolean result = mavenSession.getExecutionRootDirectory().equalsIgnoreCase( basedir.toString() );
619         if ( result )
620         {
621             log.debug( "This is the execution root." );
622         }
623         else
624         {
625             log.debug( "This is NOT the execution root." );
626         }
627 
628         return result;
629     }
630 
631     AssemblyArchiver getAssemblyArchiver()
632     {
633         return assemblyArchiver;
634     }
635 
636     AssemblyReader getAssemblyReader()
637     {
638         return assemblyReader;
639     }
640 
641     public File getBasedir()
642     {
643         return basedir;
644     }
645 
646     /**
647      * {@inheritDoc}
648      *
649      * @deprecated This has been replaced by {@link #getDescriptors()}
650      */
651     @Deprecated
652     public String getDescriptor()
653     {
654         return descriptor;
655     }
656 
657     /**
658      * {@inheritDoc}
659      *
660      * @deprecated This has been replaced by {@link #getDescriptorReferences()}
661      */
662     @Deprecated
663     public String getDescriptorId()
664     {
665         return descriptorId;
666     }
667 
668     public String[] getDescriptorReferences()
669     {
670         return descriptorRefs;
671     }
672 
673     public File getDescriptorSourceDirectory()
674     {
675         return descriptorSourceDirectory;
676     }
677 
678     public String[] getDescriptors()
679     {
680         return descriptors;
681     }
682 
683     public abstract MavenProject getProject();
684 
685     public File getSiteDirectory()
686     {
687         return siteDirectory;
688     }
689 
690     public boolean isSiteIncluded()
691     {
692         return includeSite;
693     }
694 
695     public String getFinalName()
696     {
697         return finalName;
698     }
699 
700     public boolean isAssemblyIdAppended()
701     {
702         return appendAssemblyId;
703     }
704 
705     public String getTarLongFileMode()
706     {
707         return tarLongFileMode;
708     }
709 
710     public File getOutputDirectory()
711     {
712         return outputDirectory;
713     }
714 
715     public MavenArchiveConfiguration getJarArchiveConfiguration()
716     {
717         return archive;
718     }
719 
720     public File getWorkingDirectory()
721     {
722         return workDirectory;
723     }
724 
725     public ArtifactRepository getLocalRepository()
726     {
727         return localRepository;
728     }
729 
730     public File getTemporaryRootDirectory()
731     {
732         return tempRoot;
733     }
734 
735     public File getArchiveBaseDirectory()
736     {
737         return archiveBaseDirectory;
738     }
739 
740     public List<String> getFilters()
741     {
742         if ( filters == null )
743         {
744             filters = getProject().getBuild().getFilters();
745             if ( filters == null )
746             {
747                 filters = Collections.emptyList();
748             }
749         }
750         return filters;
751     }
752 
753     public boolean isIncludeProjectBuildFilters()
754     {
755         return includeProjectBuildFilters;
756     }
757 
758     public List<MavenProject> getReactorProjects()
759     {
760         return reactorProjects;
761     }
762 
763     public String getClassifier()
764     {
765         // TODO Auto-generated method stub
766         return null;
767     }
768 
769     protected MavenProjectHelper getProjectHelper()
770     {
771         return projectHelper;
772     }
773 
774     public void setAppendAssemblyId( final boolean appendAssemblyId )
775     {
776         this.appendAssemblyId = appendAssemblyId;
777     }
778 
779     public void setArchive( final MavenArchiveConfiguration archive )
780     {
781         this.archive = archive;
782     }
783 
784 
785     public void setBasedir( final File basedir )
786     {
787         this.basedir = basedir;
788     }
789 
790     public void setClassifier( final String classifier )
791     {
792         this.classifier = classifier;
793     }
794 
795     /**
796      * {@inheritDoc}
797      *
798      * @deprecated This has been replaced by {@link #setDescriptors(String[])}
799      */
800     @Deprecated
801     public void setDescriptor( final String descriptor )
802     {
803         this.descriptor = descriptor;
804     }
805 
806     /**
807      * {@inheritDoc}
808      *
809      * @deprecated This has been replaced by {@link #setDescriptorRefs(String[])}
810      */
811     @Deprecated
812     public void setDescriptorId( final String descriptorId )
813     {
814         this.descriptorId = descriptorId;
815     }
816 
817     public void setDescriptorRefs( final String[] descriptorRefs )
818     {
819         this.descriptorRefs = descriptorRefs;
820     }
821 
822     public void setDescriptors( final String[] descriptors )
823     {
824         this.descriptors = descriptors;
825     }
826 
827     public void setDescriptorSourceDirectory( final File descriptorSourceDirectory )
828     {
829         this.descriptorSourceDirectory = descriptorSourceDirectory;
830     }
831 
832     public void setFilters( final List<String> filters )
833     {
834         this.filters = filters;
835     }
836 
837     public void setFinalName( final String finalName )
838     {
839         this.finalName = finalName;
840     }
841 
842     public void setIncludeSite( final boolean includeSite )
843     {
844         this.includeSite = includeSite;
845     }
846 
847     public void setLocalRepository( final ArtifactRepository localRepository )
848     {
849         this.localRepository = localRepository;
850     }
851 
852     public void setOutputDirectory( final File outputDirectory )
853     {
854         this.outputDirectory = outputDirectory;
855     }
856 
857     public void setProjectHelper( final MavenProjectHelper projectHelper )
858     {
859         this.projectHelper = projectHelper;
860     }
861 
862     public void setReactorProjects( final List<MavenProject> reactorProjects )
863     {
864         this.reactorProjects = reactorProjects;
865     }
866 
867     public void setSiteDirectory( final File siteDirectory )
868     {
869         this.siteDirectory = siteDirectory;
870     }
871 
872     public void setTarLongFileMode( final String tarLongFileMode )
873     {
874         this.tarLongFileMode = tarLongFileMode;
875     }
876 
877     public void setTempRoot( final File tempRoot )
878     {
879         this.tempRoot = tempRoot;
880     }
881 
882     public void setWorkDirectory( final File workDirectory )
883     {
884         this.workDirectory = workDirectory;
885     }
886 
887     public List<ArtifactRepository> getRemoteRepositories()
888     {
889         return remoteRepositories;
890     }
891 
892     public boolean isDryRun()
893     {
894         return dryRun;
895     }
896 
897     public boolean isIgnoreDirFormatExtensions()
898     {
899         return ignoreDirFormatExtensions;
900     }
901 
902     public boolean isIgnoreMissingDescriptor()
903     {
904         return ignoreMissingDescriptor;
905     }
906 
907     public void setIgnoreMissingDescriptor( final boolean ignoreMissingDescriptor )
908     {
909         this.ignoreMissingDescriptor = ignoreMissingDescriptor;
910     }
911 
912     public MavenSession getMavenSession()
913     {
914         return mavenSession;
915     }
916 
917     public String getArchiverConfig()
918     {
919         return archiverConfig == null ? null : archiverConfig.toString();
920     }
921 
922     public MavenReaderFilter getMavenReaderFilter()
923     {
924         return mavenReaderFilter;
925     }
926 
927     public boolean isUpdateOnly()
928     {
929         return updateOnly;
930     }
931 
932     public boolean isUseJvmChmod()
933     {
934         return useJvmChmod;
935     }
936 
937     public boolean isIgnorePermissions()
938     {
939         return ignorePermissions;
940     }
941 
942     public String getEncoding()
943     {
944         return encoding;
945     }
946 
947     boolean isRecompressZippedFiles()
948     {
949         return recompressZippedFiles;
950     }
951 
952     public String getEscapeString()
953     {
954         return escapeString;
955     }
956 
957     public List<String> getDelimiters()
958     {
959         return delimiters;
960     }
961 
962     @Nonnull public FixedStringSearchInterpolator getCommandLinePropsInterpolator()
963     {
964         if ( commanndLinePropertiesInterpolator == null )
965         {
966             this.commanndLinePropertiesInterpolator = createCommandLinePropertiesInterpolator();
967         }
968         return commanndLinePropertiesInterpolator;
969     }
970 
971     @Nonnull
972     public FixedStringSearchInterpolator getEnvInterpolator()
973     {
974         if ( envInterpolator == null )
975         {
976             this.envInterpolator = createEnvInterpolator();
977         }
978         return envInterpolator;
979     }
980 
981     @Nonnull public FixedStringSearchInterpolator getRepositoryInterpolator()
982     {
983         if ( rootInterpolator == null )
984         {
985             this.rootInterpolator = createRepositoryInterpolator();
986         }
987         return rootInterpolator;
988     }
989 
990 
991     @Nonnull
992     public FixedStringSearchInterpolator getMainProjectInterpolator()
993     {
994         if ( mainProjectInterpolator == null )
995         {
996             this.mainProjectInterpolator = mainProjectInterpolator( getProject() );
997         }
998         return mainProjectInterpolator;
999     }
1000 
1001     public static FixedStringSearchInterpolator mainProjectInterpolator( MavenProject mainProject )
1002     {
1003         if ( mainProject != null )
1004         {
1005             // 5
1006             return FixedStringSearchInterpolator.create(
1007                 new org.codehaus.plexus.interpolation.fixed.PrefixedObjectValueSource(
1008                     InterpolationConstants.PROJECT_PREFIXES, mainProject, true ),
1009 
1010                 // 6
1011                 new org.codehaus.plexus.interpolation.fixed.PrefixedPropertiesValueSource(
1012                     InterpolationConstants.PROJECT_PROPERTIES_PREFIXES, mainProject.getProperties(), true ) );
1013         }
1014         else
1015         {
1016             return FixedStringSearchInterpolator.empty();
1017         }
1018     }
1019 
1020 
1021     public void setDelimiters( List<String> delimiters )
1022     {
1023         this.delimiters = delimiters;
1024     }
1025 
1026 }