Coverage Report - org.apache.maven.plugin.assembly.archive.phase.DependencySetAssemblyPhase
 
Classes in this File Line Coverage Branch Coverage Complexity
DependencySetAssemblyPhase
77%
7/9
N/A
1
 
 1  
 package org.apache.maven.plugin.assembly.archive.phase;
 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.plugin.assembly.AssemblerConfigurationSource;
 23  
 import org.apache.maven.plugin.assembly.AssemblyContext;
 24  
 import org.apache.maven.plugin.assembly.InvalidAssemblerConfigurationException;
 25  
 import org.apache.maven.plugin.assembly.archive.ArchiveCreationException;
 26  
 import org.apache.maven.plugin.assembly.archive.task.AddDependencySetsTask;
 27  
 import org.apache.maven.plugin.assembly.format.AssemblyFormattingException;
 28  
 import org.apache.maven.plugin.assembly.model.Assembly;
 29  
 import org.apache.maven.project.MavenProjectBuilder;
 30  
 import org.codehaus.plexus.archiver.Archiver;
 31  
 import org.codehaus.plexus.archiver.manager.ArchiverManager;
 32  
 import org.codehaus.plexus.component.annotations.Component;
 33  
 import org.codehaus.plexus.component.annotations.Requirement;
 34  
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 35  
 import org.codehaus.plexus.logging.Logger;
 36  
 
 37  
 /**
 38  
  * Handles the top-level <dependencySets/> section of the assembly descriptor.
 39  
  * 
 40  
  * @version $Id: DependencySetAssemblyPhase.java 1163853 2011-08-31 22:42:32Z jdcasey $
 41  
  */
 42  
 @Component( role = AssemblyArchiverPhase.class, hint = "dependency-sets" )
 43  
 public class DependencySetAssemblyPhase
 44  
     extends AbstractLogEnabled
 45  
     implements AssemblyArchiverPhase
 46  
 {
 47  
 
 48  
     @Requirement
 49  
     private MavenProjectBuilder projectBuilder;
 50  
 
 51  
     @Requirement
 52  
     private ArchiverManager archiverManager;
 53  
 
 54  
     public DependencySetAssemblyPhase()
 55  0
     {
 56  
         // used for plexus init
 57  0
     }
 58  
 
 59  
     public DependencySetAssemblyPhase( final MavenProjectBuilder projectBuilder, final Logger logger )
 60  6
     {
 61  6
         this.projectBuilder = projectBuilder;
 62  6
         enableLogging( logger );
 63  6
     }
 64  
 
 65  
     /**
 66  
      * {@inheritDoc}
 67  
      */
 68  
     public void execute( final Assembly assembly, final Archiver archiver,
 69  
                          final AssemblerConfigurationSource configSource, final AssemblyContext context )
 70  
         throws ArchiveCreationException, AssemblyFormattingException, InvalidAssemblerConfigurationException
 71  
     {
 72  6
         final AddDependencySetsTask task =
 73  
             new AddDependencySetsTask( assembly.getDependencySets(), context.getResolvedArtifacts(),
 74  
                                        configSource.getProject(), projectBuilder, archiverManager, getLogger() );
 75  
 
 76  6
         task.execute( archiver, configSource );
 77  6
     }
 78  
 }