View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.maven.plugins.assembly.archive;
20  
21  import java.io.File;
22  import java.nio.file.attribute.FileTime;
23  
24  import org.apache.maven.plugins.assembly.AssemblerConfigurationSource;
25  import org.apache.maven.plugins.assembly.InvalidAssemblerConfigurationException;
26  import org.apache.maven.plugins.assembly.format.AssemblyFormattingException;
27  import org.apache.maven.plugins.assembly.model.Assembly;
28  
29  /**
30   * Creates an archive
31   *
32   *
33   */
34  public interface AssemblyArchiver {
35      /**
36       * Create the assembly archive. Generally:
37       * <ol>
38       * <li>Setup any directory structures for temporary files</li>
39       * <li>Calculate the output directory/file for the assembly</li>
40       * <li>Setup any handler components for special descriptor files we may encounter</li>
41       * <li>Lookup and configure the {@link org.codehaus.plexus.archiver.Archiver} to be used</li>
42       * <li>Determine what, if any, dependency resolution will be required, and resolve any dependency-version conflicts
43       * up front to produce a managed-version map for the whole assembly process.</li>
44       * <li>Iterate through the available {@link org.apache.maven.plugins.assembly.archive.phase.AssemblyArchiverPhase}
45       * instances, executing each to handle a different
46       * top-level section of the assembly descriptor, if that section is present.</li>
47       * </ol>
48       *
49       * @param assembly              The {@link Assembly}
50       * @param fullName              The full name.
51       * @param format                The format.
52       * @param configSource          The {@link org.apache.maven.plugins.assembly.AssemblerConfigurationSource}
53       * @param sourceDateEpoch       Timestamp for reproducible archive entries
54       * @return The resulting archive file.
55       * @throws ArchiveCreationException                                                 when creation fails
56       * @throws org.apache.maven.plugins.assembly.format.AssemblyFormattingException     when formatting fails
57       * @throws org.apache.maven.plugins.assembly.InvalidAssemblerConfigurationException when the configuration is bad
58       */
59      File createArchive(
60              Assembly assembly,
61              String fullName,
62              String format,
63              AssemblerConfigurationSource configSource,
64              FileTime sourceDateEpoch)
65              throws ArchiveCreationException, AssemblyFormattingException, InvalidAssemblerConfigurationException;
66  }