Coverage Report - org.apache.maven.plugin.source.SourceJarNoForkMojo
 
Classes in this File Line Coverage Branch Coverage Complexity
SourceJarNoForkMojo
83%
5/6
50%
1/2
1.667
 
 1  
 package org.apache.maven.plugin.source;
 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.model.Resource;
 23  
 import org.apache.maven.plugins.annotations.LifecyclePhase;
 24  
 import org.apache.maven.plugins.annotations.Mojo;
 25  
 import org.apache.maven.plugins.annotations.Parameter;
 26  
 import org.apache.maven.project.MavenProject;
 27  
 
 28  
 import java.util.Collections;
 29  
 import java.util.List;
 30  
 
 31  
 /**
 32  
  * This goal bundles all the sources into a jar archive.  This goal functions the same
 33  
  * as the jar goal but does not fork the build and is suitable for attaching
 34  
  * to the build lifecycle.
 35  
  *
 36  
  * @author pgier
 37  
  * @version $Id: SourceJarNoForkMojo.java 1355857 2012-07-01 08:03:27Z olamy $
 38  
  * @since 2.1
 39  
  */
 40  
 @Mojo( name = "jar-no-fork", defaultPhase = LifecyclePhase.PACKAGE, threadSafe = true )
 41  10
 public class SourceJarNoForkMojo
 42  
     extends AbstractSourceJarMojo
 43  
 {
 44  
     /**
 45  
      * @since 2.2
 46  
      */
 47  
     @Parameter( property = "maven.source.classifier", defaultValue = "sources" )
 48  
     protected String classifier;
 49  
 
 50  
     /**
 51  
      * {@inheritDoc}
 52  
      */
 53  
     protected List<String> getSources( MavenProject p )
 54  
     {
 55  8
         return p.getCompileSourceRoots();
 56  
     }
 57  
 
 58  
     /**
 59  
      * {@inheritDoc}
 60  
      */
 61  
     protected List<Resource> getResources( MavenProject p )
 62  
     {
 63  8
         if ( excludeResources )
 64  
         {
 65  0
             return Collections.emptyList();
 66  
         }
 67  
 
 68  8
         return p.getResources();
 69  
     }
 70  
 
 71  
     /**
 72  
      * {@inheritDoc}
 73  
      */
 74  
     protected String getClassifier()
 75  
     {
 76  8
         return classifier;
 77  
     }
 78  
 }